@agentforge/tools 0.10.0 → 0.10.2
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/README.md +80 -0
- package/dist/index.cjs +2105 -1524
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4527 -1044
- package/dist/index.d.ts +4527 -1044
- package/dist/index.js +1939 -1522
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -676,6 +676,86 @@ const result = await httpGet.execute({
|
|
|
676
676
|
console.log(result.data);
|
|
677
677
|
```
|
|
678
678
|
|
|
679
|
+
## 🏗️ Code Organization
|
|
680
|
+
|
|
681
|
+
All tools follow a consistent directory structure pattern for better maintainability and discoverability:
|
|
682
|
+
|
|
683
|
+
### Directory Structure
|
|
684
|
+
|
|
685
|
+
Each tool category is organized into its own directory with the following structure:
|
|
686
|
+
|
|
687
|
+
```
|
|
688
|
+
tool-category/
|
|
689
|
+
├── index.ts # Main exports, factory functions, default instances
|
|
690
|
+
├── types.ts # TypeScript interfaces, Zod schemas, configuration types
|
|
691
|
+
├── auth.ts # Authentication helpers (for API tools)
|
|
692
|
+
└── tools/ # Individual tool implementations
|
|
693
|
+
├── tool-1.ts
|
|
694
|
+
├── tool-2.ts
|
|
695
|
+
└── tool-3.ts
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
### Example: Slack Tools
|
|
699
|
+
|
|
700
|
+
```
|
|
701
|
+
slack/
|
|
702
|
+
├── index.ts # Exports: sendSlackMessage, notifySlack, getSlackChannels, getSlackMessages, createSlackTools()
|
|
703
|
+
├── types.ts # SlackConfig, SlackMessageSchema, SlackChannelSchema, etc.
|
|
704
|
+
├── auth.ts # getSlackToken(), validateSlackConfig()
|
|
705
|
+
└── tools/
|
|
706
|
+
├── send-message.ts
|
|
707
|
+
├── notify.ts
|
|
708
|
+
├── get-channels.ts
|
|
709
|
+
└── get-messages.ts
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
### Benefits
|
|
713
|
+
|
|
714
|
+
- **Modularity**: Each tool is in its own file, making it easy to find and modify
|
|
715
|
+
- **Consistency**: All tool categories follow the same pattern
|
|
716
|
+
- **Maintainability**: Changes to one tool don't affect others
|
|
717
|
+
- **Discoverability**: Clear structure makes it easy to understand what's available
|
|
718
|
+
- **Type Safety**: Shared types in `types.ts` ensure consistency across tools
|
|
719
|
+
- **Testability**: Each tool can be tested independently
|
|
720
|
+
|
|
721
|
+
### Factory Functions
|
|
722
|
+
|
|
723
|
+
Each tool category provides a factory function for custom configuration:
|
|
724
|
+
|
|
725
|
+
```typescript
|
|
726
|
+
import { createSlackTools } from '@agentforge/tools';
|
|
727
|
+
|
|
728
|
+
// Custom configuration
|
|
729
|
+
const customTools = createSlackTools({
|
|
730
|
+
token: 'xoxb-your-custom-token',
|
|
731
|
+
botName: 'My Custom Bot',
|
|
732
|
+
botIcon: ':rocket:'
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
// Use custom tools
|
|
736
|
+
await customTools.sendMessage.execute({
|
|
737
|
+
channel: 'general',
|
|
738
|
+
message: 'Hello from custom bot!'
|
|
739
|
+
});
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
Available factory functions:
|
|
743
|
+
- `createSlackTools(config?)` - Slack integration tools
|
|
744
|
+
- `createConfluenceTools(config?)` - Confluence integration tools
|
|
745
|
+
- `createHttpTools(config?)` - HTTP client tools
|
|
746
|
+
- `createScraperTools(config?)` - Web scraping tools
|
|
747
|
+
- `createCsvTools(config?)` - CSV processing tools
|
|
748
|
+
- `createJsonTools(config?)` - JSON processing tools
|
|
749
|
+
- `createXmlTools(config?)` - XML processing tools
|
|
750
|
+
- `createTransformerTools(config?)` - Data transformation tools
|
|
751
|
+
- `createFileOperationTools(config?)` - File operation tools
|
|
752
|
+
- `createDirectoryOperationTools(config?)` - Directory operation tools
|
|
753
|
+
- `createPathUtilityTools(config?)` - Path utility tools
|
|
754
|
+
- `createDateTimeTools(config?)` - Date/time tools
|
|
755
|
+
- `createStringUtilityTools(config?)` - String utility tools
|
|
756
|
+
- `createMathOperationTools(config?)` - Math operation tools
|
|
757
|
+
- `createValidationTools(config?)` - Validation tools
|
|
758
|
+
|
|
679
759
|
## 🛠️ Development
|
|
680
760
|
|
|
681
761
|
```bash
|