@agentforge/cli 0.3.9 → 0.4.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.
- package/dist/index.cjs +136 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +135 -68
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/api/package.json +2 -2
- package/templates/cli/package.json +2 -2
- package/templates/full/package.json +2 -2
- package/templates/minimal/package.json +2 -2
- package/templates/tool-multi/README.md +169 -0
- package/templates/tool-multi/__tests__/index.test.ts +50 -0
- package/templates/tool-multi/index.ts +47 -0
- package/templates/tool-multi/providers/example.ts +34 -0
- package/templates/tool-multi/schemas.ts +20 -0
- package/templates/tool-multi/types.ts +50 -0
- package/templates/tool-multi/utils.ts +55 -0
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var commander = require('commander');
|
|
4
|
-
var
|
|
4
|
+
var chalk7 = require('chalk');
|
|
5
5
|
var path = require('path');
|
|
6
6
|
var ora = require('ora');
|
|
7
7
|
var inquirer = require('inquirer');
|
|
@@ -13,7 +13,7 @@ var execa = require('execa');
|
|
|
13
13
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
14
14
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var chalk7__default = /*#__PURE__*/_interopDefault(chalk7);
|
|
17
17
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
18
18
|
var ora__default = /*#__PURE__*/_interopDefault(ora);
|
|
19
19
|
var inquirer__default = /*#__PURE__*/_interopDefault(inquirer);
|
|
@@ -23,20 +23,20 @@ var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
|
23
23
|
var Logger = class {
|
|
24
24
|
spinner = null;
|
|
25
25
|
info(message) {
|
|
26
|
-
console.log(
|
|
26
|
+
console.log(chalk7__default.default.blue("\u2139"), message);
|
|
27
27
|
}
|
|
28
28
|
success(message) {
|
|
29
|
-
console.log(
|
|
29
|
+
console.log(chalk7__default.default.green("\u2714"), message);
|
|
30
30
|
}
|
|
31
31
|
warn(message) {
|
|
32
|
-
console.log(
|
|
32
|
+
console.log(chalk7__default.default.yellow("\u26A0"), message);
|
|
33
33
|
}
|
|
34
34
|
error(message) {
|
|
35
|
-
console.log(
|
|
35
|
+
console.log(chalk7__default.default.red("\u2716"), message);
|
|
36
36
|
}
|
|
37
37
|
debug(message) {
|
|
38
38
|
if (process.env.DEBUG) {
|
|
39
|
-
console.log(
|
|
39
|
+
console.log(chalk7__default.default.gray("\u{1F41B}"), message);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
startSpinner(message) {
|
|
@@ -69,19 +69,19 @@ var Logger = class {
|
|
|
69
69
|
console.log();
|
|
70
70
|
}
|
|
71
71
|
divider() {
|
|
72
|
-
console.log(
|
|
72
|
+
console.log(chalk7__default.default.gray("\u2500".repeat(50)));
|
|
73
73
|
}
|
|
74
74
|
header(message) {
|
|
75
75
|
this.newLine();
|
|
76
|
-
console.log(
|
|
76
|
+
console.log(chalk7__default.default.bold.cyan(message));
|
|
77
77
|
this.divider();
|
|
78
78
|
}
|
|
79
79
|
code(code) {
|
|
80
|
-
console.log(
|
|
80
|
+
console.log(chalk7__default.default.gray(" " + code));
|
|
81
81
|
}
|
|
82
82
|
list(items) {
|
|
83
83
|
items.forEach((item) => {
|
|
84
|
-
console.log(
|
|
84
|
+
console.log(chalk7__default.default.gray(" \u2022"), item);
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
};
|
|
@@ -188,12 +188,13 @@ async function promptAgentSetup(defaults = {}) {
|
|
|
188
188
|
]);
|
|
189
189
|
}
|
|
190
190
|
async function promptToolSetup(defaults = {}) {
|
|
191
|
-
|
|
191
|
+
const answers = await inquirer__default.default.prompt([
|
|
192
192
|
{
|
|
193
193
|
type: "input",
|
|
194
194
|
name: "name",
|
|
195
195
|
message: "Tool name:",
|
|
196
196
|
default: defaults.name,
|
|
197
|
+
when: () => !defaults.name,
|
|
197
198
|
validate: (input) => {
|
|
198
199
|
if (!input) return "Tool name is required";
|
|
199
200
|
if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(input)) {
|
|
@@ -212,25 +213,52 @@ async function promptToolSetup(defaults = {}) {
|
|
|
212
213
|
{ name: "File - File operations", value: "file" },
|
|
213
214
|
{ name: "Utility - General utilities", value: "utility" }
|
|
214
215
|
],
|
|
215
|
-
default: defaults.category || "utility"
|
|
216
|
+
default: defaults.category || "utility",
|
|
217
|
+
when: () => !defaults.category
|
|
216
218
|
},
|
|
217
219
|
{
|
|
218
220
|
type: "input",
|
|
219
221
|
name: "description",
|
|
220
222
|
message: "Tool description:",
|
|
221
223
|
default: defaults.description,
|
|
224
|
+
when: () => !defaults.description,
|
|
222
225
|
validate: (input) => {
|
|
223
226
|
if (!input) return "Tool description is required";
|
|
224
227
|
return true;
|
|
225
228
|
}
|
|
226
229
|
},
|
|
230
|
+
{
|
|
231
|
+
type: "list",
|
|
232
|
+
name: "structure",
|
|
233
|
+
message: "Tool structure:",
|
|
234
|
+
choices: [
|
|
235
|
+
{
|
|
236
|
+
name: "Single file - Simple tools (<150 lines, single responsibility)",
|
|
237
|
+
value: "single"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: "Multi-file - Complex tools (multiple providers, >150 lines)",
|
|
241
|
+
value: "multi"
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
default: defaults.structure || "single",
|
|
245
|
+
when: () => !defaults.structure
|
|
246
|
+
},
|
|
227
247
|
{
|
|
228
248
|
type: "confirm",
|
|
229
249
|
name: "generateTests",
|
|
230
250
|
message: "Generate tests?",
|
|
231
|
-
default: defaults.generateTests !== false
|
|
251
|
+
default: defaults.generateTests !== false,
|
|
252
|
+
when: () => defaults.generateTests === void 0
|
|
232
253
|
}
|
|
233
254
|
]);
|
|
255
|
+
return {
|
|
256
|
+
name: defaults.name || answers.name,
|
|
257
|
+
category: defaults.category || answers.category,
|
|
258
|
+
description: defaults.description || answers.description,
|
|
259
|
+
structure: defaults.structure || answers.structure,
|
|
260
|
+
generateTests: defaults.generateTests !== void 0 ? defaults.generateTests : answers.generateTests
|
|
261
|
+
};
|
|
234
262
|
}
|
|
235
263
|
var __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
236
264
|
var __dirname$1 = path__default.default.dirname(__filename$1);
|
|
@@ -422,9 +450,9 @@ async function createCommand(projectName, options) {
|
|
|
422
450
|
initGit: options.git
|
|
423
451
|
});
|
|
424
452
|
logger.newLine();
|
|
425
|
-
logger.info(`Creating project: ${
|
|
426
|
-
logger.info(`Template: ${
|
|
427
|
-
logger.info(`Package manager: ${
|
|
453
|
+
logger.info(`Creating project: ${chalk7__default.default.cyan(answers.projectName)}`);
|
|
454
|
+
logger.info(`Template: ${chalk7__default.default.cyan(answers.template)}`);
|
|
455
|
+
logger.info(`Package manager: ${chalk7__default.default.cyan(answers.packageManager)}`);
|
|
428
456
|
logger.newLine();
|
|
429
457
|
logger.startSpinner("Creating project directory...");
|
|
430
458
|
await ensureDir(targetPath);
|
|
@@ -472,7 +500,7 @@ async function createCommand(projectName, options) {
|
|
|
472
500
|
}
|
|
473
501
|
}
|
|
474
502
|
logger.newLine();
|
|
475
|
-
logger.success(
|
|
503
|
+
logger.success(chalk7__default.default.bold.green("\u2728 Project created successfully!"));
|
|
476
504
|
logger.newLine();
|
|
477
505
|
logger.header("\u{1F4DD} Next Steps");
|
|
478
506
|
logger.list([
|
|
@@ -609,8 +637,8 @@ async function agentCreateCommand(name, options) {
|
|
|
609
637
|
generateTests: options.test
|
|
610
638
|
});
|
|
611
639
|
logger.newLine();
|
|
612
|
-
logger.info(`Creating agent: ${
|
|
613
|
-
logger.info(`Pattern: ${
|
|
640
|
+
logger.info(`Creating agent: ${chalk7__default.default.cyan(answers.name)}`);
|
|
641
|
+
logger.info(`Pattern: ${chalk7__default.default.cyan(answers.pattern)}`);
|
|
614
642
|
logger.newLine();
|
|
615
643
|
const cwd = process.cwd();
|
|
616
644
|
const agentDir = path__default.default.join(cwd, "src", "agents");
|
|
@@ -630,12 +658,12 @@ async function agentCreateCommand(name, options) {
|
|
|
630
658
|
logger.succeedSpinner("Test file created");
|
|
631
659
|
}
|
|
632
660
|
logger.newLine();
|
|
633
|
-
logger.success(
|
|
661
|
+
logger.success(chalk7__default.default.bold.green("\u2728 Agent created successfully!"));
|
|
634
662
|
logger.newLine();
|
|
635
663
|
logger.header("\u{1F4DD} Next Steps");
|
|
636
664
|
logger.list([
|
|
637
|
-
`Edit ${
|
|
638
|
-
answers.generateTests ? `Run ${
|
|
665
|
+
`Edit ${chalk7__default.default.cyan(`src/agents/${answers.name}.ts`)} to customize your agent`,
|
|
666
|
+
answers.generateTests ? `Run ${chalk7__default.default.cyan(`pnpm test tests/agents/${answers.name}.test.ts`)} to test your agent` : ""
|
|
639
667
|
].filter(Boolean));
|
|
640
668
|
} catch (error) {
|
|
641
669
|
logger.error(`Failed to create agent: ${error.message}`);
|
|
@@ -755,10 +783,10 @@ async function agentListCommand(options) {
|
|
|
755
783
|
const agentFiles = await findFiles("*.ts", agentDir);
|
|
756
784
|
if (agentFiles.length === 0) {
|
|
757
785
|
logger.warn("No agents found");
|
|
758
|
-
logger.info(`Create an agent with: ${
|
|
786
|
+
logger.info(`Create an agent with: ${chalk7__default.default.cyan("agentforge agent:create <name>")}`);
|
|
759
787
|
return;
|
|
760
788
|
}
|
|
761
|
-
logger.info(`Found ${
|
|
789
|
+
logger.info(`Found ${chalk7__default.default.cyan(agentFiles.length)} agent(s):
|
|
762
790
|
`);
|
|
763
791
|
for (const file of agentFiles) {
|
|
764
792
|
const agentName = path__default.default.basename(file, ".ts");
|
|
@@ -767,22 +795,22 @@ async function agentListCommand(options) {
|
|
|
767
795
|
const content = await readFile(agentPath);
|
|
768
796
|
const pattern = extractPattern(content);
|
|
769
797
|
const description = extractDescription(content);
|
|
770
|
-
logger.info(
|
|
798
|
+
logger.info(chalk7__default.default.bold.cyan(` ${agentName}`));
|
|
771
799
|
if (pattern) {
|
|
772
800
|
logger.info(` Pattern: ${pattern}`);
|
|
773
801
|
}
|
|
774
802
|
if (description) {
|
|
775
803
|
logger.info(` Description: ${description}`);
|
|
776
804
|
}
|
|
777
|
-
logger.info(` Path: ${
|
|
805
|
+
logger.info(` Path: ${chalk7__default.default.gray(agentPath)}`);
|
|
778
806
|
logger.newLine();
|
|
779
807
|
} else {
|
|
780
|
-
logger.info(` \u2022 ${
|
|
808
|
+
logger.info(` \u2022 ${chalk7__default.default.cyan(agentName)}`);
|
|
781
809
|
}
|
|
782
810
|
}
|
|
783
811
|
if (!options.verbose) {
|
|
784
812
|
logger.newLine();
|
|
785
|
-
logger.info(`Use ${
|
|
813
|
+
logger.info(`Use ${chalk7__default.default.cyan("--verbose")} for more details`);
|
|
786
814
|
}
|
|
787
815
|
} catch (error) {
|
|
788
816
|
logger.error(`Failed to list agents: ${error.message}`);
|
|
@@ -809,10 +837,10 @@ async function agentTestCommand(name, options) {
|
|
|
809
837
|
const testFile = path__default.default.join(cwd, "tests", "agents", `${name}.test.ts`);
|
|
810
838
|
if (!await pathExists(testFile)) {
|
|
811
839
|
logger.error(`Test file not found: ${testFile}`);
|
|
812
|
-
logger.info(`Create tests with: ${
|
|
840
|
+
logger.info(`Create tests with: ${chalk7__default.default.cyan(`agentforge agent:create ${name} --test`)}`);
|
|
813
841
|
process.exit(1);
|
|
814
842
|
}
|
|
815
|
-
logger.info(`Testing agent: ${
|
|
843
|
+
logger.info(`Testing agent: ${chalk7__default.default.cyan(name)}`);
|
|
816
844
|
logger.info(`Watch mode: ${options.watch ? "Yes" : "No"}`);
|
|
817
845
|
logger.newLine();
|
|
818
846
|
const packageManager = await detectPackageManager(cwd);
|
|
@@ -830,8 +858,8 @@ async function agentTestCommand(name, options) {
|
|
|
830
858
|
async function agentDeployCommand(name, options) {
|
|
831
859
|
try {
|
|
832
860
|
logger.header("\u{1F680} Deploy Agent");
|
|
833
|
-
logger.info(`Agent: ${
|
|
834
|
-
logger.info(`Environment: ${
|
|
861
|
+
logger.info(`Agent: ${chalk7__default.default.cyan(name)}`);
|
|
862
|
+
logger.info(`Environment: ${chalk7__default.default.cyan(options.environment || "production")}`);
|
|
835
863
|
logger.info(`Dry run: ${options.dryRun ? "Yes" : "No"}`);
|
|
836
864
|
logger.newLine();
|
|
837
865
|
if (options.dryRun) {
|
|
@@ -847,7 +875,7 @@ async function agentDeployCommand(name, options) {
|
|
|
847
875
|
logger.succeedSpinner("Agent deployed successfully");
|
|
848
876
|
}
|
|
849
877
|
logger.newLine();
|
|
850
|
-
logger.success(
|
|
878
|
+
logger.success(chalk7__default.default.bold.green("\u2728 Deployment completed!"));
|
|
851
879
|
logger.newLine();
|
|
852
880
|
logger.info("Note: Actual deployment implementation coming soon");
|
|
853
881
|
logger.info("For now, please use the deployment templates in the templates/deployment directory");
|
|
@@ -863,38 +891,37 @@ async function toolCreateCommand(name, options) {
|
|
|
863
891
|
const answers = await promptToolSetup({
|
|
864
892
|
name,
|
|
865
893
|
category: options.category,
|
|
894
|
+
structure: options.structure,
|
|
895
|
+
description: options.description,
|
|
866
896
|
generateTests: options.test
|
|
867
897
|
});
|
|
868
898
|
logger.newLine();
|
|
869
|
-
logger.info(`Creating tool: ${
|
|
870
|
-
logger.info(`Category: ${
|
|
899
|
+
logger.info(`Creating tool: ${chalk7__default.default.cyan(answers.name)}`);
|
|
900
|
+
logger.info(`Category: ${chalk7__default.default.cyan(answers.category)}`);
|
|
901
|
+
logger.info(`Structure: ${chalk7__default.default.cyan(answers.structure)}`);
|
|
871
902
|
logger.newLine();
|
|
872
903
|
const cwd = process.cwd();
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
const toolContent = generateToolContent(answers.name, answers.category, answers.description);
|
|
878
|
-
await writeFile(toolFile, toolContent);
|
|
879
|
-
logger.succeedSpinner("Tool file created");
|
|
880
|
-
if (answers.generateTests) {
|
|
881
|
-
logger.startSpinner("Creating test file...");
|
|
882
|
-
const testDir = path__default.default.join(cwd, "tests", "tools");
|
|
883
|
-
const testFile = path__default.default.join(testDir, `${answers.name}.test.ts`);
|
|
884
|
-
await ensureDir(testDir);
|
|
885
|
-
const testContent = generateTestContent2(answers.name);
|
|
886
|
-
await writeFile(testFile, testContent);
|
|
887
|
-
logger.succeedSpinner("Test file created");
|
|
904
|
+
if (answers.structure === "multi") {
|
|
905
|
+
await createMultiFileTool(cwd, answers);
|
|
906
|
+
} else {
|
|
907
|
+
await createSingleFileTool(cwd, answers);
|
|
888
908
|
}
|
|
889
909
|
logger.newLine();
|
|
890
|
-
logger.success(
|
|
910
|
+
logger.success(chalk7__default.default.bold.green("\u2728 Tool created successfully!"));
|
|
891
911
|
logger.newLine();
|
|
892
912
|
logger.header("\u{1F4DD} Next Steps");
|
|
893
|
-
|
|
894
|
-
`Edit ${
|
|
895
|
-
|
|
913
|
+
const nextSteps = answers.structure === "multi" ? [
|
|
914
|
+
`Edit ${chalk7__default.default.cyan(`src/tools/${answers.name}/index.ts`)} to implement your tool`,
|
|
915
|
+
`Add providers in ${chalk7__default.default.cyan(`src/tools/${answers.name}/providers/`)}`,
|
|
916
|
+
`Define types in ${chalk7__default.default.cyan(`src/tools/${answers.name}/types.ts`)}`,
|
|
917
|
+
answers.generateTests ? `Run ${chalk7__default.default.cyan(`pnpm test ${answers.name}`)} to test your tool` : "",
|
|
896
918
|
`Register the tool in your agent's tool registry`
|
|
897
|
-
]
|
|
919
|
+
] : [
|
|
920
|
+
`Edit ${chalk7__default.default.cyan(`src/tools/${answers.name}.ts`)} to implement your tool`,
|
|
921
|
+
answers.generateTests ? `Run ${chalk7__default.default.cyan(`pnpm test tests/tools/${answers.name}.test.ts`)} to test your tool` : "",
|
|
922
|
+
`Register the tool in your agent's tool registry`
|
|
923
|
+
];
|
|
924
|
+
logger.list(nextSteps.filter(Boolean));
|
|
898
925
|
} catch (error) {
|
|
899
926
|
logger.error(`Failed to create tool: ${error.message}`);
|
|
900
927
|
process.exit(1);
|
|
@@ -950,6 +977,46 @@ describe('${capitalize2(name)} Tool', () => {
|
|
|
950
977
|
function capitalize2(str) {
|
|
951
978
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
952
979
|
}
|
|
980
|
+
async function createSingleFileTool(cwd, answers) {
|
|
981
|
+
const toolDir = path__default.default.join(cwd, "src", "tools");
|
|
982
|
+
const toolFile = path__default.default.join(toolDir, `${answers.name}.ts`);
|
|
983
|
+
logger.startSpinner("Creating tool file...");
|
|
984
|
+
await ensureDir(toolDir);
|
|
985
|
+
const toolContent = generateToolContent(answers.name, answers.category, answers.description);
|
|
986
|
+
await writeFile(toolFile, toolContent);
|
|
987
|
+
logger.succeedSpinner("Tool file created");
|
|
988
|
+
if (answers.generateTests) {
|
|
989
|
+
logger.startSpinner("Creating test file...");
|
|
990
|
+
const testDir = path__default.default.join(cwd, "tests", "tools");
|
|
991
|
+
const testFile = path__default.default.join(testDir, `${answers.name}.test.ts`);
|
|
992
|
+
await ensureDir(testDir);
|
|
993
|
+
const testContent = generateTestContent2(answers.name);
|
|
994
|
+
await writeFile(testFile, testContent);
|
|
995
|
+
logger.succeedSpinner("Test file created");
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
async function createMultiFileTool(cwd, answers) {
|
|
999
|
+
const toolDir = path__default.default.join(cwd, "src", "tools", answers.name);
|
|
1000
|
+
logger.startSpinner("Creating tool directory structure...");
|
|
1001
|
+
await ensureDir(toolDir);
|
|
1002
|
+
const templatePath = getTemplatePath("tool-multi");
|
|
1003
|
+
const replacements = {
|
|
1004
|
+
TOOL_NAME: answers.name,
|
|
1005
|
+
TOOL_NAME_PASCAL: capitalize2(answers.name),
|
|
1006
|
+
TOOL_NAME_CAMEL: answers.name.charAt(0).toLowerCase() + answers.name.slice(1),
|
|
1007
|
+
TOOL_DESCRIPTION: answers.description,
|
|
1008
|
+
TOOL_CATEGORY: answers.category
|
|
1009
|
+
};
|
|
1010
|
+
await copyTemplate(templatePath, toolDir, replacements);
|
|
1011
|
+
logger.succeedSpinner("Tool directory structure created");
|
|
1012
|
+
if (!answers.generateTests) {
|
|
1013
|
+
logger.startSpinner("Cleaning up test files...");
|
|
1014
|
+
const fs4 = await import('fs-extra');
|
|
1015
|
+
const testDir = path__default.default.join(toolDir, "__tests__");
|
|
1016
|
+
await fs4.remove(testDir);
|
|
1017
|
+
logger.succeedSpinner("Test files removed");
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
953
1020
|
async function toolListCommand(options) {
|
|
954
1021
|
try {
|
|
955
1022
|
logger.header("\u{1F4CB} List Tools");
|
|
@@ -958,7 +1025,7 @@ async function toolListCommand(options) {
|
|
|
958
1025
|
const toolFiles = await findFiles("*.ts", toolDir);
|
|
959
1026
|
if (toolFiles.length === 0) {
|
|
960
1027
|
logger.warn("No tools found");
|
|
961
|
-
logger.info(`Create a tool with: ${
|
|
1028
|
+
logger.info(`Create a tool with: ${chalk7__default.default.cyan("agentforge tool:create <name>")}`);
|
|
962
1029
|
return;
|
|
963
1030
|
}
|
|
964
1031
|
let filteredTools = toolFiles;
|
|
@@ -977,7 +1044,7 @@ async function toolListCommand(options) {
|
|
|
977
1044
|
logger.warn(`No tools found in category: ${options.category}`);
|
|
978
1045
|
return;
|
|
979
1046
|
}
|
|
980
|
-
logger.info(`Found ${
|
|
1047
|
+
logger.info(`Found ${chalk7__default.default.cyan(filteredTools.length)} tool(s):
|
|
981
1048
|
`);
|
|
982
1049
|
for (const file of filteredTools) {
|
|
983
1050
|
const toolName = path__default.default.basename(file, ".ts");
|
|
@@ -986,22 +1053,22 @@ async function toolListCommand(options) {
|
|
|
986
1053
|
const content = await readFile(toolPath);
|
|
987
1054
|
const category = extractCategory(content);
|
|
988
1055
|
const description = extractDescription2(content);
|
|
989
|
-
logger.info(
|
|
1056
|
+
logger.info(chalk7__default.default.bold.cyan(` ${toolName}`));
|
|
990
1057
|
if (category) {
|
|
991
1058
|
logger.info(` Category: ${category}`);
|
|
992
1059
|
}
|
|
993
1060
|
if (description) {
|
|
994
1061
|
logger.info(` Description: ${description}`);
|
|
995
1062
|
}
|
|
996
|
-
logger.info(` Path: ${
|
|
1063
|
+
logger.info(` Path: ${chalk7__default.default.gray(toolPath)}`);
|
|
997
1064
|
logger.newLine();
|
|
998
1065
|
} else {
|
|
999
|
-
logger.info(` \u2022 ${
|
|
1066
|
+
logger.info(` \u2022 ${chalk7__default.default.cyan(toolName)}`);
|
|
1000
1067
|
}
|
|
1001
1068
|
}
|
|
1002
1069
|
if (!options.verbose) {
|
|
1003
1070
|
logger.newLine();
|
|
1004
|
-
logger.info(`Use ${
|
|
1071
|
+
logger.info(`Use ${chalk7__default.default.cyan("--verbose")} for more details`);
|
|
1005
1072
|
}
|
|
1006
1073
|
} catch (error) {
|
|
1007
1074
|
logger.error(`Failed to list tools: ${error.message}`);
|
|
@@ -1023,10 +1090,10 @@ async function toolTestCommand(name, options) {
|
|
|
1023
1090
|
const testFile = path__default.default.join(cwd, "tests", "tools", `${name}.test.ts`);
|
|
1024
1091
|
if (!await pathExists(testFile)) {
|
|
1025
1092
|
logger.error(`Test file not found: ${testFile}`);
|
|
1026
|
-
logger.info(`Create tests with: ${
|
|
1093
|
+
logger.info(`Create tests with: ${chalk7__default.default.cyan(`agentforge tool:create ${name} --test`)}`);
|
|
1027
1094
|
process.exit(1);
|
|
1028
1095
|
}
|
|
1029
|
-
logger.info(`Testing tool: ${
|
|
1096
|
+
logger.info(`Testing tool: ${chalk7__default.default.cyan(name)}`);
|
|
1030
1097
|
logger.info(`Watch mode: ${options.watch ? "Yes" : "No"}`);
|
|
1031
1098
|
logger.newLine();
|
|
1032
1099
|
const packageManager = await detectPackageManager(cwd);
|
|
@@ -1044,8 +1111,8 @@ async function toolTestCommand(name, options) {
|
|
|
1044
1111
|
async function toolPublishCommand(name, options) {
|
|
1045
1112
|
try {
|
|
1046
1113
|
logger.header("\u{1F4E6} Publish Tool");
|
|
1047
|
-
logger.info(`Tool: ${
|
|
1048
|
-
logger.info(`Tag: ${
|
|
1114
|
+
logger.info(`Tool: ${chalk7__default.default.cyan(name)}`);
|
|
1115
|
+
logger.info(`Tag: ${chalk7__default.default.cyan(options.tag || "latest")}`);
|
|
1049
1116
|
logger.info(`Dry run: ${options.dryRun ? "Yes" : "No"}`);
|
|
1050
1117
|
logger.newLine();
|
|
1051
1118
|
if (options.dryRun) {
|
|
@@ -1077,7 +1144,7 @@ async function toolPublishCommand(name, options) {
|
|
|
1077
1144
|
logger.succeedSpinner("Published to npm");
|
|
1078
1145
|
}
|
|
1079
1146
|
logger.newLine();
|
|
1080
|
-
logger.success(
|
|
1147
|
+
logger.success(chalk7__default.default.bold.green("\u2728 Tool published successfully!"));
|
|
1081
1148
|
logger.newLine();
|
|
1082
1149
|
logger.info("Note: Actual npm publishing implementation coming soon");
|
|
1083
1150
|
logger.info("For now, please use npm publish manually");
|
|
@@ -1102,7 +1169,7 @@ agent.command("list").description("List all agents").option("-v, --verbose", "Sh
|
|
|
1102
1169
|
agent.command("test <name>").description("Test a specific agent").option("-w, --watch", "Watch mode").action(agentTestCommand);
|
|
1103
1170
|
agent.command("deploy <name>").description("Deploy an agent").option("-e, --environment <env>", "Deployment environment", "production").option("--dry-run", "Dry run without actual deployment").action(agentDeployCommand);
|
|
1104
1171
|
var tool = program.command("tool").description("Manage tools");
|
|
1105
|
-
tool.command("create <name>").description("Create a new tool").option("-c, --category <category>", "Tool category (web, data, file, utility)", "utility").option("--no-test", "Skip test generation").action(toolCreateCommand);
|
|
1172
|
+
tool.command("create <name>").description("Create a new tool").option("-c, --category <category>", "Tool category (web, data, file, utility)", "utility").option("-s, --structure <structure>", "Tool structure (single, multi)", "single").option("-d, --description <description>", "Tool description").option("--no-test", "Skip test generation").action(toolCreateCommand);
|
|
1106
1173
|
tool.command("list").description("List all tools").option("-c, --category <category>", "Filter by category").option("-v, --verbose", "Show detailed information").action(toolListCommand);
|
|
1107
1174
|
tool.command("test <name>").description("Test a specific tool").option("-w, --watch", "Watch mode").action(toolTestCommand);
|
|
1108
1175
|
tool.command("publish <name>").description("Publish a tool to npm").option("--tag <tag>", "npm tag", "latest").option("--dry-run", "Dry run without actual publishing").action(toolPublishCommand);
|
|
@@ -1112,7 +1179,7 @@ async function run() {
|
|
|
1112
1179
|
await program.parseAsync(process.argv);
|
|
1113
1180
|
} catch (error) {
|
|
1114
1181
|
if (error.code !== "commander.help" && error.code !== "commander.version") {
|
|
1115
|
-
console.error(
|
|
1182
|
+
console.error(chalk7__default.default.red("Error:"), error.message);
|
|
1116
1183
|
process.exit(1);
|
|
1117
1184
|
}
|
|
1118
1185
|
}
|