Skip to content
Closed

100 #18

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
5b563f2
Docs: Code analysis and docs reorganisation
alvagante Jan 28, 2026
4702791
refactor: Code refactoring and consolidation
alvagante Jan 29, 2026
4cd4039
Docs: Documentation reorganisation
alvagante Jan 29, 2026
dc93a34
docs: update README table of contents and fix documentation consistency
alvagante Jan 30, 2026
485929f
docs: Update screenshots
alvagante Jan 30, 2026
9ba47e4
fix: remove unnecessary type arguments
alvagante Jan 30, 2026
28b8789
docs: Sample Bolt project removed, more docs on Docker
alvagante Jan 30, 2026
44d3ddd
Docs: Added plan for version 1
alvagante Jan 31, 2026
83523fa
Refactor: Step 1.1
alvagante Jan 31, 2026
0ffc412
Refactor: Step 1.2
alvagante Jan 31, 2026
a7f8b0a
Refactor: Step 1.3
alvagante Jan 31, 2026
0068659
Refactor: Step 1.4
alvagante Jan 31, 2026
89fb218
Refactor: Step 1.4
alvagante Jan 31, 2026
ac0d5ad
Refactor: Step 1.5
alvagante Jan 31, 2026
d029d94
Refactor: Step 2.6
alvagante Jan 31, 2026
245af30
Refactor: Steps up to 2.10
alvagante Jan 31, 2026
18c8bca
Refactor: Step 2.11
alvagante Jan 31, 2026
39ab37f
Refactor: Step 3.12
alvagante Jan 31, 2026
6833e75
Refactor: Steps 3.13 3.14
alvagante Jan 31, 2026
5a2a58a
Refactor: Step 4.15
alvagante Jan 31, 2026
a60b67e
fix: Sqlite databases creation
alvagante Jan 31, 2026
cb22a61
Refactor: Step 4.16
alvagante Jan 31, 2026
412232d
Refactor: Step 4.17
alvagante Jan 31, 2026
523cd30
Refactor: Step 4.18
alvagante Jan 31, 2026
d1f72fc
Refactor: Step 4.19
alvagante Jan 31, 2026
808e93e
Refactor: Step 4.20
alvagante Jan 31, 2026
8da3032
Refactor: Step 4.21
alvagante Jan 31, 2026
d79a4fc
Refactor: Step 4.22
alvagante Jan 31, 2026
15e42ec
Docs: Updated plan for 1.0.0 with migration of existing plugins
alvagante Jan 31, 2026
ae5b3af
Refactor: Step 4.23
alvagante Jan 31, 2026
01a00e3
Refactor: Renamed expert mode, dynamic menu
alvagante Jan 31, 2026
4079353
Refactor: Step 5:24
alvagante Jan 31, 2026
3930fab
Refactor: Step 5:25
alvagante Jan 31, 2026
a504645
Refactor: Step 5:26
alvagante Jan 31, 2026
112fccf
Refactor: Step 5:27
alvagante Jan 31, 2026
13058ad
Refactor: Up Step 5.29 In progress
alvagante Jan 31, 2026
3f057e3
Refactor: Up Step 5.29
alvagante Jan 31, 2026
8ca1fae
Refactor: WIP
alvagante Feb 1, 2026
6658209
Feat: Added user authentication
alvagante Feb 1, 2026
cb916a7
Refactor: Step 5:29
alvagante Feb 1, 2026
a6ab5ee
Feat: Home and Integration pages wip
alvagante Feb 1, 2026
9837f70
Refactor: Wip
alvagante Feb 2, 2026
1f9f37a
Fix: Users auth fixed
alvagante Feb 2, 2026
b8135c6
Refactor: 1.0 migration plan
alvagante Feb 2, 2026
c9d30e3
Refactor: 1.1
alvagante Feb 2, 2026
6798115
Refactor: 1.2
alvagante Feb 2, 2026
b020bb8
Refactor: 1.2 b
alvagante Feb 2, 2026
6990407
Refactor: 1.2
alvagante Feb 2, 2026
7ef4986
Refactor: 1.3
alvagante Feb 3, 2026
5edbe21
Refactor: Menu fix
alvagante Feb 3, 2026
affce8a
Refactor: 1.4
alvagante Feb 3, 2026
c0f022b
Refactor: 1.5
alvagante Feb 3, 2026
276801d
Refactor: 1.6
alvagante Feb 3, 2026
c50384b
Refactor: 1
alvagante Feb 3, 2026
86117de
Refactor: 3
alvagante Feb 3, 2026
cd8185b
Refactor: 1 again
alvagante Feb 3, 2026
7b4b8dd
Refactor: 2
alvagante Feb 3, 2026
29f0d6d
Refactor: 3
alvagante Feb 3, 2026
f4e0c96
Refactor: 6
alvagante Feb 3, 2026
cfecaa1
refactor(plugin-migration): finalize v1 plugin architecture and remov…
alvagante Feb 4, 2026
7f50042
Refactor: 2
alvagante Feb 4, 2026
2f12175
Refactor: 3
alvagante Feb 4, 2026
7d74d04
Refactor: 0.x cleanup
alvagante Feb 4, 2026
3827c44
Refactor: Cleanup 1
alvagante Feb 4, 2026
6d9fa04
refactor(plugin-migration): complete v1 plugin architecture finalizat…
alvagante Feb 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
43 changes: 43 additions & 0 deletions .env.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Sample .env file for a docker setup where all the needed
# files are in your $(cwd)/pabawi dir which is mounted to /pabawi in the container

