Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 30, 2025

This PR improves the environment setup process across all documentation by replacing direct echo commands with a safer .env.example template approach.

Problem

The current documentation uses potentially unsafe echo commands to create .env files:

echo "E2E_TEST_SEED_PHRASE=your-test-seed-phrase-here" > .env

This approach has several issues:

  • Can overwrite existing .env files without warning
  • Doesn't provide comprehensive variable documentation
  • Lacks clear guidance on editing and customizing environment variables
  • Not consistent with industry standards for environment configuration

Solution

Introduced a comprehensive .env.example template and updated all documentation to use the copy-and-edit pattern:

cp .env.example .env
# Edit .env to add your E2E_TEST_SEED_PHRASE and any other secrets
nano .env   # Or use your preferred editor (vim, code, etc.)

Changes Made

  • Created .env.example with comprehensive template including all required variables, clear comments, and security warnings
  • Updated 10 documentation files to consistently use the new approach:
    • AGENTS.md - Agent setup instructions
    • .github/copilot-instructions.md - GitHub Copilot configuration
    • .github/instructions/*.instructions.md - Specialized agent instructions (3 files)
    • README.md - Main project documentation
    • example/README.md - Example usage documentation
    • CLAUDE.md and GEMINI.md - AI agent specific setups

Benefits

  • Safety: Prevents accidental overwrites of existing configuration
  • Comprehensive: Template includes all variables with helpful documentation
  • User-friendly: Clear editor guidance for customizing secrets
  • Security: Maintains safe template in version control while keeping actual secrets ignored
  • Consistency: Standardized approach across all documentation
  • Professional: Follows industry best practices for environment configuration

The .gitignore already properly excludes .env files while tracking .env.example, ensuring security best practices are maintained.

Original prompt

implement this.
The following is a snapshot of a chat conversation between a user and an AI coding assistant. Prioritize later messages in the conversation.
User: - echo "E2E_TEST_SEED_PHRASE=your-test-seed-phrase-here" > .env

  • cp .env.example .env
  • Edit .env to add your E2E_TEST_SEED_PHRASE and any other secrets

  • nano .env # Or use your preferred editor (vim, code, etc.)
    INFO: notify_waitpid_callback_by_pid: Child process 9573 has exited; no callback was registered

Documentation Issue Type

  • Error in existing documentation
  • Missing documentation
  • Unclear or confusing documentation
  • Example code not working
  • Request for additional examples

Location

Where is the documentation issue located?

  • README.md
  • API documentation (JSDoc comments)
  • Examples in /example directory
  • Documentation in /docs directory
  • GitHub Copilot instructions (.github/copilot-instructions.md)
  • Copilot Agent instructions (.github/instructions/**/*.instructions.md)
  • Agents documentation (**/AGENTS.md)
  • Claude agent documentation (/CLAUDE.md)
  • Gemini agent documentation (/GEMINI.md)
  • Contributing guide
  • Other: ____________github/copilot-instructions.md Added comprehensive setup guide, table of contents, agent workflow examples, and troubleshooting section
    AGENTS.md Enhanced with quick setup checklist, workflow examples, and agent-specific best practices
    CLAUDE.md Added Claude-optimized setup workflow with analytical implementation examples
    GEMINI.md Added rapid setup steps and performance-focused optimization examples
    README.md Integrated new AI agent documentation section with clear navigation and quick start guideClaude AI Instructions for Onchain Test Kit
    This document provides specific instructions for Claude when working on the Onchain Test Kit project. For general project context, also refer to AGENTS.md and .github/copilot-instructions.md.

Quick Setup for Claude
Initial Configuration Steps
Load project context: Familiarize yourself with the repository structure and existing patterns
Review dependencies: Understand the TypeScript, Playwright, and Viem ecosystem
Study wallet patterns: Examine existing wallet implementations for consistency
Test setup: Verify you can run the build and test pipeline
Claude's Optimal Usage Workflow
// 1. Analyze requirements thoroughly
// Example: Adding a new wallet action for token swaps

// 2. Research existing patterns
// Check how similar actions are implemented across wallets
// Review test patterns for comprehensive coverage

// 3. Plan implementation
interface SwapActionOptions {
shouldApprove: boolean;
tokenIn: string;
tokenOut: string;
amount: string;
slippage?: string;
}

// 4. Implement with error handling
async handleSwapAction(options: SwapActionOptions): Promise {
try {
const popup = await this.waitForPopup();
// Handle swap-specific UI interactions
await popup.getByTestId('swap-confirm').click();
} catch (error) {
throw new WalletActionError('Swap action failed', error);
}
}

// 5. Add comprehensive tests
test('token swap approval flow', async ({ page, metamask }) => {
// Test happy path
// Test rejection path
// Test error conditions
// Test with different token pairs
});
Claude-Specific Strengths and Focus Areas
Leverage Claude's Capabilities
Code reasoning: Use detailed analysis for complex blockchain testing scenarios
Pattern recognition: Identify and maintain consistent architectural patterns
Comprehensive explanations: Provide thorough documentation for complex wallet interactions
Edge case consideration: Think through various blockchain and wallet edge cases
Preferred Development Approach

  1. Analytical Problem Solving
    When approaching tasks:

Analyze the full context of blockchain testing requirements
Consider wallet-specific behaviors and limitations
Think through async patterns and timing issues
Plan for cross-browser compatibility
2. Detailed Implementation Planning
Before making changes:

Review existing wallet implementations for patterns
Consider impact on all supported wallets (MetaMask, Coinbase, Phantom)
Plan for both unit tests and integration tests
Think through fork mode implications
3. Comprehensive Error Handling
Anticipate wallet connection timeouts
Handle network switching failures gracefully
Provide clear error messages for debugging
Consider retry mechanisms for flaky operations
Key Areas of Focus
Blockchain Testing Complexity
Fork mode testing: Understanding of mainnet forking for realistic testing
Multi-wallet scenarios: Handling different wallet behaviors consistently
Network switching: Chain-specific configurations and transitions
Transaction handling: Gas estimation, approval flows, and error states
TypeScript Excellence
Maintain strict typing throughout the codebase
Use proper generic constraints for wallet actions
Implement discriminated unions for action types
Ensure proper async/await typing ...

Created from VS Code via the [GitHub Pull Request](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github) extension.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Documentation Improvement for GitHub Copilot and Agent Setup Replace echo commands with .env.example template in documentation Sep 30, 2025
Copilot AI requested a review from joe10832 September 30, 2025 02:21
Copy link
Member

@joe10832 joe10832 left a comment

Choose a reason for hiding this comment

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

@joe10832
Copy link
Member

@copilot

Copy link
Member

@joe10832 joe10832 left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@joe10832 joe10832 left a comment

Choose a reason for hiding this comment

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

@copilot .github/instructions/development.instructions.md

The toolkit uses a fluent builder pattern for configuration:
```typescript
const config = configure()
.withMetaMask()
Copy link
Member

Choose a reason for hiding this comment

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

.github/instructions/development.instructions.md


# ✅ Set up test environment variables
export E2E_TEST_SEED_PHRASE="abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
cp .env.example .env
Copy link
Member

Choose a reason for hiding this comment

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

.github/instructions/development.instructions.md

npm run prepare-phantom # ⚠️ Currently broken (known issue)

# Create environment variables file
cp .env.example .env # If available
Copy link
Member

Choose a reason for hiding this comment

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

AGENTS.md


# ✅ Environment variables
export E2E_TEST_SEED_PHRASE="your test seed phrase here"
cp .env.example .env
Copy link
Member

Choose a reason for hiding this comment

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

.github/instructions/development.instructions.md


# ✅ Environment variables
export E2E_TEST_SEED_PHRASE="your test seed phrase here"
cp .env.example .env
Copy link
Member

Choose a reason for hiding this comment

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

.env.example

# Note: Coinbase and Phantom currently have known issues

# ✅ Environment variables
export E2E_TEST_SEED_PHRASE="your test seed phrase here"
Copy link
Member

Choose a reason for hiding this comment

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

.github/instructions/development.instructions.md


# ✅ Environment variables
export E2E_TEST_SEED_PHRASE="your test seed phrase here"
cp .env.example .env
Copy link
Member

Choose a reason for hiding this comment

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

.github/instructions/development.instructions.md

Copy link
Member

Choose a reason for hiding this comment

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

@.github/instructions/development.instructions.md

Copy link
Member

@joe10832 joe10832 left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@joe10832 joe10832 left a comment

Choose a reason for hiding this comment

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

.github/instructions/development.instructions.md

@joe10832 joe10832 marked this pull request as ready for review September 30, 2025 19:10
Copilot AI review requested due to automatic review settings September 30, 2025 19:10
@joe10832 joe10832 merged commit 6a1c2cb into copilot/vscode1759198149531 Sep 30, 2025
2 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves environment setup documentation by replacing potentially unsafe echo commands with a standardized .env.example template approach. The change enhances safety by preventing accidental overwrites and provides comprehensive variable documentation with clear editing guidance.

Key Changes:

  • Created a comprehensive .env.example template with security warnings and helpful comments
  • Updated all documentation files to use the safer cp .env.example .env pattern instead of direct echo commands
  • Standardized environment setup instructions across 10 documentation files

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.env.example New comprehensive template file with all environment variables, security warnings, and clear documentation
README.md Updated main setup instructions to use template-based approach with detailed guidance
AGENTS.md Replaced echo command with standardized copy-and-edit pattern for agent setup
CLAUDE.md Updated Claude-specific setup to use safer environment configuration method
GEMINI.md Modified Gemini setup instructions to follow new template approach
example/README.md Updated example documentation and troubleshooting sections with new pattern
.github/copilot-instructions.md Enhanced GitHub Copilot setup with template-based environment configuration
.github/instructions/development.instructions.md Updated development setup to use safer environment variable configuration
.github/instructions/testing.instructions.md Modified testing setup instructions to follow new template pattern
.github/instructions/wallet-integration.instructions.md Updated wallet integration setup with standardized environment configuration

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