Reorganized Langchain, Actions, and Tools into Protocol-Specific Directories #179
+3,218
−3,068
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, /langchain, /actions and /tools folders have grown exponentially due to the high demand of this repo, making it increasingly difficult to maintain and navigate. This PR implements a comprehensive reorganization of the codebase by splitting protocol-specific code into dedicated directories.
Problem:
The monolithic structure of /langchain, /actions and /tools folders have become a maintenance burden:
Solution:
This PR reorganizes three key areas of the codebase using a consistent pattern of one directory per protocol, with each protocol's implementation living in its own index.ts file:
New structure example:
src/langchain/
├── 3land/
│ ├── index.ts
├── orca/
│ ├── index.ts
├── pyth/
│ ├── index.ts
.
.
.
This organization provides several advantages:
Actions (/src/actions/):
We've preserved the existing one-file-per-action pattern while organizing them into protocol-specific directories:
src/actions/
├── bonfida/
│ ├── getPrimaryDomain.ts
│ ├── registerDomain.ts
│ └── resolveSolDomain.ts
├── metaplex/
│ ├── deploycollection.ts
│ ├── mintNFT.ts
│ └── deploytoken.ts
├── gibwork/
│ ├── createGibWorkTask.ts
Tools (/src/tools/):
Similarly, we've maintained the granular file structure for tools while grouping them by protocol.
The different organizational patterns reflect the distinct purposes of each directory:
Benefits:
No breaking changes have been introduced - this is purely a structural reorganization that maintains all existing functionality while improving code organization.
Please review the directory structure changes and let me know if you'd like any adjustments to the organization pattern.
Let me know if you need anything else :D.
This pull request was created for https://app.gib.work/bounties/0b78790e-6d48-4ec3-b67f-46c96dac6b7d in an attempt to solve a bounty #173 . Payment for the bounty is immediately sent to the contributor after merge.