PORT=3000
HOST=localhost
LOG_LEVEL=info
DATABASE_PATH=/pabawi/data/pabawi.db

# PuppetDB integration
PUPPETDB_ENABLED=true
PUPPETDB_SERVER_URL=https://puppet.example.com
PUPPETDB_PORT=8081
PUPPETDB_TOKEN=
PUPPETDB_SSL_ENABLED=true
# You can generate certs for pabawi using scrips/generate-pabawi-cert.sh
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'scripts' to 'scripts'.

Suggested change
# You can generate certs for pabawi using scrips/generate-pabawi-cert.sh
# You can generate certs for pabawi using scripts/generate-pabawi-cert.sh

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct spelling in comments to avoid confusion for operators.

Copilot uses AI. Check for mistakes.
PUPPETDB_SSL_CA=/pabawi/certs/ca.pem
PUPPETDB_SSL_CERT=/pabawi/certs/pabawi.pem
PUPPETDB_SSL_KEY=/pabawi/certs/pabawi-key.pem
PUPPETDB_SSL_REJECT_UNAUTHORIZED=true

# Puppetserver integration
PUPPETSERVER_ENABLED=true
PUPPETSERVER_SERVER_URL=https://puppet.example.com
PUPPETSERVER_PORT=8140
PUPPETSERVER_TOKEN=
PUPPETSERVER_SSL_ENABLED=true
# You can use the same cert used for PuppetBD or a different one
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'PuppetDB' to 'PuppetDB'.

Suggested change
# You can use the same cert used for PuppetBD or a different one
# You can use the same cert used for PuppetDB or a different one

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct spelling in comments to avoid confusion for operators.

Copilot uses AI. Check for mistakes.
PUPPETSERVER_SSL_CA=/pabawi/certs/ca.pem
PUPPETSERVER_SSL_CERT=/pabawi/certs/pabawi.pem
PUPPETSERVER_SSL_KEY=/pabawi/certs/pabawi-key.pem
PUPPETSERVER_SSL_REJECT_UNAUTHORIZED=true

# Hiera integration
HIERA_ENABLED=true
HIERA_CONTROL_REPO_PATH=/pabawi/control-repo
HIERA_CONFIG_PATH=hiera.yaml

# Bolt integration
BOLT_COMMAND_WHITELIST_ALLOW_ALL=false
BOLT_COMMAND_WHITELIST=["ls","pwd","whoami","uptime"]
BOLT_EXECUTION_TIMEOUT=300000
# Bolt project files can stay in the control repo or in a separate dir
BOLT_PROJECT_PATH=/pabawi/control-repo
258 changes: 258 additions & 0 deletions .kiro/docs/architecture-comparison-060-vs-100.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
# Architecture Comparison: Branch 060 (Legacy 0.5.x) vs Branch 100 (v1.0.0)

This document analyzes the architectural differences between the legacy 0.5.x codebase (branch 060) and the new modular plugin architecture in v1.0.0 (branch 100).

## Key Architectural Differences

| Aspect | Branch 060 (Legacy 0.5.x) | Branch 100 (v1.0.0) |
|--------|---------------------------|---------------------|
| Plugin System | Type-based (`ExecutionToolPlugin`, `InformationSourcePlugin`) | Capability-based (`BasePluginInterface`, `PluginCapability`) |
| Routing | Direct service calls | CapabilityRegistry with priority-based routing |
| Authentication | None | JWT-based with RBAC |
| Authorization | None | Permission-based via `requireCapability()` middleware |
| Database | Direct SQLite | Database abstraction layer with adapters |
| Configuration | Environment variables only | YAML + env vars with schema validation |

---

## Backend API Endpoints

### Legacy Routes (Branch 060) - Maintained for Backward Compatibility

| Endpoint | File | Description |
|----------|------|-------------|
| `GET /api/inventory` | `routes/inventory.ts` | List nodes (direct BoltService/IntegrationManager) |
| `GET /api/inventory/sources` | `routes/inventory.ts` | List inventory sources |
| `GET /api/nodes/:id` | `routes/inventory.ts` | Get node details |
| `GET /api/nodes/:id/facts` | `routes/facts.ts` | Get node facts |
| `POST /api/nodes/:id/command` | `routes/commands.ts` | Execute command |
| `POST /api/nodes/:id/task` | `routes/tasks.ts` | Execute task |
| `GET /api/tasks` | `routes/tasks.ts` | List Bolt tasks |
| `GET /api/executions` | `routes/executions.ts` | List executions |
| `GET /api/executions/:id` | `routes/executions.ts` | Get execution details |
| `POST /api/nodes/:id/puppet/run` | `routes/puppet.ts` | Run Puppet agent |
| `GET /api/integrations/status` | `routes/integrations.ts` | Integration health |
| `GET /api/integrations/hiera/*` | `routes/hiera.ts` | Hiera operations |
| `GET /api/config` | `routes/config.ts` | Get configuration |
| `GET /api/health` | `server.ts` | Health check |

### New v1.0.0 Routes (Branch 100 Only)

#### Authentication

| Endpoint | File | Description |
|----------|------|-------------|
| `POST /api/auth/login` | `routes/auth.ts` | Login → JWT tokens |
| `POST /api/auth/refresh` | `routes/auth.ts` | Refresh token |
| `POST /api/auth/logout` | `routes/auth.ts` | Revoke tokens |
| `GET /api/auth/me` | `routes/auth.ts` | Current user + permissions |
| `GET /api/auth/sessions` | `routes/auth.ts` | Active session count |
| `POST /api/auth/check` | `routes/auth.ts` | Check capability permission |

#### User Management (Admin Only)

| Endpoint | File | Description |
|----------|------|-------------|
| `GET /api/users` | `routes/users.ts` | List users |
| `POST /api/users` | `routes/users.ts` | Create user |
| `GET /api/users/:id` | `routes/users.ts` | Get user |
| `PUT /api/users/:id` | `routes/users.ts` | Update user |
| `DELETE /api/users/:id` | `routes/users.ts` | Delete user |
| `GET /api/users/:id/groups` | `routes/users.ts` | Get user's groups |
| `GET /api/users/:id/roles` | `routes/users.ts` | Get user's effective roles |

#### Role Management (Admin Only)

| Endpoint | File | Description |
|----------|------|-------------|
| `GET /api/roles` | `routes/roles.ts` | List roles |
| `POST /api/roles` | `routes/roles.ts` | Create role |
| `PUT /api/roles/:id` | `routes/roles.ts` | Update role |
| `DELETE /api/roles/:id` | `routes/roles.ts` | Delete role |
| `POST /api/roles/:id/permissions` | `routes/roles.ts` | Add permission |
| `DELETE /api/roles/:id/permissions/:capability` | `routes/roles.ts` | Remove permission |
| `POST /api/roles/initialize` | `routes/roles.ts` | Initialize system roles |

