Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Quick Intel plugin #2391

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

azep-ninja
Copy link
Contributor

Relates to

N/A

Risks

Low - This plugin is isolated and:

  • Uses established API endpoints
  • Has proper error handling
  • Follows existing plugin patterns
  • No database changes required
  • No deployment risks

Background

What does this PR do?

What kind of change is this?

Why are we doing this? Any context or related work?

Adds a new plugin for token security analysis using QuickIntel's API. The plugin:

  • Performs comprehensive token security audits
  • Adds market data integration via DexScreener
  • Supports multiple chains and address formats
  • Provides natural language analysis of results
  • Follows existing plugin patterns like GitBook

Features (non-breaking change which adds functionality)

  • New plugin integration
  • New token security capabilities
  • Enhanced market analysis features

Documentation changes needed?

My changes require a change to the project documentation.

  • Added comprehensive README.md
  • Added example usage
  • Added configuration guide
  • Added troubleshooting section

Testing

Where should a reviewer start?

Detailed testing steps

Add QUICKINTEL_API_KEY to environment variables
Add plugin to character.json

Review the main plugin files:

  • src/index.ts
  • src/actions/audit.ts
  • src/templates/index.ts

Check the README.md for documentation completeness

Screenshots

Before

After

image

image

Database changes

N/A

Deployment instructions

N/A

Discord username

ninja_dev

Copy link
Contributor

coderabbitai bot commented Jan 18, 2025

📝 Walkthrough

Walkthrough

A new plugin called @elizaos/plugin-quick-intel has been introduced to the project, focusing on token security audits and market analysis. The plugin integrates with QuickIntel's API and DexScreener to provide comprehensive token insights across multiple blockchain networks. It includes a complete package structure with configuration files, source code, and a detailed README, enabling developers to easily incorporate token security checks into their applications.

Changes

File Change Summary
agent/package.json Added @elizaos/plugin-quick-intel as a workspace dependency
packages/plugin-quick-intel/README.md New documentation for QuickIntel plugin, covering installation, usage, and features
packages/plugin-quick-intel/eslint.config.mjs Added ESLint configuration extending global settings
packages/plugin-quick-intel/package.json Created package definition for @elizaos/plugin-quick-intel with build scripts and dependencies
packages/plugin-quick-intel/src/actions/audit.ts Implemented TokenAuditAction for token security audits and DEX data retrieval
packages/plugin-quick-intel/src/index.ts Defined quickIntelPlugin with audit action
packages/plugin-quick-intel/src/templates/index.ts Added auditTemplate for generating security analysis responses
packages/plugin-quick-intel/tsconfig.json Configured TypeScript compilation settings
packages/plugin-quick-intel/tsup.config.ts Set up build configuration for the plugin

Finishing Touches

  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (5)
packages/plugin-quick-intel/src/actions/audit.ts (1)

114-128: Enhance chain and token address extraction logic

The regular expressions used to extract the chain and token address may miss some valid formats. Consider improving them for better accuracy.

Updated patterns:

- const chainPattern = /(?:on|for|in|at|chain)\s+([a-zA-Z0-9]+)/i;
+ const chainPattern = /(?:on|for|in|at|chain)\s+([\w\s]+)/i;

- const addressPattern = /\b([0-9a-zA-Z]{30,})\b/i;
+ const addressPattern = /\b(0x[a-fA-F0-9]{40}|[A-HJ-NP-Za-km-z1-9]{32,44})\b/g;

These changes broaden chain name matching to include spaces (e.g., "Binance Smart Chain") and refine the address pattern to match Ethereum and other common formats.

packages/plugin-quick-intel/src/templates/index.ts (1)

41-42: Ensure consistent placeholder names in the template

In the Quick Intel link, replace {{token}} with {{tokenAddress}} to match your variable naming elsewhere.

Updated link:

- https://app.quickintel.io/scanner?type=token&chain={{chain}}&contractAddress={{token}}
+ https://app.quickintel.io/scanner?type=token&contractAddress={{tokenAddress}}&chain={{chain}}
packages/plugin-quick-intel/README.md (3)

96-96: Fix bare URL in documentation

Wrap the URL in angle brackets for proper markdown formatting.

-Full list available at https://docs.quickintel.io/quick-intel-scanner/supported-chains
+Full list available at <https://docs.quickintel.io/quick-intel-scanner/supported-chains>
🧰 Tools
🪛 Markdownlint (0.37.0)

