spr migrated books, and tester

This commit is contained in:
buenosairesam
2025-12-31 09:07:27 -03:00
parent 21b8eab3cb
commit cccc6b5a93
136 changed files with 15763 additions and 472 deletions

View File

@@ -2,7 +2,7 @@
## Purpose
Mainroom orchestrates the interaction between **soleprint** and **managed rooms** (external projects like amar).
Mainroom orchestrates **soleprint + managed rooms** together (e.g., amar).
Key principle: Connect soleprint to managed apps **without modifying either side**.
@@ -10,130 +10,136 @@ Key principle: Connect soleprint to managed apps **without modifying either side
```
mainroom/
├── CLAUDE.md # You are here
├── ctrl/ # Orchestration commands
│ ├── start.sh # Start services (sets env vars)
│ ├── stop.sh # Stop services
│ ├── build.sh # Build images
│ ├── logs.sh # View logs
│ ├── status.sh # Show status
│ ├── deploy.sh # Deploy to server
│ └── server/ # Server setup scripts
├── sbwrapper/ # Sidebar wrapper UI
│ ├── index.html # Wrapper shell
│ ├── sidebar.css # Styling
│ ├── sidebar.js # Logic
│ └── config.json # Per-room configuration
├── link/ # Adapter layer
│ ├── main.py # FastAPI service
│ ├── Dockerfile
├── amar -> ../cfg/amar # Symlink to room config
├── soleprint/ # Soleprint Docker config
│ ├── docker-compose.yml
── adapters/ # Framework-specific adapters
├── __init__.py # BaseAdapter interface
│ └── django.py # Django adapter (for amar)
└── soleprint/ # Docker configs for soleprint services
── docker-compose.yml
├── docker-compose.nginx.yml
── Dockerfile.fastapi
── docker-compose.nginx.yml
└── .env
├── sbwrapper/ # Sidebar wrapper UI
├── config.json # Room-specific (users, Jira)
│ ├── sidebar.js
── sidebar.css
└── ctrl/ # Orchestration scripts
── start.sh # Start all services
├── stop.sh
├── deploy.sh # Deploy to AWS
└── server/ # AWS setup scripts
```
## Usage
### Local Development
```bash
# First, build soleprint
cd spr/
python build.py dev --cfg amar
# Create shared network
docker network create soleprint_network
# Start everything
cd mainroom/ctrl
./start.sh -d # Detached
./start.sh # Foreground (logs)
./start.sh amar # Only amar
./start.sh soleprint # Only soleprint
./stop.sh # Stop all
```
### Deploy to AWS
```bash
cd mainroom/ctrl
./deploy.sh --dry-run # Preview
./deploy.sh # Deploy
```
## Components
### ctrl/ - Orchestration Commands
Scripts that set env vars and start/stop services. The managed project works with its own defaults; ctrl sets overrides for orchestration.
### ctrl/ - Orchestration
| Script | Purpose |
|--------|---------|
| start.sh | Start amar + soleprint |
| stop.sh | Stop all |
| deploy.sh | rsync to AWS |
| server/ | AWS setup scripts |
```bash
./ctrl/start.sh # Start soleprint + link
./ctrl/start.sh --with-nginx # Start with nginx proxy
./ctrl/stop.sh # Stop all
./ctrl/logs.sh # View logs
./ctrl/status.sh # Show status
```
### soleprint/ - Docker Config
Uses `SOLEPRINT_BARE_PATH` to mount gen/ into container.
### sbwrapper/ - Sidebar Wrapper UI
Collapsible sidebar overlay for ANY managed app. Provides dev tools without interfering with the managed application.
**Env vars:**
- `SOLEPRINT_BARE_PATH` - Path to gen/
- `DEPLOYMENT_NAME` - Container prefix
- `NETWORK_NAME` - Docker network (soleprint_network)
- `SOLEPRINT_PORT` - Default 12000
### sbwrapper/ - Sidebar Wrapper
Collapsible sidebar overlay for managed apps.
**Features:**
- Quick login panel (switch test users)
- Jira ticket info panel
- Quick login (switch test users)
- Jira ticket info
- Environment info
- Collapsible, resizable
- Keyboard shortcut: `Ctrl+Shift+P`
- Keyboard: `Ctrl+Shift+P`
**Implementation:** HTML injection via nginx reverse proxy or iframe approach.
### link/ - Adapter Layer
Framework-agnostic data navigation between soleprint and managed apps.
**Pattern:**
```
Managed App (DB) ←── link adapters ──→ Soleprint (Station tools)
```
**Endpoints:**
- `GET /health` - Health check
- `GET /api/queries` - List available queries
- `GET /api/navigate?query=<name>` - Execute predefined query
- `GET /api/navigate?entity=<type>&id=<id>` - Entity navigation
**JSON Contract:**
**config.json:**
```json
{
"nodes": [{"id": "User_123", "type": "User", "label": "john", "data": {...}}],
"edges": [{"from": "User_123", "to": "Pet_456", "label": "owns"}],
"summary": {"title": "User #123", "fields": {...}}
"room_name": "amar",
"wrapper": {
"users": [
{"id": "admin", "label": "Admin", "username": "admin@test.com", ...}
],
"jira": {"ticket_id": "VET-535"}
}
}
```
### soleprint/ - Docker Configs
Docker compose files for running soleprint services (hub, artery, atlas, station).
**Environment Variables:**
- `SOLEPRINT_BARE_PATH` - Path to soleprint source (gen/)
- `DEPLOYMENT_NAME` - Container prefix
- `NETWORK_NAME` - Docker network name
- `SOLEPRINT_PORT`, `ARTERY_PORT`, `ATLAS_PORT`, `STATION_PORT`
### amar/ - Room Symlink
Points to `../cfg/amar` which contains:
- docker-compose.yml
- .env
- Dockerfile.backend, Dockerfile.frontend
- databrowse/depot/, tester/tests/, monitors/, models/
## How It Works
1. **ctrl/** sets environment variables for orchestration
2. **soleprint/** docker configs use those vars to mount code and expose ports
3. **link/** connects to managed app's database via adapters
4. **sbwrapper/** overlays UI on managed app via nginx injection
The managed project is never modified - it runs with its own defaults, mainroom just provides the orchestration layer on top.
1. `build.py dev --cfg amar` creates gen/ with room config
2. `mainroom/amar` symlinks to `cfg/amar`
3. `ctrl/start.sh` finds docker-compose.yml in amar/ and soleprint/
4. Both share `soleprint_network` for inter-container communication
5. sbwrapper overlays UI on managed app
## Ports
| Service | Port |
|---------|------|
| Soleprint Hub | 12000 |
| Artery | 12001 |
| Atlas | 12002 |
| Station | 12003 |
| Link | 8100 |
| Soleprint | 12000 |
| Amar Backend | 8000 |
| Amar Frontend | 3000 |
## Adding a New Managed Room
## Integration with ppl/
1. Create adapter in `link/adapters/` (implement BaseAdapter)
2. Configure `sbwrapper/config.json` with room-specific users, Jira ticket, etc.
3. Set env vars in ctrl scripts pointing to managed app
4. Run `./ctrl/start.sh`
Deploy via ppl/ctrl for centralized infrastructure management:
```bash
cd /home/mariano/wdir/ppl/ctrl
./deploy-gen.sh # Build spr + deploy
./dns.sh add soleprint # Add DNS record
```
## Worktrees
## Server Structure (mcrn.ar)
Feature development:
- `/home/mariano/wdir/wts/spr/sbwrapper` - Sidebar wrapper development
- `/home/mariano/wdir/wts/spr/databrowse` - Data browser tool
```
~/mainroom/
├── amar/ # Amar Docker services
├── soleprint/ # Soleprint Docker services
└── ctrl/ # Server-side scripts
```
## External References
## External Paths
| What | Location |
|------|----------|
| Soleprint source | `../` (parent directory) |
| Amar backend | `/home/mariano/wdir/ama/amar_django_back` |
| Amar frontend | `/home/mariano/wdir/ama/amar_frontend` |
| Core room (legacy) | `/home/mariano/wdir/ama/core_room` |
| What | Path |
|------|------|
| Amar Backend | /home/mariano/wdir/ama/amar_django_back |
| Amar Frontend | /home/mariano/wdir/ama/amar_frontend |
| Soleprint gen | /home/mariano/wdir/spr/gen |
| Pipelines | /home/mariano/wdir/ppl |

1
mainroom/amar Symbolic link
View File

@@ -0,0 +1 @@
../cfg/amar

View File

@@ -1,8 +1,8 @@
#!/bin/bash
# Deploy core_room to server
# Deploy mainroom to server (amar + soleprint)
#
# Two deployment modes:
# 1. Docker (default): Full core_room structure + source code
# 1. Docker (default): Full mainroom structure + source code
# 2. Bare metal (--bare-metal): Only soleprint source to systemd services
#
# Usage:
@@ -18,13 +18,13 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
source "$SCRIPT_DIR/.env.sync" 2>/dev/null || true
SERVER="${DEPLOY_SERVER:-mariano@mcrn.ar}"
REMOTE_PATH="${DEPLOY_REMOTE_PATH:-~/core_room}"
REMOTE_PATH="${DEPLOY_REMOTE_PATH:-~/mainroom}"
BARE_METAL_PATH="${DEPLOY_BARE_METAL_PATH:-~/soleprint}"
# Source code paths (defaults if not in .env.sync)
LOCAL_AMAR_BACKEND="${LOCAL_AMAR_BACKEND:-$HOME/wdir/ama/amar_django_back}"
LOCAL_AMAR_FRONTEND="${LOCAL_AMAR_FRONTEND:-$HOME/wdir/ama/amar_frontend}"
LOCAL_SOLEPRINT="${LOCAL_SOLEPRINT:-$HOME/wdir/ama/soleprint}"
LOCAL_SOLEPRINT="${LOCAL_SOLEPRINT:-$HOME/wdir/spr/gen}"
DRY_RUN=""
BARE_METAL=""
@@ -84,8 +84,8 @@ fi
echo "=== Deploying to Docker ==="
echo ""
# 1. Sync core_room structure (excluding src directories - they're synced separately)
echo "1. Syncing core_room structure..."
# 1. Sync mainroom structure (excluding src directories - they're synced separately)
echo "1. Syncing mainroom structure..."
$RSYNC_CMD $DRY_RUN \
--exclude='*/src/' \
./ \