#### Group Management (Admin Only)

| Endpoint | File | Description |
|----------|------|-------------|
| `GET /api/groups` | `routes/groups.ts` | List groups |
| `POST /api/groups` | `routes/groups.ts` | Create group |
| `GET /api/groups/:id` | `routes/groups.ts` | Get group |
| `PUT /api/groups/:id` | `routes/groups.ts` | Update group |
| `DELETE /api/groups/:id` | `routes/groups.ts` | Delete group |
| `POST /api/groups/:id/members/:userId` | `routes/groups.ts` | Add member |
| `DELETE /api/groups/:id/members/:userId` | `routes/groups.ts` | Remove member |
| `POST /api/groups/:id/roles/:roleId` | `routes/groups.ts` | Add role to group |

#### Setup

| Endpoint | File | Description |
|----------|------|-------------|
| `GET /api/setup/status` | `routes/setup.ts` | Check if setup needed |
| `POST /api/setup/admin` | `routes/setup.ts` | Create initial admin |

#### Plugins

| Endpoint | File | Description |
|----------|------|-------------|
| `GET /api/plugins` | `routes/plugins.ts` | List plugins |
| `GET /api/plugins/:name` | `routes/plugins.ts` | Get plugin details |
| `GET /api/plugins/:name/capabilities` | `routes/plugins.ts` | Plugin capabilities |

### New v1.0.0 Capability-Based Routes

These routes use the CapabilityRegistry for RBAC-aware execution:

| Endpoint | File | Capability Used |
|----------|------|-----------------|
| `GET /api/inventory` (v1) | `routes/inventory.v1.ts` | `inventory.read`, `bolt.inventory.list` |
| `GET /api/inventory/:id` (v1) | `routes/inventory.v1.ts` | `inventory.read` |
| `POST /api/nodes/:id/command` (v1) | `routes/commands.v1.ts` | `bolt.command.execute` |
| `GET /api/tasks` (v1) | `routes/tasks.v1.ts` | `bolt.task.list` |
| `GET /api/tasks/:taskName` (v1) | `routes/tasks.v1.ts` | `bolt.task.list`, `bolt.task.details` |
| `POST /api/nodes/:id/task` (v1) | `routes/tasks.v1.ts` | `bolt.task.execute` |
| `GET /api/nodes/:id/facts` (v1) | `routes/facts.v1.ts` | `bolt.facts.query` |
| `GET /api/hiera/*` (v1) | `routes/hiera.v1.ts` | `hiera.*` capabilities |
| `GET /api/puppet/*` (v1) | `routes/puppet.v1.ts` | `puppetdb.*` capabilities |

---

## Supporting Code

### Legacy Code (Branch 060)

| File | Purpose |
|------|---------|
| `integrations/bolt/BoltPlugin.ts` | Type-based plugin implementing `ExecutionToolPlugin` + `InformationSourcePlugin` |
| `integrations/IntegrationManager.ts` | Direct plugin registration via `executionTools`/`informationSources` Maps |
| `integrations/types.ts` | `ExecutionToolPlugin`, `InformationSourcePlugin` interfaces |
| `database/DatabaseService.ts` | Direct SQLite with `better-sqlite3` |

### New v1.0.0 Code (Branch 100)

#### Core Plugin Infrastructure

| File | Purpose |
|------|---------|
| `integrations/CapabilityRegistry.ts` | Central capability registration and execution |
| `integrations/PluginLoader.ts` | Dynamic plugin discovery and loading |
| `integrations/types.ts` | `BasePluginInterface`, `PluginCapability`, `PluginWidget`, `PluginCLICommand` |
| `integrations/bolt/BoltPlugin.ts` | Capability-based plugin with `BasePluginInterface` |

#### Authentication & Authorization

| File | Purpose |
|------|---------|
| `auth/AuthService.ts` | JWT token generation, validation, refresh |
| `auth/AuthorizationService.ts` | RBAC permission checking with caching |
| `auth/UserService.ts` | User CRUD with bcrypt password hashing |
| `auth/RoleService.ts` | Role and permission management |
| `auth/GroupService.ts` | Group management |
| `auth/types.ts` | Type definitions for auth system |
| `middleware/auth.ts` | JWT validation middleware |
| `middleware/rbac.ts` | `requireCapability()`, `requireAdmin()` middleware |