96-96: null
Bare URL used

(MD034, no-bare-urls)


128-128: Add language specifier to code block

Empty code block should specify a language or use text if no specific language applies.

-```
+```text
🧰 Tools
🪛 Markdownlint (0.37.0)

128-128: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


74-85: Improve type documentation

The any types in the interface should be more specific.

 interface AuditResponse {
     success: boolean;
     data: {
-        audit: any;    // QuickIntel audit data
-        market?: any;  // DexScreener market data
+        audit: {
+            riskScore: number;
+            findings: Array<{
+                severity: 'high' | 'medium' | 'low';
+                description: string;
+            }>;
+        };
+        market?: {
+            price: number;
+            volume24h: number;
+            liquidity: number;
+        };
     };
     params: {
         chain: string;
         tokenAddress: string;
     };
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 87793af and 65a5739.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • agent/package.json (1 hunks)
  • packages/plugin-quick-intel/README.md (1 hunks)
  • packages/plugin-quick-intel/eslint.config.mjs (1 hunks)
  • packages/plugin-quick-intel/package.json (1 hunks)
  • packages/plugin-quick-intel/src/actions/audit.ts (1 hunks)
  • packages/plugin-quick-intel/src/index.ts (1 hunks)
  • packages/plugin-quick-intel/src/templates/index.ts (1 hunks)
  • packages/plugin-quick-intel/tsconfig.json (1 hunks)
  • packages/plugin-quick-intel/tsup.config.ts (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • packages/plugin-quick-intel/eslint.config.mjs
  • packages/plugin-quick-intel/tsup.config.ts
  • packages/plugin-quick-intel/tsconfig.json
🧰 Additional context used
🪛 LanguageTool
packages/plugin-quick-intel/README.md

[misspelling] ~57-~57: This word is normally spelled as one.
Context: ...9zEt4rX" ``` ### Supported Features - Multi-chain support (EVM chains, Solana, etc.) - Co...

(EN_COMPOUNDS_MULTI_CHAIN)

🪛 Markdownlint (0.37.0)
packages/plugin-quick-intel/README.md

96-96: null
Bare URL used

(MD034, no-bare-urls)


128-128: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (2)
packages/plugin-quick-intel/src/index.ts (1)

1-13: Plugin definition is correctly implemented

The quickIntelPlugin is properly defined and integrates auditAction as intended.

agent/package.json (1)

64-64: LGTM!

The plugin dependency is correctly added and follows the workspace pattern.

Comment on lines +177 to +187
elizaLogger.error("Error in AUDIT_TOKEN handler:", error?.message, error?.error);

if (callback) {
await callback({
text: `Error performing token audit: ${error.message}`,
content: { error: error.message },
inReplyTo: message.id
});
}
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Avoid exposing internal error messages to users

In the error handler, you're sending error.message directly to the user. This could potentially reveal sensitive internal details. Provide a generic error message instead.

Here's a suggested fix:

  if (callback) {
      await callback({
-         text: `Error performing token audit: ${error.message}`,
-         content: { error: error.message },
+         text: "An error occurred while performing the token audit. Please try again later.",
+         content: { error: "Internal server error" },
          inReplyTo: message.id
      });
  }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
elizaLogger.error("Error in AUDIT_TOKEN handler:", error?.message, error?.error);
if (callback) {
await callback({
text: `Error performing token audit: ${error.message}`,
content: { error: error.message },
inReplyTo: message.id
});
}
return false;
}
elizaLogger.error("Error in AUDIT_TOKEN handler:", error?.message, error?.error);
if (callback) {
await callback({
text: "An error occurred while performing the token audit. Please try again later.",
content: { error: "Internal server error" },
inReplyTo: message.id
});
}
return false;
}

Comment on lines +17 to +19
"@elizaos/core": "workspace:*",
"tsup": "8.3.5"
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Review dependency configuration

tsup should be in devDependencies since it's a build tool.

    "dependencies": {
-      "@elizaos/core": "workspace:*",
-      "tsup": "8.3.5"
+      "@elizaos/core": "workspace:*"
+    },
+    "devDependencies": {
+      "tsup": "8.3.5"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"@elizaos/core": "workspace:*",
"tsup": "8.3.5"
},
"@elizaos/core": "workspace:*"
},
"devDependencies": {
"tsup": "8.3.5"
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants