Add vibe-kanban

This commit is contained in:
2025-12-31 01:31:54 +07:00
parent 488d7c2a76
commit a37b59f29a
41 changed files with 2004 additions and 0 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
.cursor/.DS_Store vendored

Binary file not shown.

View File

@@ -0,0 +1,287 @@
# start-dev-env
## When to Use
Use this command when you want to:
- Test your code changes in an isolated Docker Compose environment
- Verify API endpoints work correctly after modifications
- Test database interactions with a fresh copy of the main database
- Iterate on changes by testing them in a real environment
- Debug issues in an isolated environment before committing
## Prerequisites
- .NET SDK installed (`dotnet --version`)
- Main PostgreSQL database running on localhost:5432
- Docker installed and running
- PostgreSQL client (psql) installed
- Scripts are executable: `chmod +x scripts/*.sh`
## Execution Steps
### Step 1: Verify Prerequisites
Check that all prerequisites are met:
1. **Check main database is accessible:**
Run: `PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d managing -c '\q'`
**If connection fails:**
- Error: "❌ Cannot connect to main database at localhost:5432"
- **Fix**: Start the main PostgreSQL container:
```bash
cd src/Managing.Docker
docker-compose -f docker-compose.yml -f docker-compose.local.yml up -d postgres
```
- Wait 15 seconds for PostgreSQL to start
- Retry connection check
- **STOP** if database cannot be started
2. **Check Docker is running:**
Run: `docker ps`
**If Docker is not running:**
- Error: "❌ Docker is not running"
- **Fix**: Start Docker Desktop or Docker daemon
- **STOP** if Docker cannot be started
### Step 2: Generate Task ID
Generate a unique task ID for this dev session:
- Use format: `DEV-{timestamp}` or `DEV-{random}`
- Example: `DEV-20250101-143022` or `DEV-A3X9`
- Store this ID for later reference
### Step 3: Find Available Port
Find an available port offset to avoid conflicts:
- Start with offset 0 (ports: 5433, 5000, 6379)
- If ports are in use, try offset 10, 20, 30, etc.
- Check if ports are available:
```bash
lsof -i :5433 || echo "Port 5433 available"
lsof -i :5000 || echo "Port 5000 available"
```
### Step 4: Start Docker Environment
Start the Docker Compose environment with database copy:
Run: `bash scripts/start-task-docker.sh {TASK_ID} {PORT_OFFSET}`
**Example:**
```bash
bash scripts/start-task-docker.sh DEV-A3X9 0
```
**Or use the simple wrapper:**
```bash
bash scripts/start-dev-env.sh DEV-A3X9 0
```
**What this does:**
1. Creates task-specific Docker Compose file
2. Starts PostgreSQL on port 5433 (or 5432 + offset)
3. Starts Redis on port 6379 (or 6379 + offset)
4. Waits for PostgreSQL to be ready
5. Copies database from main repo (localhost:5432) to test instance
6. Starts API and Workers with correct connection strings
7. Uses main InfluxDB instance at localhost:8086
**If start succeeds:**
- Note the API URL (e.g., "http://localhost:5000")
- Note the database name (e.g., "managing_dev-a3x9")
- Continue to Step 5
**If start fails:**
- Check error messages
- Common issues:
- Port conflicts: Try different port offset
- Database connection: Verify main database is running
- Docker issues: Check Docker is running
- **Try to fix:**
- Use different port offset
- Restart Docker
- Verify main database is accessible
- **STOP** if cannot start after multiple attempts
### Step 5: Verify Environment is Running
Verify the Docker environment is working:
1. **Check API health endpoint:**
Run: `curl http://localhost:{API_PORT}/health`
**If health check fails:**
- Wait 30 seconds for services to start
- Check Docker logs: `docker logs managing-api-{TASK_ID}`
- Check for errors
- **STOP** if services don't start after 2 minutes
2. **Verify database was copied:**
Run: `PGPASSWORD=postgres psql -h localhost -p {POSTGRES_PORT} -U postgres -d managing_{TASK_ID} -c "SELECT COUNT(*) FROM \"Users\";"`
**If database is empty or missing:**
- Error: "❌ Database was not copied correctly"
- **Fix**: Re-run database copy script manually
- **STOP** if database cannot be copied
### Step 6: Test Your Changes
Now you can test your changes:
1. **API endpoints:**
- Use API URL: `http://localhost:{API_PORT}`
- Test modified endpoints
- Verify responses are correct
2. **Database interactions:**
- Changes are isolated to this test database
- Main database remains unchanged
- Can test migrations, data changes, etc.
3. **Iterate:**
- Make code changes
- Rebuild solution: `/build-solution`
- Rebuild Docker images if needed: `docker-compose -f {COMPOSE_FILE} build`
- Restart services: `docker-compose -f {COMPOSE_FILE} restart managing-api-{TASK_ID}`
- Test again
### Step 7: Stop Instance When Done
When finished testing, stop the Docker environment:
Run: `bash scripts/stop-task-docker.sh {TASK_ID}`
**Example:**
```bash
bash scripts/stop-task-docker.sh DEV-A3X9
```
This will:
- Stop all containers
- Remove volumes
- Clean up compose file
## Integration with Development Workflow
### After Making Code Changes
1. **Build solution:**
- Run: `/build-solution`
- Fix any build errors
2. **Start Docker environment for testing:**
- Run: `/start-aspire-dev`
- Note the URLs
3. **Test your changes:**
- Use the API endpoints
- Verify database interactions
- Check logs: `docker logs managing-api-{TASK_ID}`
4. **Iterate if needed:**
- Fix issues found during testing
- Rebuild Docker images if code changed
- Restart services
- Test again
5. **Stop when done:**
- Stop the Docker environment
- Clean up if needed
### When to Use This Command
- ✅ After modifying API endpoints
- ✅ After changing database models
- ✅ After updating business logic
- ✅ Before committing changes
- ✅ When debugging issues
- ✅ When testing integrations
### When NOT to Use This Command
- ❌ For production deployments (use proper CI/CD)
- ❌ For running unit tests (use test runner)
- ❌ For code review (use static analysis)
## Error Handling
**If main database is not accessible:**
- Start PostgreSQL container: `cd src/Managing.Docker && docker-compose up -d postgres`
- Wait 15 seconds
- Retry connection check
- **STOP** if database cannot be started
**If ports are in use:**
- Try different port offset (10, 20, 30, etc.)
- Check what's using the ports: `lsof -i :{PORT}`
- Stop conflicting services if needed
**If database copy fails:**
- Verify main database is accessible
- Check PostgreSQL client is installed: `which psql`
- Verify connection strings are correct
- Check disk space
- **STOP** if copy cannot complete
**If Docker services don't start:**
- Check Docker logs: `docker logs {container_id}`
- Verify all dependencies are installed
- Check .NET SDK version matches requirements
- **STOP** if services cannot start after multiple attempts
## Example Execution
**User input:** `/start-dev-env`
**AI execution:**
1. Verify prerequisites:
- Check main database: ✅ Accessible
- Check Docker: ✅ Running
2. Generate task ID: `DEV-A3X9`
3. Find available port: Offset 0 (ports available)
4. Start Docker environment:
```bash
bash scripts/start-task-docker.sh DEV-A3X9 0
```
- Creating compose file...
- Starting PostgreSQL...
- ✅ PostgreSQL ready
- Copying database...
- ✅ Database copied
- Starting API and Workers...
- ✅ Services started
5. Verify:
- API: http://localhost:5000 ✅
- Health check: ✅ Healthy
- Database: ✅ Copied (1234 users found)
6. Success: "✅ Docker dev environment ready!"
- API: http://localhost:5000
- Database: managing_dev-a3x9 on port 5433
- To stop: `bash scripts/stop-task-docker.sh DEV-A3X9`
## Important Notes
- ✅ **Always verify main database first** - Must be accessible
- ✅ **Use unique task IDs** - Prevents conflicts
- ✅ **Check port availability** - Avoids port conflicts
- ✅ **Wait for services to start** - Can take 30-60 seconds
- ✅ **Database is isolated** - Changes don't affect main database
- ✅ **InfluxDB uses main instance** - No separate InfluxDB per task
- ✅ **Stop when done** - Frees up resources
- ⚠️ **Multiple instances** - Each needs unique ports
- ⚠️ **Resource usage** - Each instance uses memory/CPU
- 📦 **Script location**: `scripts/start-task-docker.sh`
- 🔧 **Main database**: localhost:5432
- 🗄️ **Test databases**: localhost:5433+ (isolated per task)
- 📊 **InfluxDB**: Uses main instance at localhost:8086

11
.gitignore vendored
View File