#### Database Abstraction

| File | Purpose |
|------|---------|
| `database/DatabaseFactory.ts` | Database adapter factory |
| `database/adapters/SQLiteAdapter.ts` | SQLite implementation of `DatabaseAdapter` |
| `database/interfaces/DatabaseInterface.ts` | Abstract database interface |

#### Configuration

| File | Purpose |
|------|---------|
| `config/YamlConfigLoader.ts` | YAML config with env var interpolation |
| `config/SchemaRegistry.ts` | Zod schema validation |
| `config/YamlConfigSchemas.ts` | Schema definitions for YAML configs |

#### Route Helpers

| File | Purpose |
|------|---------|
| `routes/capabilityRouter.ts` | Helper functions for capability-based routes |

---

## Plugin Capability Definitions (v1.0.0)

The new BoltPlugin registers these capabilities:

| Capability Name | Category | Risk Level | Required Permissions |
|-----------------|----------|------------|---------------------|
| `bolt.command.execute` | command | execute | `bolt.command.execute`, `command.execute` |
| `bolt.task.execute` | task | execute | `bolt.task.execute`, `task.execute` |
| `bolt.inventory.list` | inventory | read | `bolt.inventory.list`, `inventory.read` |
| `bolt.facts.query` | info | read | `bolt.facts.query`, `facts.read` |
| `bolt.task.list` | info | read | `bolt.task.list` |
| `bolt.task.details` | info | read | `bolt.task.details` |

### Default Role Permissions

| Capability | admin | operator | viewer |
|------------|-------|----------|--------|
| `bolt.command.execute` | ✓ | ✓ | ✗ |
| `bolt.task.execute` | ✓ | ✓ | ✗ |
| `bolt.inventory.list` | ✓ | ✓ | ✓ |
| `bolt.facts.query` | ✓ | ✓ | ✓ |
| `bolt.task.list` | ✓ | ✓ | ✓ |
| `bolt.task.details` | ✓ | ✓ | ✓ |

---

## Frontend Widget Definitions (v1.0.0)

The BoltPlugin defines these widgets for dynamic UI composition:

| Widget ID | Name | Slots | Size |
|-----------|------|-------|------|
| `bolt:command-executor` | Command Executor | dashboard, node-detail, standalone-page | medium |
| `bolt:task-runner` | Task Runner | dashboard, node-detail, standalone-page | large |
| `bolt:inventory-viewer` | Inventory Viewer | dashboard, inventory-panel, sidebar | medium |
| `bolt:task-browser` | Task Browser | dashboard, sidebar | small |

---

## Migration Notes

### Deprecated Methods (v1.0.0)

The following IntegrationManager methods are deprecated and will be removed in v2.0.0:

| Deprecated Method | Replacement |
|-------------------|-------------|
| `getExecutionTool()` | `executeCapability('command.execute', ...)` |
| `getInformationSource()` | `executeCapability('inventory.list', ...)` |
| `getAllExecutionTools()` | `getCapabilitiesByCategory('command')` |
| `getAllInformationSources()` | `getCapabilitiesByCategory('inventory')` |

### Database Schema Changes

New tables added in v1.0.0:

- `users` - User accounts
- `groups` - User groups
- `roles` - Permission roles
- `permissions` - Capability permissions
- `user_groups` - User-group membership
- `user_roles` - User-role assignment
- `group_roles` - Group-role assignment
- `refresh_tokens` - JWT refresh tokens
- `token_revocations` - Revoked token tracking

---

## Summary

Branch 100 introduces a complete architectural overhaul:

1. **Capability-based plugin system** - Replaces type-based plugins with capability handlers
2. **Full authentication/authorization** - JWT tokens + RBAC with role/group/permission management
3. **Database abstraction layer** - Supports future PostgreSQL/MySQL adapters
4. **YAML configuration** - Declarative config with environment variable interpolation
5. **New v1 API routes** - Capability routing with permission checks
6. **Legacy compatibility** - Old routes maintained but marked deprecated
File renamed without changes.
Loading
Loading