@compilr-dev/agents-coding 0.2.1 → 1.0.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/LICENSE +21 -0
- package/README.md +77 -726
- package/dist/core.d.ts +7 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +7 -0
- package/dist/core.js.map +1 -0
- package/dist/dispatcher.d.ts +27 -0
- package/dist/dispatcher.d.ts.map +1 -0
- package/dist/dispatcher.js +68 -0
- package/dist/dispatcher.js.map +1 -0
- package/dist/index.d.ts +77 -31
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +157 -67
- package/dist/index.js.map +1 -0
- package/package.json +26 -30
- package/dist/skills/index.d.ts +0 -49
- package/dist/skills/index.js +0 -532
- package/dist/tools/git/branch.d.ts +0 -17
- package/dist/tools/git/branch.js +0 -264
- package/dist/tools/git/commit.d.ts +0 -23
- package/dist/tools/git/commit.js +0 -280
- package/dist/tools/git/diff.d.ts +0 -19
- package/dist/tools/git/diff.js +0 -221
- package/dist/tools/git/index.d.ts +0 -10
- package/dist/tools/git/index.js +0 -11
- package/dist/tools/git/log.d.ts +0 -19
- package/dist/tools/git/log.js +0 -235
- package/dist/tools/git/stash.d.ts +0 -17
- package/dist/tools/git/stash.js +0 -294
- package/dist/tools/git/status.d.ts +0 -19
- package/dist/tools/git/status.js +0 -160
- package/dist/tools/git/types.d.ts +0 -293
- package/dist/tools/git/types.js +0 -4
- package/dist/tools/git/utils.d.ts +0 -58
- package/dist/tools/git/utils.js +0 -197
- package/dist/tools/index.d.ts +0 -5
- package/dist/tools/index.js +0 -5
- package/dist/tools/project/detect.d.ts +0 -19
- package/dist/tools/project/detect.js +0 -341
- package/dist/tools/project/find-root.d.ts +0 -21
- package/dist/tools/project/find-root.js +0 -239
- package/dist/tools/project/index.d.ts +0 -6
- package/dist/tools/project/index.js +0 -5
- package/dist/tools/project/types.d.ts +0 -83
- package/dist/tools/project/types.js +0 -4
- package/dist/tools/runners/build.d.ts +0 -19
- package/dist/tools/runners/build.js +0 -306
- package/dist/tools/runners/format.d.ts +0 -19
- package/dist/tools/runners/format.js +0 -376
- package/dist/tools/runners/index.d.ts +0 -9
- package/dist/tools/runners/index.js +0 -9
- package/dist/tools/runners/lint.d.ts +0 -19
- package/dist/tools/runners/lint.js +0 -356
- package/dist/tools/runners/test.d.ts +0 -19
- package/dist/tools/runners/test.js +0 -386
- package/dist/tools/runners/types.d.ts +0 -97
- package/dist/tools/runners/types.js +0 -4
- package/dist/tools/runners/utils.d.ts +0 -69
- package/dist/tools/runners/utils.js +0 -179
- package/dist/tools/search/definition.d.ts +0 -19
- package/dist/tools/search/definition.js +0 -305
- package/dist/tools/search/index.d.ts +0 -8
- package/dist/tools/search/index.js +0 -8
- package/dist/tools/search/references.d.ts +0 -19
- package/dist/tools/search/references.js +0 -179
- package/dist/tools/search/todos.d.ts +0 -19
- package/dist/tools/search/todos.js +0 -269
- package/dist/tools/search/types.d.ts +0 -132
- package/dist/tools/search/types.js +0 -4
- package/dist/tools/search/utils.d.ts +0 -45
- package/dist/tools/search/utils.js +0 -152
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,iCAAiC,CAAC"}
|
package/dist/core.js
ADDED
package/dist/core.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Language Dispatcher
|
|
3
|
+
*
|
|
4
|
+
* Auto-detects programming language from file extension and routes
|
|
5
|
+
* to the appropriate language-specific parser/tools.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Supported languages
|
|
9
|
+
*/
|
|
10
|
+
export type SupportedLanguage = "typescript" | "javascript" | "python" | "go" | "rust" | "java" | "unknown";
|
|
11
|
+
/**
|
|
12
|
+
* Detect language from file path
|
|
13
|
+
*/
|
|
14
|
+
export declare function detectLanguage(filePath: string): SupportedLanguage;
|
|
15
|
+
/**
|
|
16
|
+
* Check if a language is supported for AST analysis
|
|
17
|
+
*/
|
|
18
|
+
export declare function isLanguageSupported(lang: SupportedLanguage): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Get language display name
|
|
21
|
+
*/
|
|
22
|
+
export declare function getLanguageDisplayName(lang: SupportedLanguage): string;
|
|
23
|
+
/**
|
|
24
|
+
* Get file extensions for a language
|
|
25
|
+
*/
|
|
26
|
+
export declare function getLanguageExtensions(lang: SupportedLanguage): string[];
|
|
27
|
+
//# sourceMappingURL=dispatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../src/dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,YAAY,GACZ,YAAY,GACZ,QAAQ,GACR,IAAI,GACJ,MAAM,GACN,MAAM,GACN,SAAS,CAAC;AAiCd;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAGlE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAEpE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAWtE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,EAAE,CAIvE"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Language Dispatcher
|
|
3
|
+
*
|
|
4
|
+
* Auto-detects programming language from file extension and routes
|
|
5
|
+
* to the appropriate language-specific parser/tools.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* File extension to language mapping
|
|
9
|
+
*/
|
|
10
|
+
const EXTENSION_MAP = {
|
|
11
|
+
// TypeScript
|
|
12
|
+
".ts": "typescript",
|
|
13
|
+
".tsx": "typescript",
|
|
14
|
+
".mts": "typescript",
|
|
15
|
+
".cts": "typescript",
|
|
16
|
+
// JavaScript
|
|
17
|
+
".js": "javascript",
|
|
18
|
+
".jsx": "javascript",
|
|
19
|
+
".mjs": "javascript",
|
|
20
|
+
".cjs": "javascript",
|
|
21
|
+
// Python
|
|
22
|
+
".py": "python",
|
|
23
|
+
".pyi": "python",
|
|
24
|
+
".pyw": "python",
|
|
25
|
+
// Go
|
|
26
|
+
".go": "go",
|
|
27
|
+
// Rust
|
|
28
|
+
".rs": "rust",
|
|
29
|
+
// Java
|
|
30
|
+
".java": "java",
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Detect language from file path
|
|
34
|
+
*/
|
|
35
|
+
export function detectLanguage(filePath) {
|
|
36
|
+
const ext = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
|
|
37
|
+
return EXTENSION_MAP[ext] ?? "unknown";
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Check if a language is supported for AST analysis
|
|
41
|
+
*/
|
|
42
|
+
export function isLanguageSupported(lang) {
|
|
43
|
+
return ["typescript", "javascript", "python", "go"].includes(lang);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get language display name
|
|
47
|
+
*/
|
|
48
|
+
export function getLanguageDisplayName(lang) {
|
|
49
|
+
const names = {
|
|
50
|
+
typescript: "TypeScript",
|
|
51
|
+
javascript: "JavaScript",
|
|
52
|
+
python: "Python",
|
|
53
|
+
go: "Go",
|
|
54
|
+
rust: "Rust",
|
|
55
|
+
java: "Java",
|
|
56
|
+
unknown: "Unknown",
|
|
57
|
+
};
|
|
58
|
+
return names[lang];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get file extensions for a language
|
|
62
|
+
*/
|
|
63
|
+
export function getLanguageExtensions(lang) {
|
|
64
|
+
return Object.entries(EXTENSION_MAP)
|
|
65
|
+
.filter(([, l]) => l === lang)
|
|
66
|
+
.map(([ext]) => ext);
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=dispatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatcher.js","sourceRoot":"","sources":["../src/dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH;;GAEG;AACH,MAAM,aAAa,GAAsC;IACvD,aAAa;IACb,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IAEpB,aAAa;IACb,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IAEpB,SAAS;IACT,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAEhB,KAAK;IACL,KAAK,EAAE,IAAI;IAEX,OAAO;IACP,KAAK,EAAE,MAAM;IAEb,OAAO;IACP,OAAO,EAAE,MAAM;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACpE,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAuB;IACzD,OAAO,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACrE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAuB;IAC5D,MAAM,KAAK,GAAsC;QAC/C,UAAU,EAAE,YAAY;QACxB,UAAU,EAAE,YAAY;QACxB,MAAM,EAAE,QAAQ;QAChB,EAAE,EAAE,IAAI;QACR,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,SAAS;KACnB,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAuB;IAC3D,OAAO,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC;SACjC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC;SAC7B,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,39 +1,85 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @compilr-dev/agents-coding
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Multi-language coding tools for AI agents - umbrella package with auto-detection.
|
|
5
|
+
*
|
|
6
|
+
* This package re-exports tools from:
|
|
7
|
+
* - @compilr-dev/agents-coding-core (git, runners, project detection, search)
|
|
8
|
+
* - @compilr-dev/agents-coding-ts (TypeScript/JavaScript analysis)
|
|
9
|
+
* - @compilr-dev/agents-coding-python (Python analysis)
|
|
10
|
+
* - @compilr-dev/agents-coding-go (Go analysis)
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import {
|
|
15
|
+
* // Core tools (language-agnostic)
|
|
16
|
+
* gitStatusTool,
|
|
17
|
+
* runTestsTool,
|
|
18
|
+
* detectProjectTool,
|
|
19
|
+
* codingSkills,
|
|
20
|
+
*
|
|
21
|
+
* // Language detection
|
|
22
|
+
* detectLanguage,
|
|
23
|
+
*
|
|
24
|
+
* // Language-specific analysis (use directly or via dispatcher)
|
|
25
|
+
* getFileStructureTool, // Auto-detects language
|
|
26
|
+
* } from '@compilr-dev/agents-coding';
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export * from "@compilr-dev/agents-coding-core";
|
|
30
|
+
export * from "./dispatcher.js";
|
|
31
|
+
export * as ts from "@compilr-dev/agents-coding-ts";
|
|
32
|
+
export * as python from "@compilr-dev/agents-coding-python";
|
|
33
|
+
export * as go from "@compilr-dev/agents-coding-go";
|
|
34
|
+
import { type SupportedLanguage } from "./dispatcher.js";
|
|
35
|
+
import * as tsTools from "@compilr-dev/agents-coding-ts";
|
|
36
|
+
import * as pythonTools from "@compilr-dev/agents-coding-python";
|
|
37
|
+
import * as goTools from "@compilr-dev/agents-coding-go";
|
|
38
|
+
import { type ToolExecutionResult } from "@compilr-dev/agents";
|
|
39
|
+
/**
|
|
40
|
+
* Get the appropriate getFileStructure tool for a file
|
|
41
|
+
*/
|
|
42
|
+
export declare function getFileStructure(path: string, options?: {
|
|
43
|
+
includePrivate?: boolean;
|
|
44
|
+
maxDepth?: number;
|
|
45
|
+
}): Promise<ToolExecutionResult>;
|
|
46
|
+
/**
|
|
47
|
+
* Unified getFileStructure tool with auto-detection
|
|
48
|
+
*/
|
|
49
|
+
export declare const getFileStructureTool: import("@compilr-dev/agents").Tool<{
|
|
50
|
+
path: string;
|
|
51
|
+
includePrivate?: boolean;
|
|
52
|
+
maxDepth?: number;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Get complexity metrics for a file
|
|
56
|
+
*/
|
|
57
|
+
export declare function getComplexity(path: string, options?: {
|
|
58
|
+
threshold?: number;
|
|
59
|
+
recursive?: boolean;
|
|
60
|
+
}): Promise<ToolExecutionResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Unified getComplexity tool with auto-detection
|
|
6
63
|
*/
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export type { BaseRunnerInput, BaseRunnerResult, RunTestsInput, RunTestsResult, RunLintInput, RunLintResult, RunBuildInput, RunBuildResult, RunFormatInput, RunFormatResult, } from './tools/runners/index.js';
|
|
13
|
-
export { findDefinitionTool, findReferencesTool, findTodosTool, createFindDefinitionTool, createFindReferencesTool, createFindTodosTool, } from './tools/search/index.js';
|
|
14
|
-
export type { DefinitionType, Definition, FindDefinitionInput, FindDefinitionResult, Reference, FindReferencesInput, FindReferencesResult, TodoType, TodoComment, FindTodosInput, FindTodosResult, } from './tools/search/index.js';
|
|
15
|
-
export { codingSkills, gitWorkflowSkill, testDrivenSkill, codeNavigationSkill, prWorkflowSkill, projectOnboardingSkill, codeOptimizationSkill, defineSkill, type Skill, } from './skills/index.js';
|
|
64
|
+
export declare const getComplexityTool: import("@compilr-dev/agents").Tool<{
|
|
65
|
+
path: string;
|
|
66
|
+
threshold?: number;
|
|
67
|
+
recursive?: boolean;
|
|
68
|
+
}>;
|
|
16
69
|
/**
|
|
17
|
-
* All
|
|
70
|
+
* All unified tools with auto-detection
|
|
18
71
|
*/
|
|
19
|
-
export declare const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
readonly runTests: import("@compilr-dev/agents").Tool<import("./tools/runners/types.js").RunTestsInput>;
|
|
29
|
-
readonly runLint: import("@compilr-dev/agents").Tool<import("./tools/runners/types.js").RunLintInput>;
|
|
30
|
-
readonly runBuild: import("@compilr-dev/agents").Tool<import("./tools/runners/types.js").RunBuildInput>;
|
|
31
|
-
readonly runFormat: import("@compilr-dev/agents").Tool<import("./tools/runners/types.js").RunFormatInput>;
|
|
32
|
-
readonly findDefinition: import("@compilr-dev/agents").Tool<import("./tools/search/types.js").FindDefinitionInput>;
|
|
33
|
-
readonly findReferences: import("@compilr-dev/agents").Tool<import("./tools/search/types.js").FindReferencesInput>;
|
|
34
|
-
readonly findTodos: import("@compilr-dev/agents").Tool<import("./tools/search/types.js").FindTodosInput>;
|
|
35
|
-
};
|
|
72
|
+
export declare const unifiedTools: (import("@compilr-dev/agents").Tool<{
|
|
73
|
+
path: string;
|
|
74
|
+
includePrivate?: boolean;
|
|
75
|
+
maxDepth?: number;
|
|
76
|
+
}> | import("@compilr-dev/agents").Tool<{
|
|
77
|
+
path: string;
|
|
78
|
+
threshold?: number;
|
|
79
|
+
recursive?: boolean;
|
|
80
|
+
}>)[];
|
|
36
81
|
/**
|
|
37
|
-
*
|
|
82
|
+
* Get language-specific tools for a given language
|
|
38
83
|
*/
|
|
39
|
-
export declare
|
|
84
|
+
export declare function getToolsForLanguage(lang: SupportedLanguage): typeof tsTools | typeof pythonTools | typeof goTools | null;
|
|
85
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAKH,cAAc,iCAAiC,CAAC;AAKhD,cAAc,iBAAiB,CAAC;AAKhC,OAAO,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAKpD,OAAO,KAAK,MAAM,MAAM,mCAAmC,CAAC;AAK5D,OAAO,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAMpD,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAC;AACzD,OAAO,KAAK,WAAW,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACxD,OAAO,CAAC,mBAAmB,CAAC,CAgB9B;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB;UACzB,MAAM;qBACK,OAAO;eACb,MAAM;EAyBjB,CAAC;AAEH;;GAEG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GACpD,OAAO,CAAC,mBAAmB,CAAC,CAgB9B;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB;UACtB,MAAM;gBACA,MAAM;gBACN,OAAO;EAyBnB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY;UAzFjB,MAAM;qBACK,OAAO;eACb,MAAM;;UAuDX,MAAM;gBACA,MAAM;gBACN,OAAO;KA8BgD,CAAC;AAEtE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,+DAY1D"}
|
package/dist/index.js
CHANGED
|
@@ -1,75 +1,165 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @compilr-dev/agents-coding
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Multi-language coding tools for AI agents - umbrella package with auto-detection.
|
|
5
|
+
*
|
|
6
|
+
* This package re-exports tools from:
|
|
7
|
+
* - @compilr-dev/agents-coding-core (git, runners, project detection, search)
|
|
8
|
+
* - @compilr-dev/agents-coding-ts (TypeScript/JavaScript analysis)
|
|
9
|
+
* - @compilr-dev/agents-coding-python (Python analysis)
|
|
10
|
+
* - @compilr-dev/agents-coding-go (Go analysis)
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import {
|
|
15
|
+
* // Core tools (language-agnostic)
|
|
16
|
+
* gitStatusTool,
|
|
17
|
+
* runTestsTool,
|
|
18
|
+
* detectProjectTool,
|
|
19
|
+
* codingSkills,
|
|
20
|
+
*
|
|
21
|
+
* // Language detection
|
|
22
|
+
* detectLanguage,
|
|
23
|
+
*
|
|
24
|
+
* // Language-specific analysis (use directly or via dispatcher)
|
|
25
|
+
* getFileStructureTool, // Auto-detects language
|
|
26
|
+
* } from '@compilr-dev/agents-coding';
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
// =============================================================================
|
|
30
|
+
// Core Tools (language-agnostic)
|
|
31
|
+
// =============================================================================
|
|
32
|
+
export * from "@compilr-dev/agents-coding-core";
|
|
33
|
+
// =============================================================================
|
|
34
|
+
// Language Detection & Dispatcher
|
|
35
|
+
// =============================================================================
|
|
36
|
+
export * from "./dispatcher.js";
|
|
37
|
+
// =============================================================================
|
|
38
|
+
// TypeScript/JavaScript Analysis
|
|
39
|
+
// =============================================================================
|
|
40
|
+
export * as ts from "@compilr-dev/agents-coding-ts";
|
|
41
|
+
// =============================================================================
|
|
42
|
+
// Python Analysis
|
|
43
|
+
// =============================================================================
|
|
44
|
+
export * as python from "@compilr-dev/agents-coding-python";
|
|
45
|
+
// =============================================================================
|
|
46
|
+
// Go Analysis
|
|
47
|
+
// =============================================================================
|
|
48
|
+
export * as go from "@compilr-dev/agents-coding-go";
|
|
49
|
+
// =============================================================================
|
|
50
|
+
// Unified Analysis Tools (with auto-detection)
|
|
51
|
+
// =============================================================================
|
|
52
|
+
import { detectLanguage } from "./dispatcher.js";
|
|
53
|
+
import * as tsTools from "@compilr-dev/agents-coding-ts";
|
|
54
|
+
import * as pythonTools from "@compilr-dev/agents-coding-python";
|
|
55
|
+
import * as goTools from "@compilr-dev/agents-coding-go";
|
|
56
|
+
import { defineTool, createErrorResult, } from "@compilr-dev/agents";
|
|
57
|
+
/**
|
|
58
|
+
* Get the appropriate getFileStructure tool for a file
|
|
59
|
+
*/
|
|
60
|
+
export async function getFileStructure(path, options) {
|
|
61
|
+
const lang = detectLanguage(path);
|
|
62
|
+
switch (lang) {
|
|
63
|
+
case "typescript":
|
|
64
|
+
case "javascript":
|
|
65
|
+
return tsTools.getFileStructureTool.execute({ path, ...options });
|
|
66
|
+
case "python":
|
|
67
|
+
return pythonTools.getFileStructureTool.execute({ path, ...options });
|
|
68
|
+
case "go":
|
|
69
|
+
return goTools.getFileStructureTool.execute({ path, ...options });
|
|
70
|
+
default:
|
|
71
|
+
return createErrorResult(`Unsupported language for file: ${path}. Supported: TypeScript, JavaScript, Python, Go`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Unified getFileStructure tool with auto-detection
|
|
76
|
+
*/
|
|
77
|
+
export const getFileStructureTool = defineTool({
|
|
78
|
+
name: "get_file_structure",
|
|
79
|
+
description: "Get structural overview of a source file (classes, functions, imports). " +
|
|
80
|
+
"Auto-detects language from file extension. Supports TypeScript, JavaScript, Python, Go.",
|
|
81
|
+
inputSchema: {
|
|
82
|
+
type: "object",
|
|
83
|
+
properties: {
|
|
84
|
+
path: {
|
|
85
|
+
type: "string",
|
|
86
|
+
description: "Path to source file",
|
|
87
|
+
},
|
|
88
|
+
includePrivate: {
|
|
89
|
+
type: "boolean",
|
|
90
|
+
description: "Include private/unexported members",
|
|
91
|
+
},
|
|
92
|
+
maxDepth: {
|
|
93
|
+
type: "number",
|
|
94
|
+
description: "Maximum nesting depth to analyze",
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
required: ["path"],
|
|
98
|
+
},
|
|
99
|
+
execute: async (input) => getFileStructure(input.path, input),
|
|
100
|
+
});
|
|
101
|
+
/**
|
|
102
|
+
* Get complexity metrics for a file
|
|
103
|
+
*/
|
|
104
|
+
export async function getComplexity(path, options) {
|
|
105
|
+
const lang = detectLanguage(path);
|
|
106
|
+
switch (lang) {
|
|
107
|
+
case "typescript":
|
|
108
|
+
case "javascript":
|
|
109
|
+
return tsTools.getComplexityTool.execute({ path, ...options });
|
|
110
|
+
case "python":
|
|
111
|
+
return pythonTools.getComplexityTool.execute({ path, ...options });
|
|
112
|
+
case "go":
|
|
113
|
+
return goTools.getComplexityTool.execute({ path, ...options });
|
|
114
|
+
default:
|
|
115
|
+
return createErrorResult(`Unsupported language for file: ${path}. Supported: TypeScript, JavaScript, Python, Go`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Unified getComplexity tool with auto-detection
|
|
6
120
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
121
|
+
export const getComplexityTool = defineTool({
|
|
122
|
+
name: "get_complexity",
|
|
123
|
+
description: "Calculate cyclomatic and cognitive complexity for functions in a file. " +
|
|
124
|
+
"Auto-detects language from file extension.",
|
|
125
|
+
inputSchema: {
|
|
126
|
+
type: "object",
|
|
127
|
+
properties: {
|
|
128
|
+
path: {
|
|
129
|
+
type: "string",
|
|
130
|
+
description: "Path to source file or directory",
|
|
131
|
+
},
|
|
132
|
+
threshold: {
|
|
133
|
+
type: "number",
|
|
134
|
+
description: "Complexity threshold for warnings (default: 10)",
|
|
135
|
+
},
|
|
136
|
+
recursive: {
|
|
137
|
+
type: "boolean",
|
|
138
|
+
description: "Analyze directories recursively",
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
required: ["path"],
|
|
142
|
+
},
|
|
143
|
+
execute: async (input) => getComplexity(input.path, input),
|
|
144
|
+
});
|
|
26
145
|
/**
|
|
27
|
-
* All
|
|
146
|
+
* All unified tools with auto-detection
|
|
28
147
|
*/
|
|
29
|
-
export const
|
|
30
|
-
// Phase 1: Read-only git
|
|
31
|
-
gitStatus: gitStatusTool,
|
|
32
|
-
gitDiff: gitDiffTool,
|
|
33
|
-
gitLog: gitLogTool,
|
|
34
|
-
// Phase 2: Core git
|
|
35
|
-
gitCommit: gitCommitTool,
|
|
36
|
-
gitBranch: gitBranchTool,
|
|
37
|
-
gitStash: gitStashTool,
|
|
38
|
-
// Project detection
|
|
39
|
-
detectProject: detectProjectTool,
|
|
40
|
-
findProjectRoot: findProjectRootTool,
|
|
41
|
-
// Phase 3: Smart runners
|
|
42
|
-
runTests: runTestsTool,
|
|
43
|
-
runLint: runLintTool,
|
|
44
|
-
runBuild: runBuildTool,
|
|
45
|
-
runFormat: runFormatTool,
|
|
46
|
-
// Phase 4: Code search
|
|
47
|
-
findDefinition: findDefinitionTool,
|
|
48
|
-
findReferences: findReferencesTool,
|
|
49
|
-
findTodos: findTodosTool,
|
|
50
|
-
};
|
|
148
|
+
export const unifiedTools = [getFileStructureTool, getComplexityTool];
|
|
51
149
|
/**
|
|
52
|
-
*
|
|
150
|
+
* Get language-specific tools for a given language
|
|
53
151
|
*/
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
runLintTool,
|
|
69
|
-
runBuildTool,
|
|
70
|
-
runFormatTool,
|
|
71
|
-
// Phase 4
|
|
72
|
-
findDefinitionTool,
|
|
73
|
-
findReferencesTool,
|
|
74
|
-
findTodosTool,
|
|
75
|
-
];
|
|
152
|
+
export function getToolsForLanguage(lang) {
|
|
153
|
+
switch (lang) {
|
|
154
|
+
case "typescript":
|
|
155
|
+
case "javascript":
|
|
156
|
+
return tsTools;
|
|
157
|
+
case "python":
|
|
158
|
+
return pythonTools;
|
|
159
|
+
case "go":
|
|
160
|
+
return goTools;
|
|
161
|
+
default:
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Multi-language coding tools for AI agents - umbrella package with auto-detection for TypeScript, Python, Go, and more",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -10,25 +10,13 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
12
|
},
|
|
13
|
-
"./
|
|
14
|
-
"types": "./dist/
|
|
15
|
-
"import": "./dist/
|
|
13
|
+
"./core": {
|
|
14
|
+
"types": "./dist/core.d.ts",
|
|
15
|
+
"import": "./dist/core.js"
|
|
16
16
|
},
|
|
17
|
-
"./
|
|
18
|
-
"types": "./dist/
|
|
19
|
-
"import": "./dist/
|
|
20
|
-
},
|
|
21
|
-
"./tools/runners": {
|
|
22
|
-
"types": "./dist/tools/runners/index.d.ts",
|
|
23
|
-
"import": "./dist/tools/runners/index.js"
|
|
24
|
-
},
|
|
25
|
-
"./tools/search": {
|
|
26
|
-
"types": "./dist/tools/search/index.d.ts",
|
|
27
|
-
"import": "./dist/tools/search/index.js"
|
|
28
|
-
},
|
|
29
|
-
"./skills": {
|
|
30
|
-
"types": "./dist/skills/index.d.ts",
|
|
31
|
-
"import": "./dist/skills/index.js"
|
|
17
|
+
"./dispatcher": {
|
|
18
|
+
"types": "./dist/dispatcher.d.ts",
|
|
19
|
+
"import": "./dist/dispatcher.js"
|
|
32
20
|
}
|
|
33
21
|
},
|
|
34
22
|
"files": [
|
|
@@ -43,7 +31,6 @@
|
|
|
43
31
|
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
44
32
|
"test": "vitest run",
|
|
45
33
|
"test:watch": "vitest",
|
|
46
|
-
"test:coverage": "vitest run --coverage",
|
|
47
34
|
"prepublishOnly": "npm run clean && npm run lint && npm run test && npm run build",
|
|
48
35
|
"typecheck": "tsc --noEmit"
|
|
49
36
|
},
|
|
@@ -57,9 +44,14 @@
|
|
|
57
44
|
"llm",
|
|
58
45
|
"coding",
|
|
59
46
|
"git",
|
|
47
|
+
"typescript",
|
|
48
|
+
"python",
|
|
49
|
+
"go",
|
|
50
|
+
"rust",
|
|
51
|
+
"java",
|
|
60
52
|
"tools",
|
|
61
53
|
"cli",
|
|
62
|
-
"
|
|
54
|
+
"multi-language"
|
|
63
55
|
],
|
|
64
56
|
"author": "Carmelo Scozzola",
|
|
65
57
|
"license": "MIT",
|
|
@@ -73,16 +65,20 @@
|
|
|
73
65
|
"peerDependencies": {
|
|
74
66
|
"@compilr-dev/agents": "^0.3.0"
|
|
75
67
|
},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"@compilr-dev/agents-coding-core": "^0.1.0",
|
|
70
|
+
"@compilr-dev/agents-coding-go": "^0.1.0",
|
|
71
|
+
"@compilr-dev/agents-coding-python": "^0.1.0",
|
|
72
|
+
"@compilr-dev/agents-coding-ts": "^0.1.0"
|
|
73
|
+
},
|
|
76
74
|
"devDependencies": {
|
|
77
|
-
"@anthropic-ai/sdk": "^0.30.1",
|
|
78
75
|
"@compilr-dev/agents": "^0.3.0",
|
|
79
|
-
"@eslint/js": "^9.39.
|
|
80
|
-
"@types/node": "^24.10.
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"typescript": "^
|
|
85
|
-
"typescript-eslint": "^8.48.0",
|
|
76
|
+
"@eslint/js": "^9.39.2",
|
|
77
|
+
"@types/node": "^24.10.7",
|
|
78
|
+
"eslint": "^9.39.2",
|
|
79
|
+
"prettier": "^3.7.4",
|
|
80
|
+
"typescript": "^5.9.3",
|
|
81
|
+
"typescript-eslint": "^8.52.0",
|
|
86
82
|
"vitest": "^3.2.4"
|
|
87
83
|
}
|
|
88
84
|
}
|
package/dist/skills/index.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Coding-specific Skills for @compilr-dev/agents-coding
|
|
3
|
-
*
|
|
4
|
-
* These skills are designed to work with the coding tools and provide
|
|
5
|
-
* specialized guidance for common development workflows.
|
|
6
|
-
*/
|
|
7
|
-
import { type Skill } from '@compilr-dev/agents';
|
|
8
|
-
/**
|
|
9
|
-
* Git workflow skill - Safe git operations with proper verification
|
|
10
|
-
*/
|
|
11
|
-
export declare const gitWorkflowSkill: Skill;
|
|
12
|
-
/**
|
|
13
|
-
* Test-driven development skill
|
|
14
|
-
*/
|
|
15
|
-
export declare const testDrivenSkill: Skill;
|
|
16
|
-
/**
|
|
17
|
-
* Code navigation skill
|
|
18
|
-
*/
|
|
19
|
-
export declare const codeNavigationSkill: Skill;
|
|
20
|
-
/**
|
|
21
|
-
* Pull request workflow skill
|
|
22
|
-
*/
|
|
23
|
-
export declare const prWorkflowSkill: Skill;
|
|
24
|
-
/**
|
|
25
|
-
* Project onboarding skill
|
|
26
|
-
*/
|
|
27
|
-
export declare const projectOnboardingSkill: Skill;
|
|
28
|
-
/**
|
|
29
|
-
* Code optimization skill
|
|
30
|
-
*/
|
|
31
|
-
export declare const codeOptimizationSkill: Skill;
|
|
32
|
-
/**
|
|
33
|
-
* Build skill - Implement a backlog item end-to-end
|
|
34
|
-
* Moved from @compilr-dev/agents because it uses run_tests, run_lint
|
|
35
|
-
*/
|
|
36
|
-
export declare const buildSkill: Skill;
|
|
37
|
-
/**
|
|
38
|
-
* Scaffold skill - Create project foundation based on tech stack
|
|
39
|
-
* Moved from @compilr-dev/agents because it uses detect_project
|
|
40
|
-
*/
|
|
41
|
-
export declare const scaffoldSkill: Skill;
|
|
42
|
-
/**
|
|
43
|
-
* All coding skills
|
|
44
|
-
*/
|
|
45
|
-
export declare const codingSkills: Skill[];
|
|
46
|
-
/**
|
|
47
|
-
* Export individual skills for selective use
|
|
48
|
-
*/
|
|
49
|
-
export { defineSkill, type Skill } from '@compilr-dev/agents';
|