Complete source code - AI Provider Edition v2.0.1
Added complete source code and pre-compiled application: Source Code: - app.asar (compiled Electron app) - app-extracted/ (all extracted source files) - dist/services/aiProviderService.js - dist/services/settingsService.js - dist/ipcHandlers.js - dist/aiProviderAPI.ts - dist/ai-provider-settings.html - And all other application files Build Tools: - scripts/extract-app.sh - scripts/repack-app.sh - scripts/build-deb.sh - scripts/install-deb.sh Documentation: - SOURCE_CODE.md (repository structure) - BUILD.md (build instructions) - README.md (overview) - docs/ (complete API docs) - AI_PROVIDER_SPECIFICATION.md - AI_PROVIDER_README.md - IMPLEMENTATION_SUMMARY.md Features included: - 17+ AI provider presets - One-click provider setup - Model auto-fetching - Connection testing - Modern GUI interface - Complete IPC handlers (14 new) - TypeScript API wrapper - Persistent settings Ready to build and customize!
This commit is contained in:
265
BUILD.md
Normal file
265
BUILD.md
Normal file
@@ -0,0 +1,265 @@
|
||||
# Building Antigravity from Source
|
||||
|
||||
This guide explains how to extract, modify, and rebuild the Antigravity IDE from source.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Linux system (Ubuntu/Debian recommended)
|
||||
- Node.js 18+ with npm
|
||||
- Git
|
||||
- Standard build tools
|
||||
- ~1GB disk space
|
||||
|
||||
## Quick Build
|
||||
|
||||
If you just want to rebuild the package without modifications:
|
||||
|
||||
```bash
|
||||
# Clone repository
|
||||
git clone https://github.rommark.dev/admin/antigravity-ai-providers.git
|
||||
cd antigravity-ai-providers
|
||||
|
||||
# Build .deb package
|
||||
./scripts/build-deb.sh
|
||||
|
||||
# Install
|
||||
sudo dpkg -i packages/antigravity_2.0.1-ai-providers-1_amd64.deb
|
||||
```
|
||||
|
||||
## Detailed Build Process
|
||||
|
||||
### Step 1: Extract app.asar
|
||||
|
||||
The application code is packaged in `app.asar`. Extract it to modify:
|
||||
|
||||
```bash
|
||||
# Extract app
|
||||
./scripts/extract-app.sh
|
||||
|
||||
# This creates: src/app-extracted/
|
||||
```
|
||||
|
||||
### Step 2: Modify Code
|
||||
|
||||
Navigate to extracted files:
|
||||
|
||||
```bash
|
||||
cd src/app-extracted/dist/
|
||||
```
|
||||
|
||||
**Key Files:**
|
||||
|
||||
- `services/aiProviderService.js` - AI provider management
|
||||
- `services/settingsService.js` - Application settings
|
||||
- `ipcHandlers.js` - IPC communication
|
||||
- `aiProviderAPI.ts` - TypeScript API wrapper
|
||||
- `ai-provider-settings.html` - Complete GUI
|
||||
|
||||
**Example Modifications:**
|
||||
|
||||
#### Add a New Provider Preset
|
||||
|
||||
Edit `services/aiProviderService.js`:
|
||||
|
||||
```javascript
|
||||
const PROVIDER_PRESETS = {
|
||||
// ... existing presets ...
|
||||
|
||||
"My Custom Provider": {
|
||||
type: AIProviderType.CUSTOM,
|
||||
endpoint: "https://api.myprovider.com/v1",
|
||||
models: ["model-1", "model-2"],
|
||||
capabilities: [AIProviderCapability.CHAT, AIProviderCapability.STREAMING],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
#### Add New IPC Handler
|
||||
|
||||
Edit `ipcHandlers.js`:
|
||||
|
||||
```javascript
|
||||
electron_1.ipcMain.handle('ai:my-new-handler', async (_event, arg) => {
|
||||
// Your handler logic
|
||||
return result;
|
||||
});
|
||||
```
|
||||
|
||||
#### Customize GUI
|
||||
|
||||
Edit `ai-provider-settings.html`:
|
||||
|
||||
```html
|
||||
<!-- Add your UI changes -->
|
||||
<div id="my-new-section">
|
||||
<h2>My New Feature</h2>
|
||||
<!-- ... -->
|
||||
</div>
|
||||
```
|
||||
|
||||
### Step 3: Repack app.asar
|
||||
|
||||
After making changes, repack:
|
||||
|
||||
```bash
|
||||
# Repack
|
||||
./scripts/repack-app.sh
|
||||
|
||||
# This updates: src/app.asar
|
||||
```
|
||||
|
||||
### Step 4: Build Package
|
||||
|
||||
Create the .deb package:
|
||||
|
||||
```bash
|
||||
# Build
|
||||
./scripts/build-deb.sh
|
||||
|
||||
# Output: packages/antigravity_2.0.1-ai-providers-1_amd64.deb
|
||||
```
|
||||
|
||||
### Step 5: Install & Test
|
||||
|
||||
```bash
|
||||
# Install
|
||||
sudo dpkg -i packages/antigravity_2.0.1-ai-providers-1_amd64.deb
|
||||
|
||||
# Test
|
||||
antigravity
|
||||
```
|
||||
|
||||
## Development Workflow
|
||||
|
||||
### Watching for Changes
|
||||
|
||||
For rapid development:
|
||||
|
||||
```bash
|
||||
# Terminal 1: Extract and watch
|
||||
./scripts/extract-app.sh
|
||||
# (Manual repack after changes)
|
||||
|
||||
# Terminal 2: Build and install
|
||||
./scripts/build-deb.sh && sudo dpkg -i packages/*.deb
|
||||
```
|
||||
|
||||
### Debugging
|
||||
|
||||
View logs:
|
||||
|
||||
```bash
|
||||
# Electron logs
|
||||
cat ~/.config/antigravity/logs/*.log
|
||||
|
||||
# Language server logs
|
||||
cat ~/.cache/antigravity/language_server.log
|
||||
```
|
||||
|
||||
Run in debug mode:
|
||||
|
||||
```bash
|
||||
antigravity --enable-logging
|
||||
```
|
||||
|
||||
### Testing Changes
|
||||
|
||||
```bash
|
||||
# Reinstall and test
|
||||
sudo dpkg -r antigravity
|
||||
sudo dpkg -i packages/antigravity_2.0.1-ai-providers-1_amd64.deb
|
||||
antigravity
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### asar command not found
|
||||
|
||||
```bash
|
||||
npm install -g asar
|
||||
```
|
||||
|
||||
### Build fails
|
||||
|
||||
Check dependencies:
|
||||
|
||||
```bash
|
||||
sudo apt-get install build-essential
|
||||
```
|
||||
|
||||
### Installation fails
|
||||
|
||||
Fix dependencies:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i antigravity_2.0.1-ai-providers-1_amd64.deb
|
||||
sudo apt-get install -f
|
||||
```
|
||||
|
||||
### App doesn't start
|
||||
|
||||
Check logs:
|
||||
|
||||
```bash
|
||||
journalctl -xe
|
||||
cat ~/.config/antigravity/logs/*.log
|
||||
```
|
||||
|
||||
## Advanced: Custom Package
|
||||
|
||||
### Create Different Architecture
|
||||
|
||||
Edit `scripts/build-deb.sh`:
|
||||
|
||||
```bash
|
||||
# For ARM64
|
||||
ARCH="arm64"
|
||||
DEB_FILE="antigravity_${VERSION}_arm64.deb"
|
||||
```
|
||||
|
||||
### Add Extra Dependencies
|
||||
|
||||
Edit `scripts/build-deb.sh`:
|
||||
|
||||
```bash
|
||||
# Add to Depends field in control file
|
||||
Depends: ..., my-custom-package
|
||||
```
|
||||
|
||||
### Include Additional Files
|
||||
|
||||
```bash
|
||||
# In build-deb.sh, after copying app files:
|
||||
cp /path/to/your/file "$TEMP_DIR/opt/antigravity/"
|
||||
```
|
||||
|
||||
## Contributing Changes
|
||||
|
||||
1. Fork repository
|
||||
2. Create branch: `git checkout -b feature/my-feature`
|
||||
3. Commit changes: `git commit -am 'Add my feature'`
|
||||
4. Push: `git push origin feature/my-feature`
|
||||
5. Create Pull Request
|
||||
|
||||
## API Documentation
|
||||
|
||||
See `/docs/` directory for complete API reference:
|
||||
|
||||
- `AI_PROVIDER_SPECIFICATION.md` - AI Provider API
|
||||
- `AI_PROVIDER_README.md` - Integration guide
|
||||
- `IMPLEMENTATION_SUMMARY.md` - Architecture details
|
||||
|
||||
## Need Help?
|
||||
|
||||
- **Issues**: https://github.rommark.dev/admin/antigravity-ai-providers/issues
|
||||
- **Discussions**: https://github.rommark.dev/admin/antigravity-ai-providers/discussions
|
||||
|
||||
## Summary
|
||||
|
||||
1. Extract: `./scripts/extract-app.sh`
|
||||
2. Modify: Edit files in `src/app-extracted/dist/`
|
||||
3. Repack: `./scripts/repack-app.sh`
|
||||
4. Build: `./scripts/build-deb.sh`
|
||||
5. Install: `sudo dpkg -i packages/*.deb`
|
||||
|
||||
**Happy coding!** 🚀
|
||||
Reference in New Issue
Block a user