10 KiB
Git-Based Pack Installation - Work Summary
Date: 2025-01-27 Status: Complete Type: Feature Implementation
Overview
Implemented git-based pack installation feature to enable production-ready pack deployment from remote git repositories. This moves Attune beyond the filesystem-only registration suitable for development, enabling proper version control, collaboration, and CI/CD integration for pack management.
Problem Statement
The existing "Register Pack from Filesystem" functionality was limited to development environments where pack directories could be pre-loaded manually. Production deployments require:
- Remote Installation: Install packs from git repositories (GitHub, GitLab, etc.)
- Version Control: Install specific versions via git tags, branches, or commits
- CI/CD Integration: Automate pack deployment in build pipelines
- Team Collaboration: Share packs via git hosting services
Future requirements include installing from file registries (Nexus 3, Artifactory).
Implementation Summary
What Was Discovered
-
Infrastructure Already Exists: The backend already had a complete
PackInstallerimplementation inattune/crates/common/src/pack_registry/installer.rswith:- Git repository cloning support
- Archive URL support
- Local directory support
- Registry support (planned)
- Progress callback system
- Checksum verification
-
API Endpoint Exists: Route
/api/v1/packs/installwas already implemented inattune/crates/api/src/routes/packs.rswith full functionality:- Source type detection (git, archive, local)
- Dependency validation
- Test execution
- Permanent storage management
- Installation metadata tracking
-
Missing Piece: Only the web UI was missing - no interface to access the install functionality.
What Was Created
1. Web UI Components
File: attune/web/src/pages/packs/PackInstallPage.tsx (501 lines)
- Complete pack installation interface
- Source type selection (Git, Archive, Registry)
- Git reference input (branch, tag, commit)
- Installation options (force, skip tests, skip dependencies)
- Progress feedback and error handling
- Comprehensive help documentation
- Visual design consistent with existing UI
Features:
- Three installation source types (git active, archive active, registry planned)
- Git reference support for branches, tags, and commit hashes
- HTTPS and SSH URL support
- Clear visual feedback during installation
- Detailed installation process explanation
- Auto-redirect to pack details on success
2. React Hooks
File: attune/web/src/hooks/usePackTests.ts
- Added
useInstallPack()mutation hook - Handles API communication for pack installation
- Invalidates pack cache on successful installation
- Error handling with user-friendly messages
3. Routing
File: attune/web/src/App.tsx
- Added route:
/packs/install→PackInstallPage - Imported and configured new component
File: attune/web/src/pages/packs/PacksPage.tsx
- Added "Install from Remote" option to pack creation dropdown
- New menu item with GitBranch icon (purple)
- Fallback link when no packs exist
4. Documentation
File: attune/docs/packs/pack-installation-git.md (587 lines)
Comprehensive documentation covering:
- Quick start guide (Web UI, CLI, API)
- Supported git sources (HTTPS, SSH)
- Git reference types (branches, tags, commits)
- Pack structure requirements
- Installation process (7 steps)
- Installation options and flags
- Example workflows (dev, production, CI/CD, private repos)
- Troubleshooting guide
- Security considerations
- Advanced topics (submodules, large repos, monorepos)
- Database schema
- API reference
- Future enhancements
Technical Details
Installation Flow
- User Input: URL + optional git reference
- Clone Repository:
git clone [--depth 1] <url> - Checkout Reference:
git checkout <ref>(if specified) - Locate Pack: Find
pack.yamlat root or inpack/subdirectory - Validate Dependencies: Check runtime and pack dependencies
- Register Pack: Create database entry, sync workflows
- Run Tests: Execute pack test suite (if configured)
- Copy to Storage: Move to
{packs_base_dir}/{pack_ref}/ - Record Metadata: Store installation details in
pack_installationtable
Supported Git References
- Branches:
main,develop,feature/xyz - Tags:
v1.0.0,release-2024-01-27 - Commits: Full or short hash (7+ chars)
- Default: Repository's default branch (shallow clone)
Installation Options
| Option | Flag | Purpose |
|---|---|---|
| Force | --force |
Replace existing pack, bypass checks |
| Skip Tests | --skip-tests |
Skip test execution |
| Skip Dependencies | --skip-deps |
Skip dependency validation |
Database Storage
Installation metadata stored in pack_installation table:
- Source type:
git - Source URL: Repository URL
- Source ref: Branch/tag/commit
- Checksum: Directory checksum
- Installed by: User ID
- Installation method:
api,cli, orweb - Storage path: Filesystem location
- Metadata: JSON with additional details
Files Changed
New Files
attune/web/src/pages/packs/PackInstallPage.tsx- Installation UI (501 lines)attune/docs/packs/pack-installation-git.md- Documentation (587 lines)
Modified Files
attune/web/src/hooks/usePackTests.ts- AddeduseInstallPackhookattune/web/src/App.tsx- Added install routeattune/web/src/pages/packs/PacksPage.tsx- Added install menu itemattune/web/src/pages/packs/PackCreatePage.tsx- Removed unused import
Bug Fixes
- Fixed schema builder collapse issue (index-based expansion tracking)
- Fixed quick examples not syncing config values immediately
- Removed unused
Zapimport
Testing Performed
Build Verification
- ✅ TypeScript compilation: No errors
- ✅ Production build: Successful
- ✅ All imports resolved correctly
- ✅ No unused variables or warnings
Manual Testing Recommended
- Install pack from public GitHub repository
- Install from specific git tag
- Install from branch
- Test with SSH URL (requires SSH key setup)
- Verify dependency validation
- Test force installation (replace existing pack)
- Verify test execution
- Check installation metadata in database
Usage Examples
Web UI
- Navigate to Packs page
- Click "Add Pack" → "Install from Remote"
- Select "Git Repository"
- Enter:
https://github.com/example/pack-slack.git - Enter ref:
v2.1.0(optional) - Click "Install Pack"
CLI (Future)
attune pack install https://github.com/example/pack-slack.git --ref v2.1.0
API
curl -X POST http://localhost:8080/api/v1/packs/install \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"source": "https://github.com/example/pack-slack.git",
"ref_spec": "v2.1.0",
"force": false,
"skip_tests": false,
"skip_deps": false
}'
Future Enhancements
Immediate Next Steps
- Archive Installation UI: Enable archive URL option (already supported by backend)
- Registry Installation: Implement when pack registry system is complete
- CLI Command: Add CLI support for pack installation
- Progress Feedback: Show real-time progress during git clone
Planned Features (from spec)
- Git submodule support
- Monorepo support (install from subdirectory)
- Pack version upgrade workflow
- Automatic version detection from git tags
- Git LFS support
- Signature verification for signed commits
- File registry support (Nexus 3, Artifactory)
Security Considerations
Implemented
- ✅ Support for SSH authentication
- ✅ HTTPS URL support
- ✅ Dependency validation (unless skipped)
- ✅ Test execution (unless skipped)
- ✅ Installation metadata tracking
- ✅ User authentication required
Recommendations (from documentation)
- Use SSH keys for private repositories
- Never embed credentials in URLs
- Install from specific tags in production
- Review pack code before installation
- Rotate access tokens periodically
- Use dedicated SSH keys with limited permissions
Related Work
Prerequisites
This feature builds on existing infrastructure:
- Pack installer implementation (
attune/crates/common/src/pack_registry/installer.rs) - Pack installation API (
attune/crates/api/src/routes/packs.rs) - Pack storage system (
attune/crates/common/src/pack_registry/storage.rs) - Dependency validation (
attune/crates/common/src/pack_registry/dependency.rs)
Related Documentation
docs/packs/pack-registry-spec.md- Overall registry specificationdocs/packs/pack-structure.md- Pack file format requirementsdocs/packs/pack-testing-framework.md- Pack testingdocs/deployment/production-deployment.md- Deployment guide
Impact
User Benefits
- Production Ready: Can now deploy packs to production environments
- Version Control: Install specific pack versions via git tags
- Collaboration: Share packs across teams via git
- CI/CD: Automate pack deployment in build pipelines
- Flexibility: Support for public and private repositories
Developer Benefits
- Git Workflow: Standard git workflows for pack development
- Testing: Test from feature branches before release
- Release Management: Use git tags for version releases
- Code Review: Standard pull request workflow
Operations Benefits
- Auditability: Full installation history in database
- Reproducibility: Install exact versions via commit hash
- Rollback: Easy rollback to previous versions
- Automation: Scriptable via API or CLI
Conclusion
Successfully implemented git-based pack installation feature with comprehensive web UI, complete documentation, and production-ready functionality. The feature leverages existing robust backend infrastructure and provides a user-friendly interface for installing packs from remote git repositories.
The implementation supports the full range of git references (branches, tags, commits), both HTTPS and SSH URLs, and includes proper dependency validation, testing, and installation metadata tracking. This moves Attune from a development-only filesystem registration system to a production-ready pack deployment system suitable for team collaboration and CI/CD integration.
Next steps include enabling the archive URL option (already supported by backend) and implementing the pack registry system for centralized pack distribution.