View File

@@ -1,5 +1,5 @@
#!/bin/bash
# Start core_room services
# Start mainroom services (amar + soleprint)
#
# Usage:
# ./start.sh # Start all (foreground, see logs)
@@ -14,7 +14,7 @@ set -e
# Change to parent directory (services are in ../service_name)
cd "$(dirname "$0")/.."
# Export core_room/.env vars so child docker-compose files can use them
# Export mainroom/.env vars so child docker-compose files can use them
if [ -f ".env" ]; then
set -a
source .env
@@ -98,5 +98,5 @@ if [ -n "$DETACH" ]; then
echo ""
echo "=== Services Started ==="
echo ""
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" | grep -E "(core_room|NAMES)"
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" | grep -E "(mainroom|amar|soleprint|NAMES)"
fi

View File

@@ -1,6 +1,6 @@
# Soleprint Wrapper - Development Tools Sidebar
# Pawprint Wrapper - Development Tools Sidebar
A collapsible sidebar that provides development and testing tools for any soleprint-managed room (like amar) without interfering with the managed application.
A collapsible sidebar that provides development and testing tools for any pawprint-managed nest (like amar) without interfering with the managed application.
## Features
@@ -12,7 +12,7 @@ A collapsible sidebar that provides development and testing tools for any solepr
### 🌍 Environment Info
- Display backend and frontend URLs
- Room name and deployment info
- Nest name and deployment info
- Quick reference during development
### ⌨️ Keyboard Shortcuts
@@ -40,7 +40,7 @@ wrapper/
Open `index.html` in your browser to see the sidebar in action:
```bash
cd core_room/wrapper
cd core_nest/wrapper
python3 -m http.server 8080
# Open http://localhost:8080
```
@@ -68,7 +68,7 @@ Edit `config.json` to customize:
```json
{
"room_name": "amar",
"nest_name": "amar",
"wrapper": {
"enabled": true,
"environment": {
@@ -208,10 +208,10 @@ getSidebarHTML() {
### Add New Features
Extend the `SoleprintSidebar` class in `sidebar.js`:
Extend the `PawprintSidebar` class in `sidebar.js`:
```javascript
class SoleprintSidebar {
class PawprintSidebar {
async fetchJiraInfo() {
const response = await fetch('https://artery.mcrn.ar/jira/VET-123');
const data = await response.json();
@@ -294,8 +294,8 @@ Planned features (see `../WRAPPER_DESIGN.md`):
## Related Documentation
- `../WRAPPER_DESIGN.md` - Complete architecture design
- `../../../soleprint/CLAUDE.md` - Soleprint framework overview
- `../../README.md` - Core room documentation
- `../../../pawprint/CLAUDE.md` - Pawprint framework overview
- `../../README.md` - Core nest documentation
## Contributing
@@ -303,9 +303,9 @@ To add a new panel or feature:
1. Add HTML in `getSidebarHTML()`
2. Add styling in `sidebar.css`
3. Add logic as methods on `SoleprintSidebar` class
3. Add logic as methods on `PawprintSidebar` class
4. Update this README with usage instructions
## License
Part of the Soleprint development tools ecosystem.
Part of the Pawprint development tools ecosystem.

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Soleprint Wrapper - Demo</title>
<title>Pawprint Wrapper - Demo</title>
<link rel="stylesheet" href="sidebar.css">
<style>
/* Demo page styles */
@@ -19,7 +19,7 @@
transition: margin-right 0.3s ease;
}
#soleprint-sidebar.expanded ~ #demo-content {
#pawprint-sidebar.expanded ~ #demo-content {
margin-right: var(--sidebar-width);
}
@@ -105,14 +105,14 @@
<div id="demo-content">
<div class="demo-header">
<h1>🐾 Soleprint Wrapper</h1>
<p>Development tools sidebar for any soleprint-managed room</p>
<h1>🐾 Pawprint Wrapper</h1>
<p>Development tools sidebar for any pawprint-managed nest</p>
</div>
<div class="demo-section">
<h2>👋 Quick Start</h2>
<p>
This is a standalone demo of the Soleprint Wrapper sidebar.
This is a standalone demo of the Pawprint Wrapper sidebar.
Click the toggle button on the right edge of the screen, or press
<span class="kbd">Ctrl</span> + <span class="kbd">Shift</span> + <span class="kbd">P</span>
to open the sidebar.
@@ -156,7 +156,7 @@
<ul>
<li><code>sidebar.css</code> - Visual styling (dark theme, animations)</li>
<li><code>sidebar.js</code> - Logic (login, logout, toggle, state management)</li>
<li><code>config.json</code> - Configuration (users, URLs, room info)</li>
<li><code>config.json</code> - Configuration (users, URLs, nest info)</li>
</ul>
<p style="margin-top: 16px;">
To integrate with your app, simply include these in your HTML:
@@ -184,7 +184,7 @@
<div class="demo-section">
<h2>📚 Documentation</h2>
<p>
See <code>WRAPPER_DESIGN.md</code> in <code>core_room/</code> for the complete
See <code>WRAPPER_DESIGN.md</code> in <code>core_nest/</code> for the complete
architecture design, including Docker integration patterns and alternative approaches.
</p>
</div>

View File

@@ -1,4 +1,4 @@
/* Soleprint Wrapper - Sidebar Styles */
/* Pawprint Wrapper - Sidebar Styles */
:root {
--sidebar-width: 320px;
@@ -26,7 +26,7 @@ body {
}
/* Sidebar Container */
#soleprint-sidebar {
#pawprint-sidebar {
position: fixed;
right: 0;
top: 0;
@@ -44,7 +44,7 @@ body {
flex-direction: column;
}
#soleprint-sidebar.expanded {
#pawprint-sidebar.expanded {
transform: translateX(0);
}
@@ -76,7 +76,7 @@ body {
transition: transform 0.3s;
}
#soleprint-sidebar.expanded ~ #sidebar-toggle .icon {
#pawprint-sidebar.expanded ~ #sidebar-toggle .icon {
transform: scaleX(-1);
}
@@ -94,7 +94,7 @@ body {
color: var(--sidebar-accent);
}
.sidebar-header .room-name {
.sidebar-header .nest-name {
font-size: 12px;
opacity: 0.7;
text-transform: uppercase;
@@ -262,20 +262,20 @@ body {
}
/* Scrollbar */
#soleprint-sidebar::-webkit-scrollbar {
#pawprint-sidebar::-webkit-scrollbar {
width: 8px;
}
#soleprint-sidebar::-webkit-scrollbar-track {
#pawprint-sidebar::-webkit-scrollbar-track {
background: #1a1a1a;
}
#soleprint-sidebar::-webkit-scrollbar-thumb {
#pawprint-sidebar::-webkit-scrollbar-thumb {
background: #444;
border-radius: 4px;
}
#soleprint-sidebar::-webkit-scrollbar-thumb:hover {
#pawprint-sidebar::-webkit-scrollbar-thumb:hover {
background: #555;
}
@@ -290,7 +290,7 @@ body {
/* Responsive */
@media (max-width: 768px) {
#soleprint-sidebar {
#pawprint-sidebar {
width: 100%;
}
}

