@compilr-dev/agents-coding-ts 0.1.5 → 0.1.6
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/dist/tools/find-dead-code.js +2 -3
- package/dist/tools/find-duplicates.js +2 -3
- package/dist/tools/find-implementations.js +2 -3
- package/dist/tools/find-patterns.js +2 -3
- package/dist/tools/find-references.js +2 -3
- package/dist/tools/find-symbol.js +2 -3
- package/dist/tools/get-call-graph.js +2 -3
- package/dist/tools/get-complexity.js +2 -3
- package/dist/tools/get-dependency-graph.js +2 -3
- package/dist/tools/get-documentation.js +2 -4
- package/dist/tools/get-exports.js +2 -3
- package/dist/tools/get-file-structure.js +2 -3
- package/dist/tools/get-imports.js +2 -3
- package/dist/tools/get-signature.js +2 -3
- package/dist/tools/get-type-hierarchy.js +2 -3
- package/dist/tools/read-symbol.js +6 -7
- package/package.json +1 -1
|
@@ -9,10 +9,9 @@ import * as path from "node:path";
|
|
|
9
9
|
import * as ts from "typescript";
|
|
10
10
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
11
11
|
import { detectLanguage, isLanguageSupported, } from "../parser/typescript-parser.js";
|
|
12
|
+
// Original: 'Find potentially unused exports, functions, and variables.\nAnalyzes the codebase to identify code that may be dead (never used).\nUseful for cleanup and reducing bundle size.'
|
|
12
13
|
// Tool description
|
|
13
|
-
const TOOL_DESCRIPTION =
|
|
14
|
-
Analyzes the codebase to identify code that may be dead (never used).
|
|
15
|
-
Useful for cleanup and reducing bundle size.`;
|
|
14
|
+
const TOOL_DESCRIPTION = "Find potentially unused exports, functions, and variables in the codebase.";
|
|
16
15
|
// Tool input schema
|
|
17
16
|
const TOOL_INPUT_SCHEMA = {
|
|
18
17
|
type: "object",
|
|
@@ -8,10 +8,9 @@ import * as fs from "node:fs/promises";
|
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import * as crypto from "node:crypto";
|
|
10
10
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
11
|
+
// Original: 'Detect duplicate code blocks across the codebase.\nUses content hashing to find similar code patterns.\nUseful for identifying refactoring opportunities and reducing code duplication.'
|
|
11
12
|
// Tool description
|
|
12
|
-
const TOOL_DESCRIPTION =
|
|
13
|
-
Uses content hashing to find similar code patterns.
|
|
14
|
-
Useful for identifying refactoring opportunities and reducing code duplication.`;
|
|
13
|
+
const TOOL_DESCRIPTION = "Detect duplicate code blocks across the codebase using content hashing.";
|
|
15
14
|
// Tool input schema
|
|
16
15
|
const TOOL_INPUT_SCHEMA = {
|
|
17
16
|
type: "object",
|
|
@@ -9,10 +9,9 @@ import * as path from "node:path";
|
|
|
9
9
|
import * as ts from "typescript";
|
|
10
10
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
11
11
|
import { detectLanguage, isLanguageSupported, } from "../parser/typescript-parser.js";
|
|
12
|
+
// Original: 'Find classes that implement an interface or extend an abstract class.\nReturns information about each implementation including which methods are implemented.\nUseful for understanding how interfaces are used across the codebase.'
|
|
12
13
|
// Tool description
|
|
13
|
-
const TOOL_DESCRIPTION =
|
|
14
|
-
Returns information about each implementation including which methods are implemented.
|
|
15
|
-
Useful for understanding how interfaces are used across the codebase.`;
|
|
14
|
+
const TOOL_DESCRIPTION = "Find classes that implement an interface or extend an abstract class.";
|
|
16
15
|
// Tool input schema
|
|
17
16
|
const TOOL_INPUT_SCHEMA = {
|
|
18
17
|
type: "object",
|
|
@@ -9,10 +9,9 @@ import * as path from "node:path";
|
|
|
9
9
|
import * as ts from "typescript";
|
|
10
10
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
11
11
|
import { detectLanguage, isLanguageSupported, } from "../parser/typescript-parser.js";
|
|
12
|
+
// Original: 'Find code patterns, anti-patterns, and code smells.\nSearches for common issues like security vulnerabilities, performance problems, and maintainability concerns.\nSupports built-in patterns or custom pattern definitions.'
|
|
12
13
|
// Tool description
|
|
13
|
-
const TOOL_DESCRIPTION =
|
|
14
|
-
Searches for common issues like security vulnerabilities, performance problems, and maintainability concerns.
|
|
15
|
-
Supports built-in patterns or custom pattern definitions.`;
|
|
14
|
+
const TOOL_DESCRIPTION = "Find code patterns, anti-patterns, and code smells in the codebase.";
|
|
16
15
|
// Tool input schema
|
|
17
16
|
const TOOL_INPUT_SCHEMA = {
|
|
18
17
|
type: "object",
|
|
@@ -24,10 +24,9 @@ const SUPPORTED_EXTENSIONS = new Set([
|
|
|
24
24
|
function hasModifierKind(modifiers, kind) {
|
|
25
25
|
return modifiers?.some((m) => m.kind === kind) ?? false;
|
|
26
26
|
}
|
|
27
|
+
// Original: 'Find all usages of a symbol across the codebase.\nReturns structured JSON with file paths, line numbers, and reference types.\nUse this to understand how a function, class, or variable is used throughout the project.'
|
|
27
28
|
// Tool description
|
|
28
|
-
const TOOL_DESCRIPTION =
|
|
29
|
-
Returns structured JSON with file paths, line numbers, and reference types.
|
|
30
|
-
Use this to understand how a function, class, or variable is used throughout the project.`;
|
|
29
|
+
const TOOL_DESCRIPTION = "Find all usages of a symbol across the codebase with file paths and line numbers.";
|
|
31
30
|
// Tool input schema
|
|
32
31
|
const TOOL_INPUT_SCHEMA = {
|
|
33
32
|
type: "object",
|
|
@@ -24,10 +24,9 @@ const SUPPORTED_EXTENSIONS = new Set([
|
|
|
24
24
|
function hasModifierKind(modifiers, kind) {
|
|
25
25
|
return modifiers?.some((m) => m.kind === kind) ?? false;
|
|
26
26
|
}
|
|
27
|
+
// Original: 'Find the definition location of a symbol by name across the codebase.\nReturns structured JSON with file path, line number, symbol kind, and other metadata.\nUse this to locate where functions, classes, variables, types, etc. are defined.'
|
|
27
28
|
// Tool description
|
|
28
|
-
const TOOL_DESCRIPTION =
|
|
29
|
-
Returns structured JSON with file path, line number, symbol kind, and other metadata.
|
|
30
|
-
Use this to locate where functions, classes, variables, types, etc. are defined.`;
|
|
29
|
+
const TOOL_DESCRIPTION = "Find the definition location of a symbol by name across the codebase.";
|
|
31
30
|
// Tool input schema
|
|
32
31
|
const TOOL_INPUT_SCHEMA = {
|
|
33
32
|
type: "object",
|
|
@@ -9,10 +9,9 @@ import * as path from "node:path";
|
|
|
9
9
|
import * as ts from "typescript";
|
|
10
10
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
11
11
|
import { detectLanguage, isLanguageSupported, } from "../parser/typescript-parser.js";
|
|
12
|
+
// Original: 'Analyze function call relationships in source code.\nReturns a call graph showing which functions call which other functions.\nUse this to understand code flow, dependencies, and refactoring impact.'
|
|
12
13
|
// Tool description
|
|
13
|
-
const TOOL_DESCRIPTION =
|
|
14
|
-
Returns a call graph showing which functions call which other functions.
|
|
15
|
-
Use this to understand code flow, dependencies, and refactoring impact.`;
|
|
14
|
+
const TOOL_DESCRIPTION = "Analyze function call relationships and build a call graph.";
|
|
16
15
|
// Tool input schema
|
|
17
16
|
const TOOL_INPUT_SCHEMA = {
|
|
18
17
|
type: "object",
|
|
@@ -9,10 +9,9 @@ import * as path from "node:path";
|
|
|
9
9
|
import * as ts from "typescript";
|
|
10
10
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
11
11
|
import { detectLanguage, isLanguageSupported, } from "../parser/typescript-parser.js";
|
|
12
|
+
// Original: 'Calculate code complexity metrics for files or directories.\nReturns cyclomatic complexity, cognitive complexity, nesting depth, and identifies hotspots.\nUseful for finding functions that may need refactoring.'
|
|
12
13
|
// Tool description
|
|
13
|
-
const TOOL_DESCRIPTION =
|
|
14
|
-
Returns cyclomatic complexity, cognitive complexity, nesting depth, and identifies hotspots.
|
|
15
|
-
Useful for finding functions that may need refactoring.`;
|
|
14
|
+
const TOOL_DESCRIPTION = "Calculate code complexity metrics (cyclomatic, cognitive, nesting depth).";
|
|
16
15
|
// Tool input schema
|
|
17
16
|
const TOOL_INPUT_SCHEMA = {
|
|
18
17
|
type: "object",
|
|
@@ -10,10 +10,9 @@ import * as path from "node:path";
|
|
|
10
10
|
import * as ts from "typescript";
|
|
11
11
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
12
12
|
import { detectLanguage, isLanguageSupported, } from "../parser/typescript-parser.js";
|
|
13
|
+
// Original: 'Analyze module-level dependencies across a directory.\nReturns a dependency graph showing which modules import which other modules.\nDetects circular dependencies and provides dependency statistics.'
|
|
13
14
|
// Tool description
|
|
14
|
-
const TOOL_DESCRIPTION =
|
|
15
|
-
Returns a dependency graph showing which modules import which other modules.
|
|
16
|
-
Detects circular dependencies and provides dependency statistics.`;
|
|
15
|
+
const TOOL_DESCRIPTION = "Analyze module-level dependencies and detect circular imports.";
|
|
17
16
|
// Tool input schema
|
|
18
17
|
const TOOL_INPUT_SCHEMA = {
|
|
19
18
|
type: "object",
|
|
@@ -9,11 +9,9 @@ import * as path from "node:path";
|
|
|
9
9
|
import * as ts from "typescript";
|
|
10
10
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
11
11
|
import { detectLanguage, isLanguageSupported, } from "../parser/typescript-parser.js";
|
|
12
|
+
// Original: 'Extract JSDoc/TSDoc documentation from source files.\nReturns documented symbols with their signatures and documentation content.\nCalculates documentation coverage metrics and identifies undocumented exports.\nUseful for generating API documentation and measuring doc coverage.'
|
|
12
13
|
// Tool description
|
|
13
|
-
const TOOL_DESCRIPTION =
|
|
14
|
-
Returns documented symbols with their signatures and documentation content.
|
|
15
|
-
Calculates documentation coverage metrics and identifies undocumented exports.
|
|
16
|
-
Useful for generating API documentation and measuring doc coverage.`;
|
|
14
|
+
const TOOL_DESCRIPTION = "Extract JSDoc/TSDoc documentation from source files with coverage metrics.";
|
|
17
15
|
// Tool input schema
|
|
18
16
|
const TOOL_INPUT_SCHEMA = {
|
|
19
17
|
type: "object",
|
|
@@ -9,10 +9,9 @@ import * as path from "node:path";
|
|
|
9
9
|
import * as ts from "typescript";
|
|
10
10
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
11
11
|
import { detectLanguage, isLanguageSupported, } from "../parser/typescript-parser.js";
|
|
12
|
+
// Original: 'Get all exports from a module.\nReturns structured JSON with default export, named exports, and re-exports.\nUse this to understand what a module exposes to other modules.'
|
|
12
13
|
// Tool description
|
|
13
|
-
const TOOL_DESCRIPTION =
|
|
14
|
-
Returns structured JSON with default export, named exports, and re-exports.
|
|
15
|
-
Use this to understand what a module exposes to other modules.`;
|
|
14
|
+
const TOOL_DESCRIPTION = "Get all exports from a module including default, named, and re-exports.";
|
|
16
15
|
// Tool input schema
|
|
17
16
|
const TOOL_INPUT_SCHEMA = {
|
|
18
17
|
type: "object",
|
|
@@ -14,10 +14,9 @@ import * as fs from "node:fs/promises";
|
|
|
14
14
|
import * as path from "node:path";
|
|
15
15
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
16
16
|
import { parseTypeScript, detectLanguage, isLanguageSupported, } from "../parser/typescript-parser.js";
|
|
17
|
+
// Original: 'Analyze a source file and return its structural overview including imports, exports, classes, functions, and types.\nUse this instead of reading the full file when you need to understand what a file contains.\nReturns structured JSON that\'s much more compact than raw source code.'
|
|
17
18
|
// Tool description (shared between tool and factory)
|
|
18
|
-
const TOOL_DESCRIPTION =
|
|
19
|
-
Use this instead of reading the full file when you need to understand what a file contains.
|
|
20
|
-
Returns structured JSON that's much more compact than raw source code.`;
|
|
19
|
+
const TOOL_DESCRIPTION = "Analyze a source file and return its structural overview (imports, exports, classes, functions, types).";
|
|
21
20
|
// Tool input schema (shared between tool and factory)
|
|
22
21
|
const TOOL_INPUT_SCHEMA = {
|
|
23
22
|
type: "object",
|
|
@@ -20,10 +20,9 @@ const SUPPORTED_EXTENSIONS = new Set([
|
|
|
20
20
|
".cts",
|
|
21
21
|
".cjs",
|
|
22
22
|
]);
|
|
23
|
+
// Original: 'Get detailed import information for a file or module.\nReturns structured JSON with import sources, symbols, and whether imports are external or internal.\nUse this to understand a file\'s dependencies and what it imports from other modules.'
|
|
23
24
|
// Tool description
|
|
24
|
-
const TOOL_DESCRIPTION =
|
|
25
|
-
Returns structured JSON with import sources, symbols, and whether imports are external or internal.
|
|
26
|
-
Use this to understand a file's dependencies and what it imports from other modules.`;
|
|
25
|
+
const TOOL_DESCRIPTION = "Get detailed import information for a file or module with sources and symbols.";
|
|
27
26
|
// Tool input schema
|
|
28
27
|
const TOOL_INPUT_SCHEMA = {
|
|
29
28
|
type: "object",
|
|
@@ -9,10 +9,9 @@ import * as path from "node:path";
|
|
|
9
9
|
import * as ts from "typescript";
|
|
10
10
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
11
11
|
import { detectLanguage, isLanguageSupported, } from "../parser/typescript-parser.js";
|
|
12
|
+
// Original: 'Get detailed signature information for a function, method, class, interface, or type.\nReturns parameters with types, return type, generics, and extracted documentation (JSDoc/TSDoc).\nUseful for understanding API contracts without reading full source code.'
|
|
12
13
|
// Tool description
|
|
13
|
-
const TOOL_DESCRIPTION =
|
|
14
|
-
Returns parameters with types, return type, generics, and extracted documentation (JSDoc/TSDoc).
|
|
15
|
-
Useful for understanding API contracts without reading full source code.`;
|
|
14
|
+
const TOOL_DESCRIPTION = "Get function/class signature with parameters, return type, generics, and docs.";
|
|
16
15
|
// Tool input schema
|
|
17
16
|
const TOOL_INPUT_SCHEMA = {
|
|
18
17
|
type: "object",
|
|
@@ -9,10 +9,9 @@ import * as path from "node:path";
|
|
|
9
9
|
import * as ts from "typescript";
|
|
10
10
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
11
11
|
import { detectLanguage, isLanguageSupported, } from "../parser/typescript-parser.js";
|
|
12
|
+
// Original: 'Analyze the inheritance hierarchy of a class or interface.\nReturns the type\'s ancestors (what it extends/implements) and descendants (what extends/implements it).\nUseful for understanding class hierarchies and interface relationships.'
|
|
12
13
|
// Tool description
|
|
13
|
-
const TOOL_DESCRIPTION =
|
|
14
|
-
Returns the type's ancestors (what it extends/implements) and descendants (what extends/implements it).
|
|
15
|
-
Useful for understanding class hierarchies and interface relationships.`;
|
|
14
|
+
const TOOL_DESCRIPTION = "Analyze inheritance hierarchy of a class or interface showing ancestors and descendants.";
|
|
16
15
|
// Tool input schema
|
|
17
16
|
const TOOL_INPUT_SCHEMA = {
|
|
18
17
|
type: "object",
|
|
@@ -194,11 +194,10 @@ async function executeReadFunction(input) {
|
|
|
194
194
|
return createErrorResult(`Failed to read function: ${error instanceof Error ? error.message : String(error)}`);
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
+
// Original: 'Read a specific function or method by name. Returns the exact source code without guessing line numbers. Use this instead of read_file when you need to see a specific function. For methods, specify the className parameter.'
|
|
197
198
|
export const readFunctionTool = defineTool({
|
|
198
199
|
name: "read_function",
|
|
199
|
-
description: "Read a specific function or method by name. Returns
|
|
200
|
-
"Use this instead of read_file when you need to see a specific function. " +
|
|
201
|
-
"For methods, specify the className parameter.",
|
|
200
|
+
description: "Read a specific function or method by name. Returns exact source code.",
|
|
202
201
|
inputSchema: {
|
|
203
202
|
type: "object",
|
|
204
203
|
properties: {
|
|
@@ -318,10 +317,10 @@ async function executeReadClass(input) {
|
|
|
318
317
|
return createErrorResult(`Failed to read class: ${error instanceof Error ? error.message : String(error)}`);
|
|
319
318
|
}
|
|
320
319
|
}
|
|
320
|
+
// Original: 'Read a specific class by name. Returns the exact source code without guessing line numbers. Use the include parameter to get: full class, signature only, methods only, or properties only.'
|
|
321
321
|
export const readClassTool = defineTool({
|
|
322
322
|
name: "read_class",
|
|
323
|
-
description: "Read a specific class by name. Returns
|
|
324
|
-
"Use the include parameter to get: full class, signature only, methods only, or properties only.",
|
|
323
|
+
description: "Read a specific class by name. Returns exact source code.",
|
|
325
324
|
inputSchema: {
|
|
326
325
|
type: "object",
|
|
327
326
|
properties: {
|
|
@@ -426,10 +425,10 @@ async function executeReadType(input) {
|
|
|
426
425
|
return createErrorResult(`Failed to read type: ${error instanceof Error ? error.message : String(error)}`);
|
|
427
426
|
}
|
|
428
427
|
}
|
|
428
|
+
// Original: 'Read a specific type, interface, or enum by name. Returns the exact source code without guessing line numbers. Works for TypeScript interfaces, type aliases, and enums.'
|
|
429
429
|
export const readTypeTool = defineTool({
|
|
430
430
|
name: "read_type",
|
|
431
|
-
description: "Read a specific type, interface, or enum by name. Returns
|
|
432
|
-
"Works for TypeScript interfaces, type aliases, and enums.",
|
|
431
|
+
description: "Read a specific type, interface, or enum by name. Returns exact source code.",
|
|
433
432
|
inputSchema: {
|
|
434
433
|
type: "object",
|
|
435
434
|
properties: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compilr-dev/agents-coding-ts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "TypeScript/JavaScript analysis tools for AI agents - AST-based code analysis, complexity metrics, and type hierarchy",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|