Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# OpenAI Configuration
OPENAI_API_KEY=your-openai-api-key-here
OPENAI_MODEL=gpt-4

# Web3 Configuration
RPC_URL=https://eth-mainnet.g.alchemy.com/v2/your-api-key
CHAIN_ID=1

# Application Configuration
LOG_LEVEL=info
22 changes: 22 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "warn"
},
"env": {
"node": true,
"es2022": true
}
}
50 changes: 50 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# GitHub Copilot Instructions for Web3AI

## Project Overview
This is a Web3 AI Agent Platform that combines blockchain technology with advanced AI capabilities.

## Code Style Guidelines
- Use TypeScript for all code
- Follow ESLint configuration in `.eslintrc.json`
- Use async/await for asynchronous operations
- Prefer explicit types over `any`
- Write descriptive function and variable names

## Architecture Patterns
- Use dependency injection for better testability
- Separate concerns: AI logic, Web3 interactions, and business logic
- Use environment variables for configuration (API keys, RPC URLs)
- Implement proper error handling with try-catch blocks

## Web3 Integration
- Use ethers.js as the primary Web3 library
- Always validate addresses before transactions
- Implement gas estimation for transactions
- Use proper event listeners for blockchain events
- Handle network-specific configurations

## AI Agent Development
- Use LangChain for AI agent orchestration
- Implement context-aware prompts
- Add safety checks for AI-generated actions
- Log all AI decisions for transparency
- Use streaming responses when applicable

## Testing
- Write unit tests for all business logic
- Mock Web3 providers in tests
- Mock AI APIs in tests
- Aim for >80% code coverage

## Security
- Never commit API keys or private keys
- Validate all user inputs
- Sanitize AI outputs before execution
- Use secure randomness for cryptographic operations
- Implement rate limiting for AI API calls

## Documentation
- Add JSDoc comments for all public functions
- Document complex algorithms inline
- Keep README.md up to date with setup instructions
- Document environment variables in .env.example
113 changes: 113 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: CI/CD Pipeline

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

permissions:
contents: read

jobs:
lint:
name: Lint Code
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run ESLint
run: npm run lint

test:
name: Run Tests
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
node-version: [18, 20]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Upload coverage
if: matrix.node-version == 20
uses: codecov/codecov-action@v3
with:
files: ./coverage/lcov.info
flags: unittests
name: codecov-umbrella

build:
name: Build Project
runs-on: ubuntu-latest
needs: [lint, test]
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/

security-scan:
name: Security Scan
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run npm audit
run: npm audit --audit-level=moderate
continue-on-error: true

- name: Run Snyk security scan
uses: snyk/actions/node@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,30 @@
*.agdai
MAlonzo/**

# Node.js
node_modules/
dist/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Environment variables
.env
.env.local
.env.*.local

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# Testing
coverage/
.nyc_output/

# OS
.DS_Store
Thumbs.db
Loading
Loading