View File

@@ -1,6 +1,6 @@
// Soleprint Wrapper - Sidebar Logic
// Pawprint Wrapper - Sidebar Logic
class SoleprintSidebar {
class PawprintSidebar {
constructor() {
this.config = null;
this.currentUser = null;
@@ -30,12 +30,12 @@ class SoleprintSidebar {
try {
const response = await fetch('/wrapper/config.json');
this.config = await response.json();
console.log('[Soleprint] Config loaded:', this.config.room_name);
console.log('[Pawprint] Config loaded:', this.config.nest_name);
} catch (error) {
console.error('[Soleprint] Failed to load config:', error);
console.error('[Pawprint] Failed to load config:', error);
// Use default config
this.config = {
room_name: 'default',
nest_name: 'default',
wrapper: {
environment: {
backend_url: 'http://localhost:8000',
@@ -49,7 +49,7 @@ class SoleprintSidebar {
createSidebar() {
const sidebar = document.createElement('div');
sidebar.id = 'soleprint-sidebar';
sidebar.id = 'pawprint-sidebar';
sidebar.innerHTML = this.getSidebarHTML();
document.body.appendChild(sidebar);
this.sidebar = sidebar;
@@ -59,7 +59,7 @@ class SoleprintSidebar {
const button = document.createElement('button');
button.id = 'sidebar-toggle';
button.innerHTML = '<span class="icon">◀</span>';
button.title = 'Toggle Soleprint Sidebar (Ctrl+Shift+P)';
button.title = 'Toggle Pawprint Sidebar (Ctrl+Shift+P)';
document.body.appendChild(button);
this.toggleBtn = button;
}
@@ -69,8 +69,8 @@ class SoleprintSidebar {
return `
<div class="sidebar-header">
<h2>🐾 Soleprint</h2>
<div class="room-name">${this.config.room_name}</div>
<h2>🐾 Pawprint</h2>
<div class="nest-name">${this.config.nest_name}</div>
</div>
<div class="sidebar-content">
@@ -83,7 +83,7 @@ class SoleprintSidebar {
<div id="current-user-display" style="display: none;">
<div class="current-user">
Logged in as: <strong id="current-username"></strong>
<button class="logout-btn" onclick="soleprintSidebar.logout()">
<button class="logout-btn" onclick="pawprintSidebar.logout()">
Logout
</button>
</div>
@@ -91,7 +91,7 @@ class SoleprintSidebar {
<div class="user-cards">
${users.map(user => `
<div class="user-card" data-user-id="${user.id}" onclick="soleprintSidebar.loginAs('${user.id}')">
<div class="user-card" data-user-id="${user.id}" onclick="pawprintSidebar.loginAs('${user.id}')">
<div class="icon">${user.icon}</div>
<div class="info">
<span class="label">${user.label}</span>
@@ -119,7 +119,7 @@ class SoleprintSidebar {
</div>
<div class="sidebar-footer">
Soleprint Dev Tools
Pawprint Dev Tools
</div>
`;
}
@@ -144,11 +144,11 @@ class SoleprintSidebar {
saveSidebarState() {
const isExpanded = this.sidebar.classList.contains('expanded');
localStorage.setItem('soleprint_sidebar_expanded', isExpanded);
localStorage.setItem('pawprint_sidebar_expanded', isExpanded);
}
loadSidebarState() {
const isExpanded = localStorage.getItem('soleprint_sidebar_expanded') === 'true';
const isExpanded = localStorage.getItem('pawprint_sidebar_expanded') === 'true';
if (isExpanded) {
this.sidebar.classList.add('expanded');
}
@@ -214,7 +214,7 @@ class SoleprintSidebar {
}, 1000);
} catch (error) {
console.error('[Soleprint] Login error:', error);
console.error('[Pawprint] Login error:', error);
this.showStatus(`✗ Login failed: ${error.message}`, 'error');
}
}
@@ -241,7 +241,7 @@ class SoleprintSidebar {
this.currentUser = JSON.parse(userInfo);
this.updateCurrentUserDisplay();
} catch (error) {
console.error('[Soleprint] Failed to parse user info:', error);
console.error('[Pawprint] Failed to parse user info:', error);
}
}
}
@@ -275,12 +275,12 @@ class SoleprintSidebar {
}
// Initialize sidebar when DOM is ready
const soleprintSidebar = new SoleprintSidebar();
const pawprintSidebar = new PawprintSidebar();
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => soleprintSidebar.init());
document.addEventListener('DOMContentLoaded', () => pawprintSidebar.init());
} else {
soleprintSidebar.init();
pawprintSidebar.init();
}
console.log('[Soleprint] Sidebar script loaded');
console.log('[Pawprint] Sidebar script loaded');