@colbymchenry/codegraph 0.7.10 → 0.8.0

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 (75) hide show
  1. package/README.md +48 -48
  2. package/dist/bin/codegraph.js +25 -0
  3. package/dist/bin/codegraph.js.map +1 -1
  4. package/dist/context/index.d.ts.map +1 -1
  5. package/dist/context/index.js +4 -2
  6. package/dist/context/index.js.map +1 -1
  7. package/dist/extraction/index.d.ts.map +1 -1
  8. package/dist/extraction/index.js +63 -37
  9. package/dist/extraction/index.js.map +1 -1
  10. package/dist/installer/config-writer.d.ts.map +1 -1
  11. package/dist/installer/config-writer.js +3 -1
  12. package/dist/installer/config-writer.js.map +1 -1
  13. package/dist/installer/index.d.ts +12 -0
  14. package/dist/installer/index.d.ts.map +1 -1
  15. package/dist/installer/index.js +72 -4
  16. package/dist/installer/index.js.map +1 -1
  17. package/dist/installer/instructions-template.d.ts +2 -2
  18. package/dist/installer/instructions-template.d.ts.map +1 -1
  19. package/dist/installer/instructions-template.js +3 -2
  20. package/dist/installer/instructions-template.js.map +1 -1
  21. package/dist/installer/targets/claude.d.ts +10 -6
  22. package/dist/installer/targets/claude.d.ts.map +1 -1
  23. package/dist/installer/targets/claude.js +72 -10
  24. package/dist/installer/targets/claude.js.map +1 -1
  25. package/dist/mcp/index.d.ts +8 -0
  26. package/dist/mcp/index.d.ts.map +1 -1
  27. package/dist/mcp/index.js +116 -18
  28. package/dist/mcp/index.js.map +1 -1
  29. package/dist/mcp/server-instructions.d.ts +1 -1
  30. package/dist/mcp/server-instructions.d.ts.map +1 -1
  31. package/dist/mcp/server-instructions.js +14 -2
  32. package/dist/mcp/server-instructions.js.map +1 -1
  33. package/dist/mcp/tools.d.ts +59 -2
  34. package/dist/mcp/tools.d.ts.map +1 -1
  35. package/dist/mcp/tools.js +384 -70
  36. package/dist/mcp/tools.js.map +1 -1
  37. package/dist/mcp/transport.d.ts +17 -0
  38. package/dist/mcp/transport.d.ts.map +1 -1
  39. package/dist/mcp/transport.js +63 -0
  40. package/dist/mcp/transport.js.map +1 -1
  41. package/dist/resolution/frameworks/index.d.ts +1 -0
  42. package/dist/resolution/frameworks/index.d.ts.map +1 -1
  43. package/dist/resolution/frameworks/index.js +5 -1
  44. package/dist/resolution/frameworks/index.js.map +1 -1
  45. package/dist/resolution/frameworks/nestjs.d.ts +26 -0
  46. package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  47. package/dist/resolution/frameworks/nestjs.js +374 -0
  48. package/dist/resolution/frameworks/nestjs.js.map +1 -0
  49. package/dist/search/query-utils.d.ts.map +1 -1
  50. package/dist/search/query-utils.js +29 -26
  51. package/dist/search/query-utils.js.map +1 -1
  52. package/dist/sync/git-hooks.d.ts +45 -0
  53. package/dist/sync/git-hooks.d.ts.map +1 -0
  54. package/dist/sync/git-hooks.js +223 -0
  55. package/dist/sync/git-hooks.js.map +1 -0
  56. package/dist/sync/index.d.ts +4 -0
  57. package/dist/sync/index.d.ts.map +1 -1
  58. package/dist/sync/index.js +12 -1
  59. package/dist/sync/index.js.map +1 -1
  60. package/dist/sync/watch-policy.d.ts +48 -0
  61. package/dist/sync/watch-policy.d.ts.map +1 -0
  62. package/dist/sync/watch-policy.js +124 -0
  63. package/dist/sync/watch-policy.js.map +1 -0
  64. package/dist/sync/watcher.d.ts.map +1 -1
  65. package/dist/sync/watcher.js +10 -0
  66. package/dist/sync/watcher.js.map +1 -1
  67. package/package.json +3 -3
  68. package/scripts/agent-eval/audit.sh +68 -0
  69. package/scripts/agent-eval/itrun.sh +107 -0
  70. package/scripts/agent-eval/parse-run.mjs +45 -0
  71. package/scripts/agent-eval/parse-session.mjs +93 -0
  72. package/scripts/agent-eval/run-agent.sh +34 -0
  73. package/scripts/agent-eval/run-all.sh +67 -0
  74. package/scripts/extract-release-notes.mjs +130 -0
  75. package/scripts/release.sh +5 -7
@@ -10,6 +10,47 @@ import CodeGraph from '../index';
10
10
  * but smaller ones should use fewer to avoid unnecessary overhead.
