Update: Scripts README with init-project documentation
- Detailed explanation of init-project purpose - Complete usage examples - Show example output - Clarify project structure (separate repos) - Include workflow summary
This commit is contained in:
@@ -1,65 +1,129 @@
|
|||||||
# Scripts
|
# Scripts
|
||||||
|
|
||||||
Utility scripts for agent installation and management.
|
Utility scripts for agent installation and project management.
|
||||||
|
|
||||||
## bootstrap-agents.sh
|
## bootstrap-agents.sh
|
||||||
|
|
||||||
**Purpose:** Ensures the latest homelab agents are available on any VPS instance.
|
**Purpose:** Ensures the latest homelab agents and tools are available on any VPS instance.
|
||||||
|
|
||||||
**What it does:**
|
**What it does:**
|
||||||
- Clones the homelab-agents repository if not present
|
- Clones the homelab-agents repository if not present
|
||||||
- Updates the repository to latest version if it exists
|
- Updates the repository to latest version if it exists
|
||||||
|
- Installs helper scripts (like init-project)
|
||||||
|
- Adds scripts to your PATH
|
||||||
- Verifies agents are available for use
|
- Verifies agents are available for use
|
||||||
- Sets up git remotes for future VPS work
|
|
||||||
|
|
||||||
**Usage:**
|
**Usage:**
|
||||||
|
|
||||||
### Option 1: Source in current session
|
Run this **once** on your new VPS:
|
||||||
```bash
|
```bash
|
||||||
bash <(curl -s http://100.120.125.113:3000/pdm/homelab-agents/raw/branch/main/scripts/bootstrap-agents.sh)
|
bash <(curl -s http://100.120.125.113:3000/pdm/homelab-agents/raw/branch/main/scripts/bootstrap-agents.sh)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Option 2: Add to ~/.bashrc for automatic setup
|
**Output:**
|
||||||
```bash
|
```
|
||||||
# Add this line to ~/.bashrc:
|
✨ Homelab agents bootstrap complete!
|
||||||
source ~/.homelab-setup.sh 2>/dev/null
|
|
||||||
|
|
||||||
# Then copy the script:
|
📚 Available commands:
|
||||||
curl -s http://100.120.125.113:3000/raw/pdm/homelab-agents/main/scripts/bootstrap-agents.sh > ~/.homelab-setup.sh
|
init-project <name> - Initialize a new project with git remote
|
||||||
chmod +x ~/.homelab-setup.sh
|
cd ~/.homelab-agents - Browse agents and scripts
|
||||||
```
|
```
|
||||||
|
|
||||||
### Option 3: Manual execution at session start
|
---
|
||||||
|
|
||||||
|
## init-project
|
||||||
|
|
||||||
|
**Purpose:** Quickly initialize new VPS projects with automatic Gitea remote configuration.
|
||||||
|
|
||||||
|
**Problem it solves:**
|
||||||
|
- No more manual git setup
|
||||||
|
- No more being asked for repository URL
|
||||||
|
- Consistent project initialization across all VPS instances
|
||||||
|
- Remote is ready before any work starts
|
||||||
|
|
||||||
|
**What it does:**
|
||||||
|
1. Creates a new project directory
|
||||||
|
2. Initializes git repository
|
||||||
|
3. Sets up git user config
|
||||||
|
4. **Automatically configures Gitea remote** (no prompts!)
|
||||||
|
5. Creates initial main branch
|
||||||
|
|
||||||
|
**Usage:**
|
||||||
|
|
||||||
|
From your projects directory:
|
||||||
```bash
|
```bash
|
||||||
bash ~/.homelab-agents/scripts/bootstrap-agents.sh
|
cd ~/projects
|
||||||
|
init-project my-new-app
|
||||||
```
|
```
|
||||||
|
|
||||||
**After bootstrapping:**
|
**Example output:**
|
||||||
|
```
|
||||||
|
📁 Creating project directory: my-new-app
|
||||||
|
🔧 Initializing git repository...
|
||||||
|
🔗 Configuring Gitea remote...
|
||||||
|
|
||||||
The agents will be available at:
|
✅ Project initialized successfully!
|
||||||
|
|
||||||
|
📋 Project Details:
|
||||||
|
Name: my-new-app
|
||||||
|
Directory: /root/projects/my-new-app
|
||||||
|
Remote: http://100.120.125.113:3000/pdm/my-new-app.git
|
||||||
|
Branch: main
|
||||||
|
|
||||||
|
🚀 Next steps:
|
||||||
|
1. Start working in this directory
|
||||||
|
2. Create files and make changes
|
||||||
|
3. When done, use the summary agent
|
||||||
|
4. Agent will automatically commit and push to Gitea
|
||||||
|
```
|
||||||
|
|
||||||
|
**What happens next:**
|
||||||
|
- Work normally in your project directory
|
||||||
|
- Git remote is already configured
|
||||||
|
- When you use the summary agent, it knows exactly where to push
|
||||||
|
- No more "What's the Gitea remote URL?" prompts!
|
||||||
|
|
||||||
|
**Project Repository:**
|
||||||
|
|
||||||
|
Each project gets its own independent Gitea repository:
|
||||||
|
- Project: `my-new-app` → Repository: `http://100.120.125.113:3000/pdm/my-new-app.git`
|
||||||
|
- Project: `project-2` → Repository: `http://100.120.125.113:3000/pdm/project-2.git`
|
||||||
|
|
||||||
|
Projects on the same VPS are separate and independent.
|
||||||
|
|
||||||
|
**Installation:**
|
||||||
|
|
||||||
|
`init-project` is automatically installed by bootstrap-agents.sh to:
|
||||||
|
```
|
||||||
|
~/.homelab-scripts/init-project
|
||||||
|
```
|
||||||
|
|
||||||
|
It's added to your PATH, so you can run it from anywhere.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Workflow Summary
|
||||||
|
|
||||||
|
### First Time on a VPS
|
||||||
|
```bash
|
||||||
|
bash <(curl -s http://100.120.125.113:3000/pdm/homelab-agents/raw/branch/main/scripts/bootstrap-agents.sh)
|
||||||
|
```
|
||||||
|
|
||||||
|
### For Each New Project
|
||||||
|
```bash
|
||||||
|
cd ~/projects
|
||||||
|
init-project my-app
|
||||||
|
cd my-app
|
||||||
|
# Start working...
|
||||||
|
```
|
||||||
|
|
||||||
|
### Closing a Session
|
||||||
|
Use the summary agent:
|
||||||
```
|
```
|
||||||
~/.homelab-agents/agents/sysadmin-session-closer.md
|
~/.homelab-agents/agents/sysadmin-session-closer.md
|
||||||
~/.homelab-agents/agents/[other-agents].md
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Use in Claude Code by referencing the agent path directly.
|
The agent will:
|
||||||
|
- Create session summary
|
||||||
**Example - Using the summary agent:**
|
- Commit changes
|
||||||
|
- Push to Gitea (using the remote we set up earlier)
|
||||||
In your Claude Code session, when you want to close the session:
|
|
||||||
```
|
|
||||||
Use the agent at ~/.homelab-agents/agents/sysadmin-session-closer.md
|
|
||||||
```
|
|
||||||
|
|
||||||
**Key Features:**
|
|
||||||
- ✅ Idempotent - safe to run multiple times
|
|
||||||
- ✅ Automatic updates - always gets latest agent versions
|
|
||||||
- ✅ Graceful error handling - provides clear feedback
|
|
||||||
- ✅ No manual git commands needed - fully automated
|
|
||||||
|
|
||||||
**How it works across VPS instances:**
|
|
||||||
|
|
||||||
1. Each VPS runs the bootstrap script at session start
|
|
||||||
2. Latest agents are pulled from Gitea
|
|
||||||
3. If you update an agent in Gitea, all VPSs get the new version on next bootstrap
|
|
||||||
4. Changes to agents are immediate across your entire homelab
|
|
||||||
Reference in New Issue
Block a user