@compilr-dev/agents-coding-ts 0.1.4 → 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/LICENSE CHANGED
@@ -1,13 +1,100 @@
1
- MIT License
1
+ Functional Source License, Version 1.1, MIT Future License
2
2
 
3
- Copyright (c) 2026 scozzola
3
+ Abbreviation: FSL-1.1-MIT
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
5
+ Notice
6
+
7
+ Copyright 2026 Carmelo Scozzola
8
+
9
+ Terms and Conditions
10
+
11
+ Licensor ("We")
12
+
13
+ The party offering the Software under these Terms and Conditions.
14
+
15
+ The Software
16
+
17
+ The "Software" is each version of the software that we make available under
18
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
19
+ Conditions with the Software.
20
+
21
+ License Grant
22
+
23
+ Subject to your compliance with this License Grant and the Patents,
24
+ Redistribution and Trademark clauses below, we hereby grant you the right to
25
+ use, copy, modify, create derivative works, publicly perform, publicly display
26
+ and redistribute the Software for any Permitted Purpose identified below.
27
+
28
+ Permitted Purpose
29
+
30
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
31
+ means making the Software available to others in a commercial product or
32
+ service that:
33
+
34
+ 1. substitutes for the Software;
35
+
36
+ 2. substitutes for any other product or service we offer using the Software
37
+ that exists as of the date we make the Software available; or
38
+
39
+ 3. offers the same or substantially similar functionality as the Software.
40
+
41
+ Permitted Purposes specifically include using the Software:
42
+
43
+ 1. for your internal use and access;
44
+
45
+ 2. for non-commercial education;
46
+
47
+ 3. for non-commercial research; and
48
+
49
+ 4. in connection with professional services that you provide to a licensee
50
+ using the Software in accordance with these Terms and Conditions.
51
+
52
+ Patents
53
+
54
+ To the extent your use for a Permitted Purpose would necessarily infringe our
55
+ patents, the license grant above includes a license under our patents. If you
56
+ make a claim against any party that the Software infringes or contributes to
57
+ the infringement of any patent, then your patent license to the Software ends
58
+ immediately.
59
+
60
+ Redistribution
61
+
62
+ The Terms and Conditions apply to all copies, modifications and derivatives of
63
+ the Software.
64
+
65
+ If you redistribute any copies, modifications or derivatives of the Software,
66
+ you must include a copy of or a link to these Terms and Conditions and not
67
+ remove any copyright notices provided in or with the Software.
68
+
69
+ Disclaimer
70
+
71
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
72
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
73
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
74
+
75
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
76
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
77
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
78
+
79
+ Trademarks
80
+
81
+ Except for displaying the License Details and identifying us as the origin of
82
+ the Software, you have no right under these Terms and Conditions to use our
83
+ trademarks, trade names, service marks or product names.
84
+
85
+ Grant of Future License
86
+
87
+ We hereby irrevocably grant you an additional license to use the Software under
88
+ the MIT license that is effective on the second anniversary of the date we make
89
+ the Software available. On or after that date, you may use the Software under
90
+ the MIT license, in which case the following will apply:
91
+
92
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
93
+ this software and associated documentation files (the "Software"), to deal in
94
+ the Software without restriction, including without limitation the rights to
95
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
96
+ of the Software, and to permit persons to whom the Software is furnished to do
97
+ so, subject to the following conditions:
11
98
 
12
99
  The above copyright notice and this permission notice shall be included in all
13
100
  copies or substantial portions of the Software.
package/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  TypeScript/JavaScript analysis tools for AI agents - AST-based code analysis using the TypeScript Compiler API.
4
4
 
5
+ > [!WARNING]
6
+ > This package is in beta. APIs may change between minor versions.
7
+
5
8
  ## Installation
6
9
 
7
10
  ```bash
@@ -46,4 +49,4 @@ agent.registerSkills(tsSkills);
46
49
 
47
50
  ## License
48
51
 
49
- MIT
52
+ [FSL-1.1-MIT](https://fsl.software/) - See [LICENSE](LICENSE) for details. Converts to MIT after 2 years per version.
@@ -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 = `Find potentially unused exports, functions, and variables.
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 = `Detect duplicate code blocks across the codebase.
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 = `Find classes that implement an interface or extend an abstract class.
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 = `Find code patterns, anti-patterns, and code smells.
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 = `Find all usages of a symbol across the codebase.
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 = `Find the definition location of a symbol by name across the codebase.
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 = `Analyze function call relationships in source code.
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 = `Calculate code complexity metrics for files or directories.
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 = `Analyze module-level dependencies across a directory.
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 = `Extract JSDoc/TSDoc documentation from source files.
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 = `Get all exports from a module.
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 = `Analyze a source file and return its structural overview including imports, exports, classes, functions, and types.
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 = `Get detailed import information for a file or module.
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 = `Get detailed signature information for a function, method, class, interface, or type.
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 = `Analyze the inheritance hierarchy of a class or interface.
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 the exact source code without guessing line numbers. " +
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 the exact source code without guessing line numbers. " +
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 the exact source code without guessing line numbers. " +
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.4",
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",
@@ -56,13 +56,13 @@
56
56
  "tools"
57
57
  ],
58
58
  "author": "Carmelo Scozzola",
59
- "license": "MIT",
59
+ "license": "FSL-1.1-MIT",
60
60
  "bugs": {
61
61
  "url": "https://github.com/compilr-dev/agents-coding/issues"
62
62
  },
63
63
  "homepage": "https://github.com/compilr-dev/agents-coding#readme",
64
64
  "engines": {
65
- "node": ">=18.0.0"
65
+ "node": ">=20.0.0"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "@compilr-dev/agents": "^0.3.1"
@@ -71,14 +71,14 @@
71
71
  "typescript": "^5.3.0"
72
72
  },
73
73
  "devDependencies": {
74
- "@anthropic-ai/sdk": "^0.30.1",
75
- "@compilr-dev/agents": "^0.3.1",
74
+ "@anthropic-ai/sdk": "^0.74.0",
75
+ "@compilr-dev/agents": "^0.3.11",
76
76
  "@eslint/js": "^9.39.1",
77
- "@types/node": "^24.10.1",
78
- "@vitest/coverage-v8": "^3.2.4",
77
+ "@types/node": "^25.2.3",
78
+ "@vitest/coverage-v8": "^4.0.18",
79
79
  "eslint": "^9.39.1",
80
80
  "prettier": "^3.7.1",
81
81
  "typescript-eslint": "^8.48.0",
82
- "vitest": "^3.2.4"
82
+ "vitest": "^4.0.18"
83
83
  }
84
84
  }