alfr3d
v1.1.0
Published
Alfr3d CLI installer for secure SDK integration with environment-based authentication
Maintainers
Readme
Alfred SDK CLI Scaffolder
A command-line tool that bootstraps the Alfred SDK into any Replit project with a single command.
Usage
npx alfr3d initWhat it does
The CLI automatically:
- Creates SDK directory - Installs the complete
alfred-sdk/folder with all necessary files - Detects main file - Finds your main application file (index.ts, main.ts, app.ts, etc.)
- Adds SDK integration - Automatically imports and initializes the Alfred SDK
- Creates .env file - Sets up environment variables for API configuration
- Provides guidance - Shows next steps and usage examples
Files Created
SDK Files
alfred-sdk/index.ts- Main SDK with TypeScript definitionsalfred-sdk/README.md- Complete SDK documentationalfred-sdk/package.json- Package configurationalfred-sdk/tsconfig.json- TypeScript configuration
Project Files
.env- Environment variables with Alfred configuration- Updated main file with SDK integration (if found)
Example Output
🧠 Alfred SDK Scaffolder
============================================================
ℹ️ Working directory: /path/to/your/project
✅ Detected Replit environment
ℹ️ Creating SDK directory: /path/to/your/project/alfred-sdk
✅ Created index.ts
✅ Created README.md
✅ Created package.json
✅ Created tsconfig.json
✅ Created 4 SDK files
✅ Created .env file with Alfred configuration
ℹ️ Found main file: index.ts
✅ Added Alfred SDK to index.ts
🧠 Setup Complete!
============================================================
✅ Alfred SDK has been scaffolded into your project
📋 Next Steps:
1. Update your .env file with your actual Alfred API key and project ID
2. Start your application to begin tracking errors and events
3. Use trackEvent() throughout your app to track custom events
🔧 Usage Example:
import { initAlfr3d, trackEvent } from "./alfred-sdk";
await trackEvent("user_action", { action: "button_click" });
📚 Documentation:
- Check ./alfred-sdk/README.md for detailed usage instructions
- Visit https://docs.alfred.com for full documentation
🎉 Happy tracking!Integration Code Added
The CLI automatically adds this code to your main file:
// Alfred SDK - Auto-generated
// Alfred SDK initialization
import { initAlfr3d, trackEvent } from './alfred-sdk';
// Initialize Alfred SDK
await initAlfr3d({
apiKey: process.env.ALFRED_API_KEY || 'your-api-key',
projectId: process.env.ALFRED_PROJECT_ID || 'your-project-id',
debug: process.env.NODE_ENV === 'development'
});
// Track application startup
await trackEvent('app_startup', {
timestamp: new Date().toISOString(),
version: '1.0.0'
});Environment Variables
The CLI creates a .env file with these variables:
# Alfred SDK Configuration
ALFRED_API_KEY=your-api-key-here
ALFRED_PROJECT_ID=your-project-id-here
# Optional: Custom API endpoint
# ALFRED_BASE_URL=https://api.alfred.com
# Environment
NODE_ENV=developmentPublishing
To publish this CLI tool to npm:
cd scaffold/
npm publishThen users can install and use it globally:
npx alfr3d initLocal Development
To test locally:
cd scaffold/
node index.js initFeatures
- Zero dependencies - Uses only Node.js built-in modules
- Replit detection - Automatically detects Replit environment
- Multiple file support - Finds main files in various locations and formats
- TypeScript support - Provides full TypeScript definitions
- Environment configuration - Sets up proper environment variables
- Error handling - Graceful error handling with helpful messages
- Colored output - Beautiful colored console output for better UX
Commands
npx alfr3d init- Initialize Alfred SDK in current projectnpx alfr3d help- Show help message
Requirements
- Node.js 14.0.0 or higher
- Replit environment (recommended)
License
MIT