@@ -372,6 +372,10 @@ src/Managing.Infrastructure.Tests/PrivateKeys.cs
/src/Managing.Web3Proxy/coverage/
/src/Managing.Web3Proxy/.env
/src/Managing.Web3Proxy/.env.*
# Root .env file (contains sensitive configuration)
.env
.env.local
.env.*.local
/src/Managing.Web3Proxy2/node_modules/
/src/Managing.Web3Proxy2/dist/
/src/Managing.Fastify/dist/
@@ -384,3 +388,10 @@ node_modules/
scripts/influxdb/exports/
scripts/privy/privy-users.csv
# Vibe Kanban (keep config.json, ignore data files)
.vibe-kanban/*.db
.vibe-kanban/data/
.vibe-kanban/*.sqlite
# Task process PID files and logs
.task-pids/

125
docs/ENV_FILE_SETUP.md Normal file
View File

@@ -0,0 +1,125 @@
# .env File Setup
## Overview
A `.env` file has been created at the project root to store environment variables **primarily for Vibe Kanban worktrees**. The .NET API optionally loads this file using the `DotNetEnv` package.
**Note**: `.env` file loading is **optional** - if the file doesn't exist, the application will continue normally using system environment variables and `appsettings.json`. This is expected behavior for normal operation.
## What Was Done
1. **Created `.env` file** at project root with all environment variables
2. **Added DotNetEnv package** to `Managing.Api.csproj`
3. **Updated `Program.cs`** to automatically load `.env` file before configuration
4. **Updated `.gitignore`** to exclude `.env` files from version control
## File Locations
- **`.env`**: Project root (`/Users/oda/Desktop/Projects/managing-apps/.env`)
- **Configuration**: `src/Managing.Api/Program.cs` (lines 34-58)
## How It Works
The `Program.cs` file **optionally** searches for a `.env` file in multiple locations:
1. Current working directory
2. Executable directory
3. Project root (relative to bin/Debug/net8.0)
4. Current directory (absolute path)
When found, it loads the environment variables before `WebApplication.CreateBuilder` is called, ensuring they're available to the configuration system.
**Important**: If no `.env` file is found, the application continues normally without any warnings. This is expected behavior - the `.env` file is only needed for Vibe Kanban worktrees.
## Environment Variables Included
The `.env` file contains:
- Database connection strings (PostgreSQL, Orleans)
- InfluxDB configuration
- JWT secrets
- Privy configuration
- Admin users and authorized addresses
- Feature flags
- Discord, N8n, Sentry, Flagsmith configurations
- Orleans configuration
## Usage
### Local Development
When running the API locally (outside Docker), the `.env` file will be **optionally** loaded if it exists:
```bash
cd src/Managing.Api
dotnet run
```
If `.env` exists, you'll see: `✅ Loaded .env file from: [path] (optional - for Vibe Kanban worktrees)`
If `.env` doesn't exist, the application runs normally using system environment variables and `appsettings.json` (no message is shown).
### Vibe Kanban Worktrees
When Vibe Kanban creates a worktree, configure it to copy the `.env` file:
**In Vibe Kanban Settings → Copy Files:**
```
.env
```
The API will automatically find and load the `.env` file from the worktree root.
### Docker Containers
Docker containers continue to use environment variables set in `docker-compose.yml` files. The `.env` file is not used in Docker (environment variables are passed directly to containers).
## Security
⚠️ **Important**: The `.env` file contains sensitive information and is excluded from git via `.gitignore`.
**Never commit the `.env` file to version control!**
## Updating Environment Variables
To update environment variables:
1. Edit `.env` file at project root
2. Restart the application
3. The new values will be loaded automatically
## Troubleshooting
### .env file not found
**This is normal!** The `.env` file is optional and only needed for Vibe Kanban worktrees. If no `.env` file is found, the application will:
- Continue normally
- Use system environment variables
- Use `appsettings.json` files
- No error or warning is shown (this is expected behavior)
If you need the `.env` file for Vibe Kanban:
- Ensure `.env` exists at the project root
- Configure Vibe Kanban to copy it in "Copy Files" settings
### Variables not loading
- Ensure `.env` file is at project root
- Check file format (KEY=VALUE, one per line)
- Verify no syntax errors in `.env` file
- Restart the application after changes
### Priority Order
Configuration is loaded in this order (later sources override earlier ones):
1. `.env` file (via DotNetEnv)
2. `appsettings.json`
3. `appsettings.{Environment}.json`
4. System environment variables
5. User Secrets (Development only)
## Related Files
- `src/Managing.Api/Program.cs` - Loads .env file
- `src/Managing.Api/Managing.Api.csproj` - Contains DotNetEnv package reference
- `.gitignore` - Excludes .env files
- `scripts/create-task-compose.sh` - Docker environment variables (separate from .env)

View File

@@ -0,0 +1,283 @@
# Installation Guide: Vibe Kanban & dev-manager-mcp
This guide will help you install and configure Vibe Kanban and dev-manager-mcp for managing your development workflow with isolated test environments.
## Prerequisites
- Node.js >= 18 (or Bun)
- Docker installed and running
- PostgreSQL client (psql) installed
- Main database running on localhost:5432
## Part 1: Install dev-manager-mcp
dev-manager-mcp is a daemon that manages multiple dev servers in parallel, allocating unique ports to avoid collisions.
### Installation
**Option 1: Use via npx (Recommended - No Installation Needed)**
No installation required! Just use `npx`:
```bash
# Start the daemon
npx -y dev-manager-mcp daemon
```
**Option 2: Install Globally**
```bash
npm install -g dev-manager-mcp
# or
bun install -g dev-manager-mcp
```
### Start the Daemon
Open a terminal and keep it running:
```bash
npx -y dev-manager-mcp daemon
```
You should see output indicating the daemon is running. Keep this terminal open.
### Verify Installation
In another terminal, test the MCP connection:
```bash
# Check if daemon is accessible
npx dev-manager-mcp status
```
## Part 2: Install Vibe Kanban
Vibe Kanban is a task management system that integrates with coding agents and can automatically start dev environments.
### Installation
**Option 1: Use via npx (Recommended - No Installation Needed)**
```bash
# Just run it - no installation needed
npx vibe-kanban
```
**Option 2: Install Globally**
```bash
npm install -g vibe-kanban
# or
bun install -g vibe-kanban
```
### First Run
1. **Start Vibe Kanban:**
```bash
npx vibe-kanban
```
2. **Authenticate with your coding agent:**
- Vibe Kanban will prompt you to authenticate
- Follow the instructions for your agent (Claude, Codex, etc.)
3. **Access the UI:**
- Vibe Kanban will start a web server
- Open the URL shown in the terminal (usually http://localhost:3000)
### Configure MCP Integration
1. **Open Vibe Kanban Settings:**
- In the Vibe Kanban UI, go to Settings
- Find "MCP Servers" or "Agent Configuration"
2. **Add dev-manager-mcp:**
```json
{
"mcpServers": {
"dev-manager": {
"command": "npx",
"args": ["dev-manager-mcp", "stdio"]
}
}
}
```
3. **Configure QA Automation:**
- In Settings, find "QA" or "Testing" section
- Enable "Auto-start dev environments"
- Set script path: `scripts/start-task-docker.sh`
- Set health check URL: `http://localhost:{port}/health`
## Part 3: Configure for Your Project
### Create Vibe Kanban Configuration
**Recommended: At Projects level** (to manage all projects):
Create a `.vibe-kanban` directory in your Projects folder:
```bash
cd /Users/oda/Desktop/Projects
mkdir -p .vibe-kanban
```
Create `/Users/oda/Desktop/Projects/.vibe-kanban/config.json`:
```json
{
"projectRoot": "/Users/oda/Desktop/Projects",
"mcpServers": {
"dev-manager": {
"command": "npx",
"args": ["dev-manager-mcp", "stdio"]
}
},
"qa": {
"enabled": true,
"autoStartDevEnv": true,
"devEnvScript": "managing-apps/scripts/start-task-docker.sh",
"healthCheckUrl": "http://localhost:{port}/health",
"dashboardUrl": "http://localhost:{port}"
},
"tasks": {
"statuses": {
"ready-for-qa": {
"autoStartDevEnv": true
}
}
}
}
```
**Note**: The `devEnvScript` path is relative to the Projects folder. For managing-apps, it's `managing-apps/scripts/start-task-docker.sh`. For other projects, configure project-specific scripts in Vibe Kanban's project settings.
### Update Your MCP Configuration
If you're using Cursor or another editor with MCP support, add to your MCP config (usually `~/.cursor/mcp.json` or similar):
```json
{
"mcpServers": {
"dev-manager": {
"command": "npx",
"args": ["dev-manager-mcp", "stdio"]
}
}
}
```
## Part 4: Usage Workflow
### For Development (Agent)
1. **Make code changes**
2. **Start test environment:**
```bash
cd /Users/oda/Desktop/Projects/managing-apps
bash scripts/start-dev-env.sh DEV-A3X9
```
3. **Test your changes** at the provided URLs
4. **Stop when done:**
```bash
bash scripts/stop-task-docker.sh DEV-A3X9
```
### For QA (Vibe Kanban)
1. **Move task to "Ready for QA" status**
2. **Vibe Kanban automatically:**
- Starts a Docker environment
- Copies the database
- Provides test URLs
3. **Test the task**
4. **Move to "Done" or "Needs Changes"**
5. **Vibe Kanban automatically stops the environment**
### Manual Management
**Start an environment:**
```bash
cd /Users/oda/Desktop/Projects/managing-apps
bash scripts/start-task-docker.sh TASK-123 0
```
**Check status:**
```bash
npx dev-manager-mcp status
```
**View logs:**
```bash
docker logs managing-api-TASK-123
```
**Stop an environment:**
```bash
bash scripts/stop-task-docker.sh TASK-123
```
## Troubleshooting
### dev-manager-mcp Issues
**Daemon not starting:**
- Check Node.js version: `node --version` (needs >= 18)
- Try: `npx -y dev-manager-mcp daemon --verbose`
**Cannot connect to daemon:**
- Make sure daemon is running in another terminal
- Check if port is already in use
- Restart the daemon
### Vibe Kanban Issues
**Cannot start:**
- Check Node.js version: `node --version` (needs >= 18)
- Try: `npx vibe-kanban --verbose`
**MCP not working:**
- Verify dev-manager-mcp daemon is running
- Check MCP configuration in Vibe Kanban settings
- Restart Vibe Kanban
**Auto-start not working:**
- Check script path in configuration
- Verify script is executable: `chmod +x scripts/start-task-docker.sh`
- Check Vibe Kanban logs
### Docker Issues
**Port conflicts:**
- Use different port offset: `bash scripts/start-task-docker.sh TASK-123 10`
- Check what's using ports: `lsof -i :5000`
**Database copy fails:**
- Verify main database is running: `docker ps | grep postgres`
- Check PostgreSQL client: `which psql`
- Verify connection: `PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d managing -c '\q'`
## Next Steps
1. ✅ Install dev-manager-mcp (via npx)
2. ✅ Install Vibe Kanban (via npx)
3. ✅ Start dev-manager-mcp daemon
4. ✅ Start Vibe Kanban
5. ✅ Configure MCP integration
6. ✅ Test with a sample task
## Resources
- [Vibe Kanban GitHub](https://github.com/BloopAI/vibe-kanban)
- [Vibe Kanban Documentation](https://www.vibekanban.com/vibe-guide)
- [dev-manager-mcp GitHub](https://github.com/BloopAI/dev-manager-mcp)
- [MCP Documentation](https://modelcontextprotocol.io/)
## Support
- Vibe Kanban: [GitHub Discussions](https://github.com/BloopAI/vibe-kanban/discussions)
- dev-manager-mcp: [GitHub Issues](https://github.com/BloopAI/dev-manager-mcp/issues)

View File

@@ -0,0 +1,177 @@
# Task Environments Setup with Docker Compose
This document explains how to use Docker Compose to create isolated test environments for each development task.
## Overview
Each task gets its own isolated Docker Compose environment with:
- ✅ Isolated PostgreSQL database (copy of main database)
- ✅ Isolated Redis instance
- ✅ API and Workers containers
- ✅ Uses main InfluxDB instance (shared)
- ✅ Unique ports per task to avoid conflicts
## Quick Start
### Start a Test Environment
```bash
# Simple way (auto-generates task ID)
bash scripts/start-dev-env.sh
# With specific task ID
bash scripts/start-dev-env.sh TASK-123
# With specific task ID and port offset
bash scripts/start-dev-env.sh TASK-123 10
```
### Stop a Test Environment
```bash
bash scripts/stop-task-docker.sh TASK-123
```
## Scripts
### `scripts/start-task-docker.sh`
Main script that:
1. Creates task-specific Docker Compose file
2. Starts PostgreSQL and Redis
3. Copies database from main repo
4. Starts API and Workers
**Usage:**
```bash
bash scripts/start-task-docker.sh <TASK_ID> <PORT_OFFSET>
```
### `scripts/stop-task-docker.sh`
Stops and cleans up a task environment.
**Usage:**
```bash
bash scripts/stop-task-docker.sh <TASK_ID>
```
### `scripts/copy-database-for-task.sh`
Copies database from main repo to task-specific PostgreSQL instance.
**Usage:**
```bash
bash scripts/copy-database-for-task.sh <TASK_ID> <SOURCE_HOST> <SOURCE_PORT> <TARGET_HOST> <TARGET_PORT>
```
### `scripts/create-task-compose.sh`
Generates a Docker Compose file for a specific task.
**Usage:**
```bash
bash scripts/create-task-compose.sh <TASK_ID> <PORT_OFFSET>
```
### `scripts/start-dev-env.sh`
Simple wrapper for dev agents to start environments.
**Usage:**
```bash
bash scripts/start-dev-env.sh [TASK_ID] [PORT_OFFSET]
```
## Port Allocation
Default ports (offset 0):
- PostgreSQL: 5433
- API: 5000
- Redis: 6379
- InfluxDB: 8086 (uses main instance)
With offset 10:
- PostgreSQL: 5442
- API: 5010
- Redis: 6389
- InfluxDB: 8086 (uses main instance)
## Database Setup
Each task environment:
- Gets a fresh copy of the main database
- Has isolated databases: `managing_{task_id}` and `orleans_{task_id}`
- Changes don't affect the main database
- Can be reset by stopping and restarting
## Integration with Vibe Kanban
When a task moves to "Ready for QA":
1. Vibe Kanban calls `scripts/start-task-docker.sh`
2. Environment is created with database copy
3. Test URLs are provided
4. When done, Vibe Kanban calls `scripts/stop-task-docker.sh`
## Integration with dev-manager-mcp
dev-manager-mcp can manage multiple environments:
- Start: `npx dev-manager-mcp start --command "bash scripts/start-task-docker.sh TASK-123 0"`
- Status: `npx dev-manager-mcp status`
- Stop: `npx dev-manager-mcp stop --session-key <KEY>`
## Troubleshooting
### Port Conflicts
Use a different port offset:
```bash
bash scripts/start-task-docker.sh TASK-123 10
```
### Database Copy Fails
1. Verify main database is running: `docker ps | grep postgres`
2. Check connection: `PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d managing -c '\q'`
3. Ensure PostgreSQL client is installed: `which psql`
### Services Don't Start
Check logs:
```bash
docker logs managing-api-TASK-123
docker logs managing-workers-TASK-123
```
### Clean Up All Task Environments
```bash
# List all task containers
docker ps -a | grep -E "postgres-|managing-api-|managing-workers-|redis-"
# Stop and remove all task containers
docker ps -a | grep -E "postgres-|managing-api-|managing-workers-|redis-" | awk '{print $1}' | xargs docker rm -f
# Remove all task volumes
docker volume ls | grep -E "postgresdata_|redis_data_" | awk '{print $2}' | xargs docker volume rm
```
## Best Practices
1. **Use descriptive task IDs**: `TASK-123`, `FEATURE-456`, `BUGFIX-789`
2. **Stop environments when done**: Frees up resources
3. **Use port offsets for parallel testing**: Test multiple tasks simultaneously
4. **Check port availability**: Before starting, verify ports aren't in use
5. **Monitor resource usage**: Each environment uses memory and CPU
## Architecture
```
Main Environment (localhost:5432)
├── PostgreSQL (main database)
└── InfluxDB (shared)
Task Environment (offset ports)
├── PostgreSQL (isolated, copied from main)
├── Redis (isolated)
├── API Container (connects to task PostgreSQL, main InfluxDB)
└── Workers Container (connects to task PostgreSQL, main InfluxDB)
```
## Next Steps
1. Install Vibe Kanban: See `docs/INSTALL_VIBE_KANBAN_AND_DEV_MANAGER.md`
2. Install dev-manager-mcp: See `docs/INSTALL_VIBE_KANBAN_AND_DEV_MANAGER.md`
3. Configure agent command: See `.cursor/commands/start-dev-env.md`

View File

@@ -0,0 +1,89 @@
# Vibe Kanban Dev Server Script Configuration
## The Problem
Vibe Kanban runs the dev server script from a different working directory than expected, causing "No such file or directory" errors.
## Solution: Use Absolute Path
In the Vibe Kanban dev server script field, use the **absolute path** to the wrapper script:
```bash
bash /Users/oda/Desktop/Projects/managing-apps/scripts/vibe-dev-server.sh
```
## Alternative: If Relative Path is Required
If Vibe Kanban requires a relative path and you know it runs from `/Users/oda/Desktop`, use:
```bash
bash Projects/managing-apps/scripts/vibe-dev-server.sh
```
## What the Wrapper Script Does
The `vibe-dev-server.sh` wrapper script:
1. ✅ Uses absolute paths internally
2. ✅ Changes to the correct project directory
3. ✅ Handles task ID parameters
4. ✅ Works regardless of Vibe Kanban's working directory
5. ✅ Provides debug output to help troubleshoot
## Testing the Script
You can test the script manually:
```bash
# From any directory
bash /Users/oda/Desktop/Projects/managing-apps/scripts/vibe-dev-server.sh TEST-001 0
```
## Debug Output
The script includes debug output that shows:
- Current working directory
- Script path being used
- Task ID and port offset
This helps identify if Vibe Kanban is running from an unexpected directory.
## Troubleshooting
### Error: "Script not found"
1. Verify the script exists:
```bash
ls -la /Users/oda/Desktop/Projects/managing-apps/scripts/vibe-dev-server.sh
```
2. Check permissions:
```bash
chmod +x /Users/oda/Desktop/Projects/managing-apps/scripts/vibe-dev-server.sh
```
3. Try running it directly:
```bash
bash /Users/oda/Desktop/Projects/managing-apps/scripts/vibe-dev-server.sh TEST-001
```
### Error: "Cannot change to project root"
- Verify the project root exists: `/Users/oda/Desktop/Projects/managing-apps`
- Check directory permissions
## Configuration in Vibe Kanban
**Dev Server Script Field:**
```
bash /Users/oda/Desktop/Projects/managing-apps/scripts/vibe-dev-server.sh
```
**Health Check URL:**
```
http://localhost:{port}/health
```
**Port Detection:**
Vibe Kanban should detect the port from the script output or you may need to configure it manually.

View File

@@ -0,0 +1,125 @@
# Vibe Kanban Project Settings Configuration
## Settings URL
http://127.0.0.1:63100/settings/projects?projectId=1a4fdbff-8b23-49d5-9953-2476846cbcc2
## Configuration Steps
### 1. MCP Servers Configuration
In the **MCP Servers** section, add or verify:
**Server Name:** `dev-manager`
**Configuration:**
```json
{
"command": "npx",
"args": ["dev-manager-mcp", "stdio"]
}
```
This enables Vibe Kanban to use dev-manager-mcp for managing multiple dev server instances.
### 2. QA / Testing Configuration
In the **QA** or **Testing** section, configure:
**Enable QA Automation:** ✅ Checked
**Dev Environment Script:**
```
managing-apps/scripts/vibe-dev-server.sh
```
**Or use absolute path:**
```
/Users/oda/Desktop/Projects/managing-apps/scripts/vibe-dev-server.sh
```
**Note:** This path is relative to `/Users/oda/Desktop/Projects` (the Projects folder root)
**Health Check URL:**
```
http://localhost:{port}/health
```
**Dashboard URL (optional):**
```
http://localhost:{port}
```
### 3. Task Status Configuration
Configure which task statuses should auto-start dev environments:
**Status:** `ready-for-qa`
**Auto-start dev environment:** ✅ Enabled
This means when a task moves to "Ready for QA" status, Vibe Kanban will automatically:
1. Call `managing-apps/scripts/start-task-docker.sh` with the task ID
2. Wait for the environment to be ready
3. Provide the test URLs
4. Stop the environment when the task is completed
### 4. Project Root
**Project Root Path:**
```
/Users/oda/Desktop/Projects/managing-apps
```
This should be automatically detected from the `.vibe-kanban/config.json` file location.
## Complete Configuration Summary
Here's what should be configured:
### MCP Servers
-`dev-manager``npx dev-manager-mcp stdio`
### QA Settings
- ✅ Auto-start dev environments: **Enabled**
- ✅ Script: `managing-apps/scripts/start-task-docker.sh`
- ✅ Health check: `http://localhost:{port}/health`
- ✅ Dashboard: `http://localhost:{port}`
### Task Statuses
-`ready-for-qa` → Auto-start dev environment: **Enabled**
## Verification
After configuration, test by:
1. **Create a test task** in managing-apps project
2. **Move it to "Ready for QA"** status
3. **Verify** that Vibe Kanban automatically:
- Starts a Docker environment
- Copies the database
- Provides test URLs
- Shows the environment status
## Troubleshooting
### Script Not Found
- Verify the script path is relative to Projects folder: `managing-apps/scripts/start-task-docker.sh`
- Check that the script is executable: `chmod +x managing-apps/scripts/start-task-docker.sh`
### MCP Server Not Working
- Ensure dev-manager-mcp daemon is running: `npm run dev-manager:start` (in Projects folder)
- Check MCP server configuration matches exactly
### Environment Not Starting
- Check Docker is running
- Verify main database is accessible at localhost:5432
- Check script logs in Vibe Kanban
## Script Path Reference
Since Vibe Kanban runs from `/Users/oda/Desktop/Projects`, all script paths should be relative to that:
-`managing-apps/scripts/start-task-docker.sh`
-`managing-apps/scripts/stop-task-docker.sh`
-`managing-apps/scripts/copy-database-for-task.sh`

View File

@@ -0,0 +1,99 @@
# Vibe Kanban Quick Start
Quick reference for using Vibe Kanban with managing-apps.
## Installation
No installation needed! Vibe Kanban runs via `npx`.
## Starting Vibe Kanban
**From Projects folder** (recommended - manages all projects):
```bash
cd /Users/oda/Desktop/Projects
npm run vibe-kanban
```
Or directly:
```bash
cd /Users/oda/Desktop/Projects
npx vibe-kanban
```
**Alternative: From managing-apps folder** (project-specific):
```bash
cd /Users/oda/Desktop/Projects/managing-apps
npx vibe-kanban
```
## First Time Setup
1. **Start Vibe Kanban:**
```bash
npm run vibe-kanban
```
2. **Complete setup dialogs:**
- Configure your coding agent (Claude, Codex, etc.)
- Set editor preferences
- Configure GitHub integration (optional)
3. **Access the UI:**
- Vibe Kanban will print a URL in the terminal
- Usually: http://localhost:3000 (or random port)
- Automatically opens in your default browser
## Configuration
Project-specific configuration is in `.vibe-kanban/config.json`:
- **MCP Servers**: dev-manager-mcp integration
- **QA Automation**: Auto-start dev environments
- **Task Statuses**: Configure when to auto-start environments
## Using with Dev Environments
When a task moves to "Ready for QA":
1. Vibe Kanban automatically calls `scripts/start-task-docker.sh`
2. Creates isolated Docker environment
3. Copies database from main repo
4. Provides test URLs
5. When done, automatically stops the environment
## Commands
```bash
# Start Vibe Kanban
npm run vibe-kanban
# Start dev-manager-mcp daemon (in separate terminal)
npm run dev-manager:start
# Check dev-manager status
npm run dev-manager:status
# Start dev environment manually
npm run dev-env:start
# Stop dev environment
npm run dev-env:stop TASK-123
```
## Fixed Port
To use a fixed port:
```bash
PORT=8080 npm run vibe-kanban
```
## Resources
- [Official Documentation](https://www.vibekanban.com/docs/getting-started)
- [GitHub Repository](https://github.com/BloopAI/vibe-kanban)
- [MCP Integration Guide](docs/INSTALL_VIBE_KANBAN_AND_DEV_MANAGER.md)

View File

@@ -0,0 +1,73 @@
# Vibe Kanban Setup Summary
## ✅ Setup Complete!
Vibe Kanban is configured at the **Projects level** to manage multiple projects (managing-apps, kaigen-web, gmx-interface, etc.).
## File Locations
- **Config**: `/Users/oda/Desktop/Projects/.vibe-kanban/config.json`
- **Package.json**: `/Users/oda/Desktop/Projects/package.json`
- **Run from**: `/Users/oda/Desktop/Projects`
## Quick Start
### Start Vibe Kanban (from Projects folder)
```bash
cd /Users/oda/Desktop/Projects
npm run vibe-kanban
```
This will:
- Auto-discover all projects in `/Users/oda/Desktop/Projects`
- Show managing-apps, kaigen-web, gmx-interface, etc.
- Allow you to manage tasks across all projects
### Start dev-manager-mcp (in separate terminal)
```bash
cd /Users/oda/Desktop/Projects
npm run dev-manager:start
```
## Benefits of Projects-Level Setup
**Access all projects** from one Vibe Kanban instance
**Centralized configuration** for MCP servers
**Cross-project task management**
**Unified QA workflow** across projects
**Auto-discovery** of all git projects
**Project-specific dev environments** - Each project can have its own dev environment setup
## Project-Specific Scripts
For managing-apps specific tasks, scripts are in the project:
```bash
cd /Users/oda/Desktop/Projects/managing-apps
npm run dev-env:start # Start dev environment
npm run dev-env:stop # Stop dev environment
```
## Configuration
The Projects-level config references project-specific scripts:
```json
{
"projectRoot": "/Users/oda/Desktop/Projects",
"devEnvScript": "managing-apps/scripts/start-task-docker.sh"
}
```
When Vibe Kanban starts a dev environment for a managing-apps task, it uses the script path relative to the Projects folder.
For other projects, you can configure project-specific dev environment scripts in Vibe Kanban's project settings.
## Next Steps
1. ✅ Vibe Kanban config created at Projects level
2. ✅ Package.json created with convenience scripts
3. ✅ Auto-discovery enabled for all projects
4. 🚀 **Start Vibe Kanban**: `cd /Users/oda/Desktop/Projects && npm run vibe-kanban`

12
package.json Normal file
View File

@@ -0,0 +1,12 @@
{
"name": "managing-apps",
"version": "1.0.0",
"private": true,
"description": "Managing Apps Monorepo",
"scripts": {
"dev-env:start": "bash scripts/start-dev-env.sh",
"dev-env:stop": "bash scripts/stop-task-docker.sh"
},
"workspaces": []
}

124
scripts/copy-database-for-task.sh Executable file
View File

@@ -0,0 +1,124 @@
#!/bin/bash
# scripts/copy-database-for-task.sh
# Copies database from main repo to task-specific PostgreSQL instance
TASK_ID=$1
SOURCE_HOST=${2:-"localhost"}
SOURCE_PORT=${3:-"5432"}
TARGET_HOST=${4:-"localhost"}
TARGET_PORT=${5:-"5433"}
SOURCE_DB="managing"
# Convert to lowercase (compatible with bash 3.2+)
TARGET_DB="managing_$(echo "$TASK_ID" | tr '[:upper:]' '[:lower:]')"
ORLEANS_SOURCE_DB="orleans"
ORLEANS_TARGET_DB="orleans_$(echo "$TASK_ID" | tr '[:upper:]' '[:lower:]')"
DB_USER="postgres"
DB_PASSWORD="postgres"
set -e # Exit on error
echo "📦 Copying database for task: $TASK_ID"
echo " Source: $SOURCE_HOST:$SOURCE_PORT"
echo " Target: $TARGET_HOST:$TARGET_PORT"
# Wait for target PostgreSQL to be ready
echo "⏳ Waiting for target PostgreSQL..."
for i in {1..60}; do
if PGPASSWORD=$DB_PASSWORD psql -h $TARGET_HOST -p $TARGET_PORT -U $DB_USER -d postgres -c '\q' 2>/dev/null; then
echo "✅ Target PostgreSQL is ready"
break
fi
if [ $i -eq 60 ]; then
echo "❌ Target PostgreSQL not ready after 60 attempts"
exit 1
fi
sleep 1
done
# Verify source database is accessible
echo "🔍 Verifying source database..."
if ! PGPASSWORD=$DB_PASSWORD psql -h $SOURCE_HOST -p $SOURCE_PORT -U $DB_USER -d postgres -c '\q' 2>/dev/null; then
echo "❌ Cannot connect to source database at $SOURCE_HOST:$SOURCE_PORT"
exit 1
fi
# Create target databases (drop if exists for fresh copy)
echo "🗑️ Dropping existing target databases if they exist..."
PGPASSWORD=$DB_PASSWORD psql -h $TARGET_HOST -p $TARGET_PORT -U $DB_USER -d postgres -c "DROP DATABASE IF EXISTS \"$TARGET_DB\";" 2>/dev/null || true
PGPASSWORD=$DB_PASSWORD psql -h $TARGET_HOST -p $TARGET_PORT -U $DB_USER -d postgres -c "DROP DATABASE IF EXISTS \"$ORLEANS_TARGET_DB\";" 2>/dev/null || true
echo "📝 Creating target databases..."
PGPASSWORD=$DB_PASSWORD psql -h $TARGET_HOST -p $TARGET_PORT -U $DB_USER -d postgres -c "CREATE DATABASE \"$TARGET_DB\";"
PGPASSWORD=$DB_PASSWORD psql -h $TARGET_HOST -p $TARGET_PORT -U $DB_USER -d postgres -c "CREATE DATABASE \"$ORLEANS_TARGET_DB\";"
# Create temporary dump files
TEMP_DIR=$(mktemp -d)
MANAGING_DUMP="$TEMP_DIR/managing_${TASK_ID}.dump"
ORLEANS_DUMP="$TEMP_DIR/orleans_${TASK_ID}.dump"
# Dump source databases
echo "📤 Dumping source database: $SOURCE_DB..."
PGPASSWORD=$DB_PASSWORD pg_dump -h $SOURCE_HOST -p $SOURCE_PORT -U $DB_USER -Fc "$SOURCE_DB" > "$MANAGING_DUMP"
if [ ! -s "$MANAGING_DUMP" ]; then
echo "❌ Failed to dump source database $SOURCE_DB"
rm -rf "$TEMP_DIR"
exit 1
fi
echo "📤 Dumping Orleans database: $ORLEANS_SOURCE_DB..."
PGPASSWORD=$DB_PASSWORD pg_dump -h $SOURCE_HOST -p $SOURCE_PORT -U $DB_USER -Fc "$ORLEANS_SOURCE_DB" > "$ORLEANS_DUMP" 2>/dev/null || {
echo "⚠️ Orleans database not found, skipping..."
ORLEANS_DUMP=""
}
# Restore to target databases
echo "📥 Restoring to target database: $TARGET_DB..."
PGPASSWORD=$DB_PASSWORD pg_restore -h $TARGET_HOST -p $TARGET_PORT -U $DB_USER -d "$TARGET_DB" --no-owner --no-acl --clean --if-exists "$MANAGING_DUMP"
if [ $? -eq 0 ]; then
echo "✅ Successfully restored $TARGET_DB"
else
echo "❌ Failed to restore $TARGET_DB"
rm -rf "$TEMP_DIR"
exit 1
fi
if [ -n "$ORLEANS_DUMP" ] && [ -s "$ORLEANS_DUMP" ]; then
echo "📥 Restoring Orleans database: $ORLEANS_TARGET_DB..."
PGPASSWORD=$DB_PASSWORD pg_restore -h $TARGET_HOST -p $TARGET_PORT -U $DB_USER -d "$ORLEANS_TARGET_DB" --no-owner --no-acl --clean --if-exists "$ORLEANS_DUMP"
if [ $? -eq 0 ]; then
echo "✅ Successfully restored $ORLEANS_TARGET_DB"
# Clean Orleans membership tables to avoid conflicts with old silos
echo "🧹 Cleaning Orleans membership tables (removing old silo entries)..."
PGPASSWORD=$DB_PASSWORD psql -h $TARGET_HOST -p $TARGET_PORT -U $DB_USER -d "$ORLEANS_TARGET_DB" <<EOF
-- Clear membership tables to start fresh (Orleans uses lowercase table names)
TRUNCATE TABLE IF EXISTS orleansmembershiptable CASCADE;
TRUNCATE TABLE IF EXISTS orleansmembershipversiontable CASCADE;
-- Note: We keep reminder and storage tables as they may contain application data
EOF
if [ $? -eq 0 ]; then
echo "✅ Orleans membership tables cleaned"
else
echo "⚠️ Failed to clean Orleans membership tables (tables may not exist yet, which is OK)"
fi
else
echo "⚠️ Failed to restore Orleans database (non-critical)"
fi
else
# Even if no Orleans dump, create empty database for fresh start
echo "📝 Orleans database will be created fresh by Orleans framework"
fi
# Cleanup
rm -rf "$TEMP_DIR"
echo "✅ Database copy completed successfully"
echo " Managing DB: $TARGET_DB on port $TARGET_PORT"
echo " Orleans DB: $ORLEANS_TARGET_DB on port $TARGET_PORT"

82
scripts/create-task-compose.sh Executable file
View File

@@ -0,0 +1,82 @@
#!/bin/bash
# scripts/create-task-compose.sh
# Creates a task-specific Docker Compose file with all required environment variables
TASK_ID=$1
PORT_OFFSET=${2:-0}
POSTGRES_PORT=$((5432 + PORT_OFFSET))
API_PORT=$((5000 + PORT_OFFSET))
WORKER_PORT=$((5001 + PORT_OFFSET))
REDIS_PORT=$((6379 + PORT_OFFSET))
ORLEANS_SILO_PORT=$((11111 + PORT_OFFSET))
ORLEANS_GATEWAY_PORT=$((30000 + PORT_OFFSET))
# Convert to lowercase (compatible with bash 3.2+)
DB_NAME="managing_$(echo "$TASK_ID" | tr '[:upper:]' '[:lower:]')"
ORLEANS_DB_NAME="orleans_$(echo "$TASK_ID" | tr '[:upper:]' '[:lower:]')"
TASK_ID_LOWER="$(echo "$TASK_ID" | tr '[:upper:]' '[:lower:]')"
# Calculate unique task slot based on port offset (for Orleans clustering)
TASK_SLOT=$((PORT_OFFSET / 10 + 1))
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
COMPOSE_DIR="$PROJECT_ROOT/src/Managing.Docker"
COMPOSE_FILE="$COMPOSE_DIR/docker-compose.task-${TASK_ID}.yml"
# Escape function for Docker Compose environment variables
escape_env() {
echo "$1" | sed 's/\\/\\\\/g' | sed 's/\$/\\$/g' | sed 's/"/\\"/g'
}
cat > "$COMPOSE_FILE" << EOF
name: task-${TASK_ID_LOWER}
services:
postgres-${TASK_ID}:
image: postgres:17.5
container_name: postgres-${TASK_ID}
volumes:
- postgresdata_${TASK_ID}:/var/lib/postgresql/data
ports:
- "${POSTGRES_PORT}:5432"
restart: unless-stopped
networks:
- task-${TASK_ID}-network
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
redis-${TASK_ID}:
image: redis:8.0.3
container_name: redis-${TASK_ID}
ports:
- "${REDIS_PORT}:6379"
volumes:
- redis_data_${TASK_ID}:/data
networks:
- task-${TASK_ID}-network
restart: unless-stopped
environment:
- REDIS_PASSWORD=
volumes:
postgresdata_${TASK_ID}:
redis_data_${TASK_ID}:
networks:
task-${TASK_ID}-network:
driver: bridge
EOF
echo "✅ Created $COMPOSE_FILE"
echo " PostgreSQL: localhost:$POSTGRES_PORT"
echo " Redis: localhost:$REDIS_PORT"
echo " API will run via dotnet run on port: $API_PORT"
echo " Orleans Silo: localhost:$ORLEANS_SILO_PORT"
echo " Orleans Gateway: localhost:$ORLEANS_GATEWAY_PORT"
echo " InfluxDB: Using main instance at localhost:8086"
echo " Task Slot: $TASK_SLOT"

109
scripts/start-api-and-workers.sh Executable file
View File

@@ -0,0 +1,109 @@
#!/bin/bash
# scripts/start-api-and-workers.sh
# Starts API and Workers using dotnet run (not Docker)
# This script is called by start-task-docker.sh after database is ready
# IMPORTANT: This script runs from the current working directory (Vibe Kanban worktree)
TASK_ID=$1
PORT_OFFSET=${2:-0}
# Use Vibe Kanban worktree if available, otherwise use current directory
# This ensures we're running from the worktree, not the main repo
if [ -n "$VIBE_WORKTREE_ROOT" ] && [ -d "$VIBE_WORKTREE_ROOT/src/Managing.Api" ]; then
PROJECT_ROOT="$VIBE_WORKTREE_ROOT"
echo "📁 Using Vibe Kanban worktree: $PROJECT_ROOT"
else
PROJECT_ROOT="$(pwd)"
echo "📁 Using current directory: $PROJECT_ROOT"
fi
SCRIPT_DIR="$PROJECT_ROOT/scripts"
POSTGRES_PORT=$((5432 + PORT_OFFSET))
API_PORT=$((5000 + PORT_OFFSET))
REDIS_PORT=$((6379 + PORT_OFFSET))
ORLEANS_SILO_PORT=$((11111 + PORT_OFFSET))
ORLEANS_GATEWAY_PORT=$((30000 + PORT_OFFSET))
# Convert to lowercase (compatible with bash 3.2+)
DB_NAME="managing_$(echo "$TASK_ID" | tr '[:upper:]' '[:lower:]')"
ORLEANS_DB_NAME="orleans_$(echo "$TASK_ID" | tr '[:upper:]' '[:lower:]')"
# Calculate unique task slot based on port offset (for Orleans clustering)
TASK_SLOT=$((PORT_OFFSET / 10 + 1))
# PID files for process management
PID_DIR="$PROJECT_ROOT/.task-pids"
mkdir -p "$PID_DIR"
API_PID_FILE="$PID_DIR/api-${TASK_ID}.pid"
WORKERS_PID_FILE="$PID_DIR/workers-${TASK_ID}.pid"
# Set environment variables for API
export ASPNETCORE_ENVIRONMENT=Development
export ASPNETCORE_URLS="http://localhost:${API_PORT}"
export RUN_ORLEANS_GRAINS=true
export SILO_ROLE=Trading
export TASK_SLOT=${TASK_SLOT}
export PostgreSql__ConnectionString="Host=localhost;Port=${POSTGRES_PORT};Database=${DB_NAME};Username=postgres;Password=postgres"
export PostgreSql__Orleans="Host=localhost;Port=${POSTGRES_PORT};Database=${ORLEANS_DB_NAME};Username=postgres;Password=postgres"
export InfluxDb__Url="http://localhost:8086/"
export InfluxDb__Token="Fw2FPL2OwTzDHzSbR2Sd5xs0EKQYy00Q-hYKYAhr9cC1_q5YySONpxuf_Ck0PTjyUiF13xXmi__bu_pXH-H9zA=="
export Jwt__Secret="2ed5f490-b6c1-4cad-8824-840c911f1fe6"
export Privy__AppSecret="63Chz2z5M8TgR5qc8dznSLRAGTHTyPU4cjdQobrBF1Cx5tszZpTuFgyrRd7hZ2k6HpwDz3GEwQZzsCqHb8Z311bF"
export AdminUsers="did:privy:cm7vxs99f0007blcl8cmzv74t;did:privy:cmhp5jqs2014kl60cbunp57jh"
export AUTHORIZED_ADDRESSES="0x932167388dD9aad41149b3cA23eBD489E2E2DD78;0x84e3E147c4e94716151181F25538aBf337Eca49f;0xeaf2a9a5864e3Cc37E85dDC287Ed0c90d76b2420"
export ENABLE_COPY_TRADING_VALIDATION=false
export KAIGEN_CREDITS_ENABLED=false
export KAIGEN_SECRET_KEY="KaigenXCowchain"
export Flagsmith__ApiKey="ser.ShJJJMtWYS9fwuzd83ejwR"
export Discord__ApplicationId="966075382002516031"
export Discord__PublicKey="63028f6bb740cd5d26ae0340b582dee2075624011b28757436255fc002ca8a7c"
export Discord__TokenId="OTY2MDc1MzgyMDAyNTE2MDMx.Yl8dzw.xpeIAaMwGrwTNY4r9JYv0ebzb-U"
export N8n__WebhookUrl="https://n8n.kai.managing.live/webhook/fa9308b6-983b-42ec-b085-71599d655951"
export N8n__IndicatorRequestWebhookUrl="https://n8n.kai.managing.live/webhook/3aa07b66-1e64-46a7-8618-af300914cb11"
export N8n__Username="managing-api"
export N8n__Password="T259836*PdiV2@%!eR%Qf4"
export Sentry__Dsn="https://fe12add48c56419bbdfa86227c188e7a@glitch.kai.managing.live/1"
# Verify we're in the right directory (should have src/Managing.Api)
if [ ! -d "$PROJECT_ROOT/src/Managing.Api" ]; then
echo "❌ Error: src/Managing.Api not found in current directory: $PROJECT_ROOT"
echo "💡 Make sure you're running from the project root (or Vibe Kanban worktree)"
exit 1
fi
echo "🚀 Starting API on port $API_PORT..."
echo "📁 Running from: $PROJECT_ROOT"
cd "$PROJECT_ROOT/src/Managing.Api"
dotnet run > "$PID_DIR/api-${TASK_ID}.log" 2>&1 &
API_PID=$!
echo $API_PID > "$API_PID_FILE"
echo "✅ API started (PID: $API_PID) from worktree: $PROJECT_ROOT"
# Wait a bit for API to start
sleep 3
echo "🚀 Starting Workers..."
cd "$PROJECT_ROOT/src/Managing.Workers"
# Set workers environment variables (separate from API)
ASPNETCORE_ENVIRONMENT=Development \
PostgreSql__ConnectionString="Host=localhost;Port=${POSTGRES_PORT};Database=${DB_NAME};Username=postgres;Password=postgres" \
InfluxDb__Url="http://localhost:8086/" \
InfluxDb__Token="Fw2FPL2OwTzDHzSbR2Sd5xs0EKQYy00Q-hYKYAhr9cC1_q5YySONpxuf_Ck0PTjyUiF13xXmi__bu_pXH-H9zA==" \
KAIGEN_SECRET_KEY="KaigenXCowchain" \
Flagsmith__ApiKey="ser.ShJJJMtWYS9fwuzd83ejwR" \
dotnet run > "$PID_DIR/workers-${TASK_ID}.log" 2>&1 &
WORKERS_PID=$!
echo $WORKERS_PID > "$WORKERS_PID_FILE"
echo "✅ Workers started (PID: $WORKERS_PID) from worktree: $PROJECT_ROOT"
echo ""
echo "✅ API and Workers started!"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "📊 API: http://localhost:$API_PORT"
echo "📋 API PID: $API_PID"
echo "📋 Workers PID: $WORKERS_PID"
echo "📋 Logs: $PID_DIR/api-${TASK_ID}.log"
echo "📋 Logs: $PID_DIR/workers-${TASK_ID}.log"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

38
scripts/start-dev-env.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
# scripts/start-dev-env.sh
# Simple wrapper for dev agent to start Docker Compose task environments
TASK_ID=${1:-"DEV-$(date +%Y%m%d-%H%M%S)"}
PORT_OFFSET=${2:-0}
echo "🚀 Starting Docker dev environment..."
echo "📋 Task ID: $TASK_ID"
echo "🔌 Port Offset: $PORT_OFFSET"
echo ""
# Get script directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# Check prerequisites
echo "🔍 Checking prerequisites..."
# Check main database
if ! PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d managing -c '\q' 2>/dev/null; then
echo "❌ Main database not accessible at localhost:5432"
echo "💡 Starting main database..."
cd "$SCRIPT_DIR/../src/Managing.Docker"
docker-compose -f docker-compose.yml -f docker-compose.local.yml up -d postgres
echo "⏳ Waiting for database to start..."
sleep 15
fi
# Check Docker
if ! docker ps >/dev/null 2>&1; then
echo "❌ Docker is not running"
exit 1
fi
# Start task environment
echo "🚀 Starting task environment..."
bash "$SCRIPT_DIR/start-task-docker.sh" "$TASK_ID" "$PORT_OFFSET"

189
scripts/start-task-docker.sh Executable file
View File

@@ -0,0 +1,189 @@
#!/bin/bash
# scripts/start-task-docker.sh
# Starts a Docker Compose environment for a specific task with database copy
TASK_ID=$1
PORT_OFFSET=${2:-0}
# Determine project root
# If called from main repo, use current directory
# If called from worktree wrapper, we should be in main repo already
if [ -d "$(pwd)/scripts" ] && [ -f "$(pwd)/scripts/start-api-and-workers.sh" ]; then
# We're in the main repo
PROJECT_ROOT="$(pwd)"
echo "📁 Using main repository: $PROJECT_ROOT"
else
# Try to find main repo
MAIN_REPO="/Users/oda/Desktop/Projects/managing-apps"
if [ -d "$MAIN_REPO/scripts" ]; then
PROJECT_ROOT="$MAIN_REPO"
echo "📁 Using main repository: $PROJECT_ROOT"
else
echo "❌ Error: Cannot find main repository with scripts"
exit 1
fi
fi
SCRIPT_DIR="$PROJECT_ROOT/scripts"
# Auto-detect port offset if 0 is provided (to avoid conflicts with main database)
if [ "$PORT_OFFSET" = "0" ]; then
echo "🔍 Auto-detecting available port offset (to avoid conflicts with main database)..."
# Find an available port offset (start from 1, check up to 100)
PORT_OFFSET_FOUND=0
for offset in $(seq 1 100); do
POSTGRES_TEST=$((5432 + offset))
REDIS_TEST=$((6379 + offset))
API_TEST=$((5000 + offset))
ORLEANS_SILO_TEST=$((11111 + offset))
ORLEANS_GATEWAY_TEST=$((30000 + offset))
# Check if ports are available (try multiple methods for compatibility)
POSTGRES_FREE=true
REDIS_FREE=true
API_FREE=true
ORLEANS_SILO_FREE=true
ORLEANS_GATEWAY_FREE=true
# Method 1: lsof (macOS/Linux)
if command -v lsof >/dev/null 2>&1; then
if lsof -Pi :$POSTGRES_TEST -sTCP:LISTEN -t >/dev/null 2>&1; then
POSTGRES_FREE=false
fi
if lsof -Pi :$REDIS_TEST -sTCP:LISTEN -t >/dev/null 2>&1; then
REDIS_FREE=false
fi
if lsof -Pi :$API_TEST -sTCP:LISTEN -t >/dev/null 2>&1; then
API_FREE=false
fi
if lsof -Pi :$ORLEANS_SILO_TEST -sTCP:LISTEN -t >/dev/null 2>&1; then
ORLEANS_SILO_FREE=false
fi
if lsof -Pi :$ORLEANS_GATEWAY_TEST -sTCP:LISTEN -t >/dev/null 2>&1; then
ORLEANS_GATEWAY_FREE=false
fi
# Method 2: netstat (fallback)
elif command -v netstat >/dev/null 2>&1; then
if netstat -an | grep -q ":$POSTGRES_TEST.*LISTEN"; then
POSTGRES_FREE=false
fi
if netstat -an | grep -q ":$REDIS_TEST.*LISTEN"; then
REDIS_FREE=false
fi
if netstat -an | grep -q ":$API_TEST.*LISTEN"; then
API_FREE=false
fi
fi
# If all ports are free, use this offset
if [ "$POSTGRES_FREE" = "true" ] && [ "$REDIS_FREE" = "true" ] && [ "$API_FREE" = "true" ] && [ "$ORLEANS_SILO_FREE" = "true" ] && [ "$ORLEANS_GATEWAY_FREE" = "true" ]; then
PORT_OFFSET=$offset
PORT_OFFSET_FOUND=1
echo "✅ Found available port offset: $PORT_OFFSET"
echo " PostgreSQL: $POSTGRES_TEST"
echo " Redis: $REDIS_TEST"
echo " API: $API_TEST"
break
fi
done
if [ "$PORT_OFFSET_FOUND" = "0" ]; then
echo "❌ Could not find available port offset (checked offsets 1-100)"
echo "💡 Try manually specifying a port offset: bash $0 $TASK_ID 10"
exit 1
fi
fi
POSTGRES_PORT=$((5432 + PORT_OFFSET))
API_PORT=$((5000 + PORT_OFFSET))
REDIS_PORT=$((6379 + PORT_OFFSET))
# Convert to lowercase (compatible with bash 3.2+)
DB_NAME="managing_$(echo "$TASK_ID" | tr '[:upper:]' '[:lower:]')"
ORLEANS_DB_NAME="orleans_$(echo "$TASK_ID" | tr '[:upper:]' '[:lower:]')"
echo "🚀 Starting Docker environment for task: $TASK_ID"
echo "📊 Port offset: $PORT_OFFSET"
echo "📊 PostgreSQL: localhost:$POSTGRES_PORT"
echo "🔌 API: http://localhost:$API_PORT"
echo "💾 Redis: localhost:$REDIS_PORT"
echo "💾 Database: $DB_NAME"
# Verify main database is accessible
echo "🔍 Verifying main database connection..."
if ! PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d managing -c '\q' 2>/dev/null; then
echo "❌ Cannot connect to main database at localhost:5432"
echo "💡 Starting main database..."
cd "$PROJECT_ROOT/src/Managing.Docker"
# Use docker compose (newer) or docker-compose (older)
if command -v docker &> /dev/null && docker compose version &> /dev/null; then
docker compose -f docker-compose.yml -f docker-compose.local.yml up -d postgres
else
docker-compose -f docker-compose.yml -f docker-compose.local.yml up -d postgres
fi
echo "⏳ Waiting for database to start..."
sleep 15
fi
# Create compose file
echo "📝 Creating Docker Compose file..."
bash "$SCRIPT_DIR/create-task-compose.sh" "$TASK_ID" "$PORT_OFFSET"
COMPOSE_FILE="$PROJECT_ROOT/src/Managing.Docker/docker-compose.task-${TASK_ID}.yml"
# Start services (except API/Workers - we'll start them after DB copy)
echo "🐳 Starting PostgreSQL, Redis..."
cd "$PROJECT_ROOT/src/Managing.Docker"
# Use docker compose (newer) or docker-compose (older)
if command -v docker &> /dev/null && docker compose version &> /dev/null; then
docker compose -f "$COMPOSE_FILE" up -d postgres-${TASK_ID} redis-${TASK_ID}
else
docker-compose -f "$COMPOSE_FILE" up -d postgres-${TASK_ID} redis-${TASK_ID}
fi
# Wait for PostgreSQL
echo "⏳ Waiting for PostgreSQL..."
for i in {1..60}; do
if PGPASSWORD=postgres psql -h localhost -p $POSTGRES_PORT -U postgres -d postgres -c '\q' 2>/dev/null; then
echo "✅ PostgreSQL is ready"
break
fi
if [ $i -eq 60 ]; then
echo "❌ PostgreSQL not ready after 60 attempts"
if command -v docker &> /dev/null && docker compose version &> /dev/null; then
docker compose -f "$COMPOSE_FILE" down
else
docker-compose -f "$COMPOSE_FILE" down
fi
exit 1
fi
sleep 2
done
# Copy database
echo "📦 Copying database from main repo..."
bash "$SCRIPT_DIR/copy-database-for-task.sh" "$TASK_ID" "localhost" "5432" "localhost" "$POSTGRES_PORT"
if [ $? -eq 0 ]; then
# Start API and Workers using dotnet run
echo "🚀 Starting API and Workers with dotnet run..."
bash "$SCRIPT_DIR/start-api-and-workers.sh" "$TASK_ID" "$PORT_OFFSET"
echo ""
echo "✅ Environment ready!"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "📊 API: http://localhost:$API_PORT"
echo "💾 Database: $DB_NAME on port $POSTGRES_PORT"
echo "💾 Redis: localhost:$REDIS_PORT"
echo "🔧 To view API logs: tail -f .task-pids/api-${TASK_ID}.log"
echo "🔧 To view Workers logs: tail -f .task-pids/workers-${TASK_ID}.log"
echo "🔧 To stop: bash scripts/stop-task-docker.sh $TASK_ID"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
else
echo "❌ Database copy failed"
if command -v docker &> /dev/null && docker compose version &> /dev/null; then
docker compose -f "$COMPOSE_FILE" down
else
docker-compose -f "$COMPOSE_FILE" down
fi
exit 1
fi

82
scripts/stop-task-docker.sh Executable file
View File

@@ -0,0 +1,82 @@
#!/bin/bash
# scripts/stop-task-docker.sh
# Stops and cleans up a task-specific Docker Compose environment and dotnet processes
TASK_ID=$1
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
COMPOSE_DIR="$PROJECT_ROOT/src/Managing.Docker"
COMPOSE_FILE="$COMPOSE_DIR/docker-compose.task-${TASK_ID}.yml"
PID_DIR="$PROJECT_ROOT/.task-pids"
API_PID_FILE="$PID_DIR/api-${TASK_ID}.pid"
WORKERS_PID_FILE="$PID_DIR/workers-${TASK_ID}.pid"
if [ -z "$TASK_ID" ]; then
echo "❌ Usage: $0 <TASK_ID>"
exit 1
fi
echo "🛑 Stopping environment for task: $TASK_ID"
# Stop dotnet processes (API and Workers)
if [ -f "$API_PID_FILE" ]; then
API_PID=$(cat "$API_PID_FILE")
if ps -p "$API_PID" > /dev/null 2>&1; then
echo "🛑 Stopping API (PID: $API_PID)..."
kill "$API_PID" 2>/dev/null || true
sleep 2
# Force kill if still running
if ps -p "$API_PID" > /dev/null 2>&1; then
kill -9 "$API_PID" 2>/dev/null || true
fi
echo "✅ API stopped"
fi
rm -f "$API_PID_FILE"
fi
if [ -f "$WORKERS_PID_FILE" ]; then
WORKERS_PID=$(cat "$WORKERS_PID_FILE")
if ps -p "$WORKERS_PID" > /dev/null 2>&1; then
echo "🛑 Stopping Workers (PID: $WORKERS_PID)..."
kill "$WORKERS_PID" 2>/dev/null || true
sleep 2
# Force kill if still running
if ps -p "$WORKERS_PID" > /dev/null 2>&1; then
kill -9 "$WORKERS_PID" 2>/dev/null || true
fi
echo "✅ Workers stopped"
fi
rm -f "$WORKERS_PID_FILE"
fi
# Clean up log files
rm -f "$PID_DIR/api-${TASK_ID}.log" "$PID_DIR/workers-${TASK_ID}.log" 2>/dev/null || true
# Stop Docker services (PostgreSQL and Redis)
cd "$COMPOSE_DIR"
if [ -f "$COMPOSE_FILE" ]; then
echo "🛑 Stopping Docker services..."
if command -v docker &> /dev/null && docker compose version &> /dev/null; then
docker compose -f "$COMPOSE_FILE" down -v
else
docker-compose -f "$COMPOSE_FILE" down -v
fi
rm -f "$COMPOSE_FILE"
echo "✅ Docker services stopped"
else
echo "⚠️ Compose file not found: $COMPOSE_FILE"
echo "💡 Trying to stop containers manually..."
# Try to stop containers by name pattern
docker stop postgres-${TASK_ID} redis-${TASK_ID} 2>/dev/null || true
docker rm postgres-${TASK_ID} redis-${TASK_ID} 2>/dev/null || true
# Remove volumes
docker volume rm postgresdata_${TASK_ID} redis_data_${TASK_ID} 2>/dev/null || true
echo "✅ Docker cleanup attempted"
fi
echo "✅ Environment stopped and cleaned up"

58
scripts/vibe-dev-server.sh Executable file
View File

@@ -0,0 +1,58 @@
#!/bin/bash
# scripts/vibe-dev-server.sh
# Minimal script for Vibe Kanban worktrees
# This script runs from the worktree and uses main repo scripts for Docker setup
TASK_ID=${1:-"DEV-$(date +%Y%m%d-%H%M%S)"}
PORT_OFFSET=${2:-0}
# Detect worktree root
WORKTREE_ROOT="$(pwd)"
# Check if we're in a nested structure (Vibe Kanban worktree)
if [ -d "$WORKTREE_ROOT/managing-apps" ] && [ -d "$WORKTREE_ROOT/managing-apps/src/Managing.Api" ]; then
WORKTREE_PROJECT_ROOT="$WORKTREE_ROOT/managing-apps"
elif [ -d "$WORKTREE_ROOT/src/Managing.Api" ]; then
WORKTREE_PROJECT_ROOT="$WORKTREE_ROOT"
else
echo "❌ Cannot find project structure in worktree"
echo " Current directory: $WORKTREE_ROOT"
exit 1
fi
echo "📁 Worktree project root: $WORKTREE_PROJECT_ROOT"
# Find main repository (try common locations)
MAIN_REPO_PATHS=(
"/Users/oda/Desktop/Projects/managing-apps"
"$(git -C "$WORKTREE_PROJECT_ROOT" rev-parse --show-toplevel 2>/dev/null || echo '')"
"$(dirname "$WORKTREE_ROOT" 2>/dev/null)/managing-apps"
)
MAIN_REPO=""
for path in "${MAIN_REPO_PATHS[@]}"; do
if [ -n "$path" ] && [ -d "$path" ] && [ -d "$path/scripts" ] && [ -f "$path/scripts/start-task-docker.sh" ]; then
MAIN_REPO="$path"
break
fi
done
if [ -z "$MAIN_REPO" ]; then
echo "❌ Cannot find main repository with scripts"
echo "💡 Tried:"
for path in "${MAIN_REPO_PATHS[@]}"; do
echo " - $path"
done
exit 1
fi
echo "📁 Main repository: $MAIN_REPO"
echo "🚀 Starting dev environment..."
echo " Task ID: $TASK_ID"
echo " Port offset: $PORT_OFFSET"
# Export worktree path so main repo scripts know where to run dotnet from
export VIBE_WORKTREE_ROOT="$WORKTREE_PROJECT_ROOT"
# Call main repo's start script
bash "$MAIN_REPO/scripts/start-task-docker.sh" "$TASK_ID" "$PORT_OFFSET"

BIN
src/.DS_Store vendored

Binary file not shown.

BIN
src/Managing.ABI.GmxV2/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/Managing.Api/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -35,6 +35,7 @@
<PackageReference Include="xunit" Version="2.8.0"/>
<PackageReference Include="Polly" Version="8.4.0"/>
<PackageReference Include="Polly.Extensions.Http" Version="3.0.0"/>
<PackageReference Include="DotNetEnv" Version="3.1.1"/>
</ItemGroup>
<ItemGroup>

View File

@@ -29,6 +29,46 @@ using Serilog.Events;
using Serilog.Sinks.Elasticsearch;
using OpenApiSecurityRequirement = Microsoft.OpenApi.Models.OpenApiSecurityRequirement;
using OpenApiSecurityScheme = NSwag.OpenApiSecurityScheme;
using DotNetEnv;
// Optionally load .env file if it exists (primarily for Vibe Kanban worktrees)
// This is optional - if no .env file exists, the app will use system env vars and appsettings.json
// This must happen before WebApplication.CreateBuilder to ensure env vars are available
var enableEnvFile = Environment.GetEnvironmentVariable("ENABLE_ENV_FILE") != "false"; // Can be disabled via env var
if (enableEnvFile)
{
// Try multiple locations: current directory, project root, and solution root
var envFilePaths = new[]
{
Path.Combine(Directory.GetCurrentDirectory(), ".env"), // Current working directory
Path.Combine(AppContext.BaseDirectory, ".env"), // Executable directory
Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", ".env")), // Project root (from bin/Debug/net8.0)
Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), ".env")), // Current directory (absolute)
};
string? loadedEnvPath = null;
foreach (var envPath in envFilePaths)
{
if (File.Exists(envPath))
{
try
{
Env.Load(envPath);
loadedEnvPath = envPath;
Console.WriteLine($"✅ Loaded .env file from: {envPath} (optional - for Vibe Kanban worktrees)");
break;
}
catch (Exception ex)
{
Console.WriteLine($"⚠️ Failed to load .env file from {envPath}: {ex.Message}");
}
}
}
// Silently continue if no .env file found - this is expected in normal operation
// .env file is only needed for Vibe Kanban worktrees
}
// Builder
var builder = WebApplication.CreateBuilder(args);

Binary file not shown.

Binary file not shown.

BIN
src/Managing.Application/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/Managing.Bootstrap/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/Managing.Common/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/Managing.Core/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/Managing.Domain.Tests/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/Managing.Domain/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
src/Managing.Tools.ABI/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/Managing.Workers.Tests/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/Managing.Workers/.DS_Store vendored Normal file

Binary file not shown.