@agentforge/cli 0.12.1 → 0.12.3
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/index.cjs +5 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/api/eslint.config.js +18 -0
- package/templates/api/package.json +4 -2
- package/templates/api/src/routes/agent.ts +3 -2
- package/templates/api/src/server.ts +1 -1
- package/templates/api/tsup.config.ts +15 -0
- package/templates/cli/eslint.config.js +18 -0
- package/templates/cli/package.json +4 -2
- package/templates/cli/src/commands/analyze.ts +2 -1
- package/templates/cli/src/commands/chat.ts +2 -1
- package/templates/cli/tsup.config.ts +15 -0
- package/templates/full/eslint.config.js +18 -0
- package/templates/full/package.json +4 -2
- package/templates/full/src/index.ts +4 -2
- package/templates/full/src/tools/example.ts +4 -4
- package/templates/full/tests/example.test.ts +1 -1
- package/templates/full/tsup.config.ts +15 -0
- package/templates/minimal/eslint.config.js +18 -0
- package/templates/minimal/package.json +4 -2
- package/templates/minimal/src/index.ts +2 -1
- package/templates/minimal/tsup.config.ts +15 -0
- package/templates/tool-multi/index.ts +5 -5
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
3
|
+
|
|
4
|
+
export default tseslint.config(
|
|
5
|
+
js.configs.recommended,
|
|
6
|
+
...tseslint.configs.recommended,
|
|
7
|
+
{
|
|
8
|
+
ignores: ['dist/**', 'node_modules/**', '*.config.ts', '*.config.js'],
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
rules: {
|
|
12
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
13
|
+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
14
|
+
'no-console': 'off',
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"format": "prettier --write ."
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@agentforge/core": "^0.12.
|
|
21
|
-
"@agentforge/patterns": "^0.12.
|
|
20
|
+
"@agentforge/core": "^0.12.3",
|
|
21
|
+
"@agentforge/patterns": "^0.12.3",
|
|
22
22
|
"@langchain/core": "^1.1.17",
|
|
23
23
|
"@langchain/langgraph": "^1.1.2",
|
|
24
24
|
"@langchain/openai": "^1.2.3",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"cors": "^2.8.5"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
+
"@eslint/js": "^9.17.0",
|
|
32
33
|
"@types/node": "^22.10.2",
|
|
33
34
|
"@types/express": "^5.0.0",
|
|
34
35
|
"@types/cors": "^2.8.17",
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
"tsup": "^8.3.5",
|
|
38
39
|
"tsx": "^4.21.0",
|
|
39
40
|
"typescript": "^5.7.2",
|
|
41
|
+
"typescript-eslint": "^8.19.1",
|
|
40
42
|
"vitest": "^2.1.8"
|
|
41
43
|
}
|
|
42
44
|
}
|
|
@@ -4,7 +4,7 @@ import { createReActAgent } from '@agentforge/patterns';
|
|
|
4
4
|
import { createLogger } from '@agentforge/core';
|
|
5
5
|
|
|
6
6
|
const router = Router();
|
|
7
|
-
const logger = createLogger(
|
|
7
|
+
const logger = createLogger('agent-router');
|
|
8
8
|
|
|
9
9
|
// Initialize the agent
|
|
10
10
|
const model = new ChatOpenAI({
|
|
@@ -33,7 +33,8 @@ router.post('/chat', async (req, res) => {
|
|
|
33
33
|
messages: [{ role: 'user', content: message }],
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const lastMessage = result.messages[result.messages.length - 1];
|
|
37
|
+
const response = lastMessage?.content || 'No response';
|
|
37
38
|
|
|
38
39
|
res.json({
|
|
39
40
|
success: true,
|
|
@@ -33,7 +33,7 @@ function validateEnvironment(): void {
|
|
|
33
33
|
// Validate environment before starting
|
|
34
34
|
validateEnvironment();
|
|
35
35
|
|
|
36
|
-
const logger = createLogger({
|
|
36
|
+
const logger = createLogger('{{PROJECT_NAME}}');
|
|
37
37
|
const app = express();
|
|
38
38
|
const port = process.env.PORT || 3000;
|
|
39
39
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ['src/server.ts'],
|
|
5
|
+
format: ['esm'],
|
|
6
|
+
dts: true,
|
|
7
|
+
splitting: false,
|
|
8
|
+
sourcemap: true,
|
|
9
|
+
clean: true,
|
|
10
|
+
treeshake: true,
|
|
11
|
+
minify: false,
|
|
12
|
+
target: 'node18',
|
|
13
|
+
outDir: 'dist',
|
|
14
|
+
});
|
|
15
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
3
|
+
|
|
4
|
+
export default tseslint.config(
|
|
5
|
+
js.configs.recommended,
|
|
6
|
+
...tseslint.configs.recommended,
|
|
7
|
+
{
|
|
8
|
+
ignores: ['dist/**', 'node_modules/**', '*.config.ts', '*.config.js'],
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
rules: {
|
|
12
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
13
|
+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
14
|
+
'no-console': 'off',
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"format": "prettier --write ."
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@agentforge/core": "^0.12.
|
|
24
|
-
"@agentforge/patterns": "^0.12.
|
|
23
|
+
"@agentforge/core": "^0.12.3",
|
|
24
|
+
"@agentforge/patterns": "^0.12.3",
|
|
25
25
|
"@langchain/core": "^1.1.17",
|
|
26
26
|
"@langchain/langgraph": "^1.1.2",
|
|
27
27
|
"@langchain/openai": "^1.2.3",
|
|
@@ -34,12 +34,14 @@
|
|
|
34
34
|
"inquirer": "^12.3.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
+
"@eslint/js": "^9.17.0",
|
|
37
38
|
"@types/node": "^22.10.2",
|
|
38
39
|
"eslint": "^9.17.0",
|
|
39
40
|
"prettier": "^3.4.2",
|
|
40
41
|
"tsup": "^8.3.5",
|
|
41
42
|
"tsx": "^4.21.0",
|
|
42
43
|
"typescript": "^5.7.2",
|
|
44
|
+
"typescript-eslint": "^8.19.1",
|
|
43
45
|
"vitest": "^2.1.8"
|
|
44
46
|
}
|
|
45
47
|
}
|
|
@@ -40,7 +40,8 @@ export async function analyzeCommand(file: string, options: AnalyzeOptions) {
|
|
|
40
40
|
],
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
const
|
|
43
|
+
const lastMessage = result.messages[result.messages.length - 1];
|
|
44
|
+
const analysis = lastMessage?.content || 'No analysis available';
|
|
44
45
|
|
|
45
46
|
spinner.succeed('Analysis complete');
|
|
46
47
|
|
|
@@ -49,7 +49,8 @@ export async function chatCommand(options: ChatOptions) {
|
|
|
49
49
|
messages.push({ role: 'user', content: message });
|
|
50
50
|
|
|
51
51
|
const result = await agent.invoke({ messages });
|
|
52
|
-
const
|
|
52
|
+
const lastMessage = result.messages[result.messages.length - 1];
|
|
53
|
+
const response = lastMessage?.content || 'No response';
|
|
53
54
|
|
|
54
55
|
messages.push({ role: 'assistant', content: response });
|
|
55
56
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ['src/cli.ts'],
|
|
5
|
+
format: ['esm'],
|
|
6
|
+
dts: true,
|
|
7
|
+
splitting: false,
|
|
8
|
+
sourcemap: true,
|
|
9
|
+
clean: true,
|
|
10
|
+
treeshake: true,
|
|
11
|
+
minify: false,
|
|
12
|
+
target: 'node18',
|
|
13
|
+
outDir: 'dist',
|
|
14
|
+
});
|
|
15
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
3
|
+
|
|
4
|
+
export default tseslint.config(
|
|
5
|
+
js.configs.recommended,
|
|
6
|
+
...tseslint.configs.recommended,
|
|
7
|
+
{
|
|
8
|
+
ignores: ['dist/**', 'node_modules/**', '*.config.ts', '*.config.js'],
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
rules: {
|
|
12
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
13
|
+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
14
|
+
'no-console': 'off',
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"clean": "rm -rf dist"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@agentforge/core": "^0.12.
|
|
23
|
-
"@agentforge/patterns": "^0.12.
|
|
22
|
+
"@agentforge/core": "^0.12.3",
|
|
23
|
+
"@agentforge/patterns": "^0.12.3",
|
|
24
24
|
"@langchain/core": "^1.1.17",
|
|
25
25
|
"@langchain/langgraph": "^1.1.2",
|
|
26
26
|
"@langchain/openai": "^1.2.3",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"dotenv": "^16.4.7"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
+
"@eslint/js": "^9.17.0",
|
|
32
33
|
"@types/node": "^22.10.2",
|
|
33
34
|
"@vitest/ui": "^2.1.8",
|
|
34
35
|
"eslint": "^9.17.0",
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
"tsup": "^8.3.5",
|
|
37
38
|
"tsx": "^4.21.0",
|
|
38
39
|
"typescript": "^5.7.2",
|
|
40
|
+
"typescript-eslint": "^8.19.1",
|
|
39
41
|
"vitest": "^2.1.8"
|
|
40
42
|
}
|
|
41
43
|
}
|
|
@@ -4,7 +4,7 @@ import { createReActAgent } from '@agentforge/patterns';
|
|
|
4
4
|
import { createLogger } from '@agentforge/core';
|
|
5
5
|
import { exampleTool } from './tools/example.js';
|
|
6
6
|
|
|
7
|
-
const logger = createLogger({
|
|
7
|
+
const logger = createLogger('{{PROJECT_NAME}}');
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Validate required environment variables
|
|
@@ -67,7 +67,9 @@ async function main() {
|
|
|
67
67
|
|
|
68
68
|
logger.info('✅ Agent completed');
|
|
69
69
|
console.log('\nFinal response:');
|
|
70
|
-
|
|
70
|
+
const messages = result.messages as Array<{ content: string }>;
|
|
71
|
+
const lastMessage = messages[messages.length - 1];
|
|
72
|
+
console.log(lastMessage?.content || 'No response');
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
// Run the main function
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { toolBuilder, ToolCategory } from '@agentforge/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Example tool that demonstrates the tool creation API
|
|
6
6
|
*/
|
|
7
|
-
export const exampleTool =
|
|
8
|
-
.name('
|
|
7
|
+
export const exampleTool = toolBuilder()
|
|
8
|
+
.name('example-tool')
|
|
9
9
|
.description('An example tool that greets a user by name')
|
|
10
|
-
.category(
|
|
10
|
+
.category(ToolCategory.UTILITY)
|
|
11
11
|
.schema(
|
|
12
12
|
z.object({
|
|
13
13
|
name: z.string().describe('The name of the person to greet'),
|
|
@@ -9,7 +9,7 @@ describe('Example Tool', () => {
|
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
it('should have correct metadata', () => {
|
|
12
|
-
expect(exampleTool.name).toBe('
|
|
12
|
+
expect(exampleTool.name).toBe('example-tool');
|
|
13
13
|
expect(exampleTool.description).toBeDefined();
|
|
14
14
|
expect(exampleTool.category).toBe('utility');
|
|
15
15
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ['src/index.ts'],
|
|
5
|
+
format: ['esm'],
|
|
6
|
+
dts: true,
|
|
7
|
+
splitting: false,
|
|
8
|
+
sourcemap: true,
|
|
9
|
+
clean: true,
|
|
10
|
+
treeshake: true,
|
|
11
|
+
minify: false,
|
|
12
|
+
target: 'node18',
|
|
13
|
+
outDir: 'dist',
|
|
14
|
+
});
|
|
15
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
3
|
+
|
|
4
|
+
export default tseslint.config(
|
|
5
|
+
js.configs.recommended,
|
|
6
|
+
...tseslint.configs.recommended,
|
|
7
|
+
{
|
|
8
|
+
ignores: ['dist/**', 'node_modules/**', '*.config.ts', '*.config.js'],
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
rules: {
|
|
12
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
13
|
+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
14
|
+
'no-console': 'off',
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"format": "prettier --write ."
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@agentforge/core": "^0.12.
|
|
20
|
-
"@agentforge/patterns": "^0.12.
|
|
19
|
+
"@agentforge/core": "^0.12.3",
|
|
20
|
+
"@agentforge/patterns": "^0.12.3",
|
|
21
21
|
"@langchain/core": "^1.1.17",
|
|
22
22
|
"@langchain/langgraph": "^1.1.2",
|
|
23
23
|
"@langchain/openai": "^1.2.3",
|
|
@@ -26,12 +26,14 @@
|
|
|
26
26
|
"zod": "^3.24.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
+
"@eslint/js": "^9.17.0",
|
|
29
30
|
"@types/node": "^22.10.2",
|
|
30
31
|
"eslint": "^9.17.0",
|
|
31
32
|
"prettier": "^3.4.2",
|
|
32
33
|
"tsup": "^8.3.5",
|
|
33
34
|
"tsx": "^4.21.0",
|
|
34
35
|
"typescript": "^5.7.2",
|
|
36
|
+
"typescript-eslint": "^8.19.1",
|
|
35
37
|
"vitest": "^2.1.8"
|
|
36
38
|
}
|
|
37
39
|
}
|
|
@@ -55,7 +55,8 @@ async function main() {
|
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
console.log('\n✅ Agent response:');
|
|
58
|
-
|
|
58
|
+
const lastMessage = result.messages[result.messages.length - 1];
|
|
59
|
+
console.log(lastMessage?.content || 'No response');
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
// Run the main function
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ['src/index.ts'],
|
|
5
|
+
format: ['esm'],
|
|
6
|
+
dts: true,
|
|
7
|
+
splitting: false,
|
|
8
|
+
sourcemap: true,
|
|
9
|
+
clean: true,
|
|
10
|
+
treeshake: true,
|
|
11
|
+
minify: false,
|
|
12
|
+
target: 'node18',
|
|
13
|
+
outDir: 'dist',
|
|
14
|
+
});
|
|
15
|
+
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { toolBuilder, ToolCategory } from '@agentforge/core';
|
|
3
3
|
import { {{TOOL_NAME_PASCAL}}Schema } from './schemas.js';
|
|
4
4
|
import type { {{TOOL_NAME_PASCAL}}Input, {{TOOL_NAME_PASCAL}}Output } from './types.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* {{TOOL_DESCRIPTION}}
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
9
|
* Category: {{TOOL_CATEGORY}}
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
13
13
|
* const result = await {{TOOL_NAME_CAMEL}}Tool.invoke({
|
|
@@ -16,10 +16,10 @@ import type { {{TOOL_NAME_PASCAL}}Input, {{TOOL_NAME_PASCAL}}Output } from './ty
|
|
|
16
16
|
* console.log(result);
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export const {{TOOL_NAME_CAMEL}}Tool =
|
|
19
|
+
export const {{TOOL_NAME_CAMEL}}Tool = toolBuilder()
|
|
20
20
|
.name('{{TOOL_NAME}}')
|
|
21
21
|
.description('{{TOOL_DESCRIPTION}}')
|
|
22
|
-
.category(
|
|
22
|
+
.category(ToolCategory.{{TOOL_CATEGORY_ENUM}})
|
|
23
23
|
.schema({{TOOL_NAME_PASCAL}}Schema)
|
|
24
24
|
.implement(async (input: {{TOOL_NAME_PASCAL}}Input): Promise<{{TOOL_NAME_PASCAL}}Output> => {
|
|
25
25
|
try {
|