11
11
  */
12
12
  export declare function getExploreBudget(fileCount: number): number;
13
+ /**
14
+ * Adaptive output budget for `codegraph_explore`, scaled to project size.
15
+ *
16
+ * Smaller codebases get a tighter total cap, fewer default files, smaller
17
+ * per-file cap, and tighter clustering — so a focused query on a 100-file
18
+ * project doesn't dump a whole file's worth of source into the agent's
19
+ * context. Larger codebases keep the generous defaults because the
20
+ * agent's native discovery cost (grep + find + many Reads) genuinely
21
+ * dwarfs a fat explore call at that scale.
22
+ *
23
+ * Meta-text (relationships map, "additional relevant files" list,
24
+ * completeness signal, budget note) is gated off for tiny projects
25
+ * where one rich call is the whole story and the extra prose is just
26
+ * overhead.
27
+ *
28
+ * Tier breakpoints mirror `getExploreBudget` so a project sits in the
29
+ * same tier across both knobs.
30
+ */
31
+ export interface ExploreOutputBudget {
32
+ /** Hard cap on total output characters. */
33
+ maxOutputChars: number;
34
+ /** Default `maxFiles` when the caller didn't specify one. */
35
+ defaultMaxFiles: number;
36
+ /** Cap on contiguous source returned per file (across all its clusters). */
37
+ maxCharsPerFile: number;
38
+ /** Cluster gap threshold in lines — tighter clustering on small projects. */
39
+ gapThreshold: number;
40
+ /** Max symbols listed in the per-file header (`#### path — sym(kind), ...`). */
41
+ maxSymbolsInFileHeader: number;
42
+ /** Max edges shown per relationship kind in the Relationships section. */
43
+ maxEdgesPerRelationshipKind: number;
44
+ /** Include the "Relationships" section. */
45
+ includeRelationships: boolean;
46
+ /** Include the "Additional relevant files (not shown)" trailing list. */
47
+ includeAdditionalFiles: boolean;
48
+ /** Include the "Complete source code is included above…" reminder. */
49
+ includeCompletenessSignal: boolean;
50
+ /** Include the explore-budget reminder at the end. */
51
+ includeBudgetNote: boolean;
52
+ }
53
+ export declare function getExploreOutputBudget(fileCount: number): ExploreOutputBudget;
13
54
  /**
14
55
  * MCP Tool definition
15
56
  */
@@ -56,11 +97,17 @@ export declare const tools: ToolDefinition[];
56
97
  export declare class ToolHandler {
57
98
  private cg;
58
99
  private projectCache;
100
+ private defaultProjectHint;
59
101
  constructor(cg: CodeGraph | null);
60
102
  /**
61
103
  * Update the default CodeGraph instance (e.g. after lazy initialization)
62
104
  */
63
105
  setDefaultCodeGraph(cg: CodeGraph): void;
106
+ /**
107
+ * Record the directory the server tried to resolve the default project from.
108
+ * Used only to make the "no default project" error actionable.
109
+ */
110
+ setDefaultProjectHint(searchedPath: string): void;
64
111
  /**
65
112
  * Whether a default CodeGraph instance is available
66
113
  */
@@ -117,14 +164,16 @@ export declare class ToolHandler {
117
164
  * Handle codegraph_impact
118
165
  */
119
166
  private handleImpact;
120
- /** Maximum output for explore tool — sized to stay under MCP client token limits (~10k tokens) */
121
- private static readonly EXPLORE_MAX_OUTPUT;
122
167
  /**
123
168
  * Handle codegraph_explore — deep exploration in a single call
124
169
  *
125
170
  * Strategy: find relevant symbols via graph traversal, group by file,
126
171
  * then read contiguous file sections covering all symbols per file.
127
172
  * This replaces multiple codegraph_node + Read calls.
173
+ *
174
+ * Output size is adaptive to project file count via
175
+ * `getExploreOutputBudget` — see #185 for why a fixed 35k cap was a
176
+ * tax on small projects while earning its keep on large ones.
128
177
  */
129
178
  private handleExplore;
130
179
  /**
@@ -191,6 +240,14 @@ export declare class ToolHandler {
191
240
  private formatSearchResults;
192
241
  private formatNodeList;
193
242
  private formatImpact;
243
+ /**
244
+ * Build a compact structural outline of a container symbol from its
245
+ * indexed children (methods, fields, properties, …) — name, kind,
246
+ * line number, and signature — so the agent gets the shape of a class
247
+ * without the full source of every method. Returns '' when the container
248
+ * has no indexed children, so the caller can fall back to full source.
249
+ */
250
+ private buildContainerOutline;
194
251
  private formatNodeDetails;
195
252
  private formatTaskContext;
196
253
  private textResult;
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,SAAuC,MAAM,UAAU,CAAC;AA2B/D;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE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