-
Notifications
You must be signed in to change notification settings - Fork 4
Marcus/amp init command #1111
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
base: main
Are you sure you want to change the base?
Marcus/amp init command #1111
Conversation
CI NotesTwo CI issues surfaced (not caused by this PR):
Both are pre-existing infrastructure issues. Happy to address in |
…modes Add new `amp init` command to scaffold Amp projects from templates. Implements three modes of operation for maximum flexibility: - Interactive mode: Prompts for dataset name, version, and project name - Non-interactive mode: Uses flags (--dataset-name, --dataset-version, --project-name) - Quick defaults mode: Uses -y/--yes flag for CI/automation Features: - Template system with dynamic file generation - local-evm-rpc template with full Anvil setup - Validation for dataset names (lowercase, alphanumeric, underscore only) - Personalized README with configuration summary and doc links - Complete Foundry project structure with sample Counter contract Files added: - typescript/amp/src/cli/commands/init.ts (239 lines) - typescript/amp/src/cli/templates/Template.ts (60 lines) - typescript/amp/src/cli/templates/local-evm-rpc.ts (377 lines) - typescript/amp/test/cli/init.test.ts (141 lines) - TESTING_AMP_INIT.md (manual testing guide) Files modified: - typescript/amp/src/cli/main.ts (added init to subcommands) Testing: - 9 unit tests (all passing) - Manual testing guide with 10 test scenarios - TypeScript compilation: clean - ESLint formatting: clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Three small improvements for better user experience: 1. Validate project name is not empty in interactive mode - Prevents broken README with empty title - Trims whitespace from input 2. Check for existing amp.config.ts before initializing - Prevents accidental data loss - Clear error message with guidance 3. Add blank line after interactive prompts complete - Better visual separation between input and output phases - Improves readability All changes are defensive and low-risk. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit introduces the following changes to enhance the `amp init` command: 1. Updated the project name prompt to simplify the message from "Project name (for README):" to "Project name:" for clarity. 2. Changed the generated README file name from `README.md` to `README-local-evm-rpc.md` to better reflect its content and purpose. 3. Adjusted the README content to provide a more concise overview of the template's features and configuration, including a clearer description of the dataset and network. These modifications aim to improve user experience and documentation clarity. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…ontracts and build artifacts This commit enhances the .gitignore file by adding entries for various directories related to contracts and build outputs, including: - `contracts/out/` - `contracts/cache/` - `contracts/broadcast/` - `contracts/lib/` - `target/` for Rust builds - Nested workspace directories for Node.js, including `**/node_modules/`, `**/dist/`, and TypeScript build info files. These changes aim to prevent unnecessary files from being tracked in the repository, improving project cleanliness and maintainability.
… local-evm-rpc template headings This commit includes the following changes: 1. Updated the `amp init` command to use `return yield*` for error handling, enhancing clarity in the code. 2. Simplified console log messages for project initialization, removing emojis for a cleaner output. 3. Revised headings in the `local-evm-rpc` template documentation to remove emojis and improve consistency, making it more straightforward for users. These modifications aim to enhance code readability and improve user experience during project initialization.
… clarity This commit simplifies the output messages in the `amp init` command by consolidating next steps into a single line directing users to the README.md for further instructions. Additionally, the README template has been updated to reflect this change, ensuring consistency in documentation. These modifications aim to enhance user experience and streamline project setup.
… template This commit introduces a new `postInstall` function in the `local-evm-rpc` template, which automates the installation of Foundry dependencies and the building of contracts. The script utilizes the `Effect` library for error handling and provides clear console log messages to guide users through the setup process. These enhancements aim to streamline the development workflow for users working with Anvil-based projects.
… options for deployment This commit updates the deployment instructions in the `local-evm-rpc` template to include additional parameters for specifying the sender address and private key. This enhancement allows users to customize their deployment process more effectively, facilitating easier contract deployment on local EVM setups.
This commit modifies the Foundry installation command in the `local-evm-rpc` template to include the `--no-commit` and `--no-git` flags. This change aims to prevent automatic commits and Git operations during the installation process, providing users with more control over their setup. The error message has also been updated to reflect these changes, ensuring clarity in case of installation failure.
This commit updates the `local-evm-rpc` template to ensure the `lib` directory is created before cloning the `forge-std` repository. It adds error handling for directory creation and modifies the installation command to clone the repository directly, improving the reliability of the Foundry setup process. These changes aim to streamline the installation workflow and provide clearer error messages for users.
This commit deletes the following files as part of a cleanup process: - `tsconfig.build.json` and `tsconfig.json`: TypeScript configuration files that are no longer needed. - `VERSIONING.md`: Documentation on the versioning system, which has been removed for simplification. - `vitest.config.ts`: Configuration for Vitest testing framework, now obsolete. - Unused submodules and fixtures related to `forge-std` and `solady` have also been removed to streamline the project structure. These changes aim to reduce clutter and improve maintainability of the codebase.
…proved clarity and functionality This commit makes several enhancements to the `local-evm-rpc` template, including: - Updated the template description to reflect a focus on learning Amp with sample data. - Changed the event structure to emit 500 events for immediate querying, enhancing the educational aspect. - Revised the README to provide clearer instructions and highlight the new features, including the quick start guide and sample queries. - Modified the deployment script to deploy the new `EventEmitter` contract, which generates varied event data. - Updated tests to ensure they align with the new template structure and content. These changes aim to improve the user experience and streamline the onboarding process for new users learning Amp.
67815a5 to
8ad996b
Compare
|
@marcusrein are you still working on this? |
|
@leoyvens I would like to continue working on it once I receive feedback. I submitted prior to DevConnect and have not heard if I should continue on this or not. |
Add
amp initcommand with extensible template systemOverview
Introduces
amp init, a new CLI command that bootstraps Amp projects from templates. Provides a minimal and streamlined onboarding experience with an architecture designed to eventually support multiple templates.Initial template is specific to local development. If this shape of
amp initis approved, other templates that spin up various permutations of Amp may be built, for exampleevm-firehose-mulichain,evm-rpc-multichain-multicontract, etc.Usage
Interactive Mode (Recommended)
Prompts for template selection, dataset name, version, and project name with validation.
Non-Interactive Mode
Template:
local-evm-rpcA complete learning environment for developers new to Amp. Generates 11 files including:
What's Generated
What Developers Get
Key Features
✅ Interactive & non-interactive modes - Follow prompts or use CLI flags
✅ Template selection UI - Shows available templates with descriptions (extensible for future templates)
✅ Input validation - Dataset names, versions validated with helpful error messages
✅ Safety checks - Prevents overwriting existing
amp.config.ts✅ Comprehensive testing - 9 unit tests covering template resolution, validation, and file generation
Architecture
TemplateinterfaceTemplateErrorclassTesting
pnpm vitest run test/cli/init.test.ts # ✓ 9/9 tests passingCoverage includes:
Next Steps
After this PR, the next template will be
onchain-evm-rpcto guide developers to real blockchain usage (testnet/mainnet) with production best practices:start_blockandfinalized_blocks_onlysettingsBreaking Changes
None - purely additive feature.