# pkr-lab/capulus-core architecture

> Architecture diagram of the GitHub repository pkr-lab/capulus-core, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pkr-lab/capulus-core
- Repository: https://github.com/pkr-lab/capulus-core

## Overview

capulus-core is a GitOps repository for Capulus Homelab applications, with documented clusters ENTW, TECH and PROD and an ENTW → TECH → PROD promotion chain. The sampled TECH tree also contains operational services: two ISC automation bots, an Ollama helper, APIs and a ticket gate. The bot flow is HTTP request → validation/runner → browser automation against ISC or SEWOBE → result. Edges reflect README statements or SOURCE INDEX references; unsampled deployment wiring and service internals are not inferred.

Main entry points: [`argocd/apps/tech/isc-manager-bot/src/runner.ts`](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/runner.ts) (Member sync runner), [`argocd/apps/tech/isc-manager-bot/src/main.ts`](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/main.ts) (Manager startup), [`argocd/apps/tech/isc-news-bot/src/server.ts`](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-news-bot/src/server.ts) (News HTTP API), [`argocd/apps/tech/isc-news-bot/src/runner.ts`](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-news-bot/src/runner.ts) (News workflow runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gitops["GitOps operations"]
  node_clusters["Cluster applications"]
  node_promotion["Promotion chain<br/>[promote-chain.py]"]
  node_tokenreg["Token register"]
end

subgraph group_automation["ISC automation"]
  node_manager_main["Manager startup<br/>[main.ts]"]
  node_manager_http["Manager HTTP API<br/>[server.ts]"]
  node_manager_runner["Member sync runner<br/>[runner.ts]"]
  node_manager_isc["ISC session and people<br/>[personen.ts]"]
  node_manager_sewobe["SEWOBE session and search<br/>[search.ts]"]
  node_manager_mapping["Sync mapping and plan<br/>[mapping.ts]"]
  node_manager_totp["TOTP source<br/>[totp.ts]"]
  node_news_main["News bot startup<br/>[main.ts]"]
  node_news_http["News HTTP API<br/>[server.ts]"]
  node_news_runner["News workflow runner<br/>[runner.ts]"]
  node_news_publish["News publishing<br/>[publish.ts]"]
  node_news_urkunden["Certificate queries<br/>[urkunden.ts]"]
end

subgraph group_services["TECH services"]
  node_alert_caller["Alert caller<br/>[caller.py]"]
  node_carplay["CarPlay API<br/>[main.go]"]
  node_carplay_power["Power agent client<br/>[poweragent.go]"]
  node_ticket_gate["Ticket gate service<br/>[service.go]"]
  node_ticket_store[("Ticket state store<br/>[store.go]")]
end

subgraph group_ollama["Ollama helper"]
  node_ollama_cli["Ollama CLI<br/>[cli.js]"]
  node_ollama_run["Request runner<br/>[run.js]"]
  node_ollama_prompt["Prompt builder<br/>[prompt.js]"]
  node_ollama_knowledge["Knowledge lookup<br/>[knowledge.js]"]
  node_ollama_model["Ollama client<br/>[ollama.js]"]
end

node_operator(("Repository operator"))

node_operator -->|"defines apps"| node_clusters
node_operator -->|"promotes releases"| node_promotion
node_operator -->|"maintains secrets"| node_tokenreg
node_manager_main -->|"starts server"| node_manager_http
node_manager_main -->|"creates runner"| node_manager_runner
node_manager_main -->|"creates source"| node_manager_totp
node_manager_http -->|"routes requests"| node_manager_runner
node_manager_runner -->|"uses ISC"| node_manager_isc
node_manager_runner -->|"uses SEWOBE"| node_manager_sewobe
node_manager_runner -->|"builds sync plan"| node_manager_mapping
node_news_main -->|"starts server"| node_news_http
node_news_main -->|"creates runner"| node_news_runner
node_news_http -->|"routes requests"| node_news_runner
node_news_http -->|"parses query"| node_news_urkunden
node_news_runner -->|"publishes news"| node_news_publish
node_ollama_cli -->|"dispatches work"| node_ollama_run
node_ollama_cli -->|"invokes client"| node_ollama_model
node_ollama_run -.->|"builds prompt"| node_ollama_prompt
node_ollama_prompt -->|"uses knowledge"| node_ollama_knowledge

click node_clusters "https://github.com/pkr-lab/capulus-core/tree/main/argocd/apps"
click node_promotion "https://github.com/pkr-lab/capulus-core/blob/main/scripts/promote-chain.py"
click node_tokenreg "https://github.com/pkr-lab/capulus-core/blob/main/ops/token-register.yaml"
click node_manager_main "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/main.ts"
click node_manager_http "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/server.ts"
click node_manager_runner "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/runner.ts"
click node_manager_isc "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/isc/personen.ts"
click node_manager_sewobe "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/sewobe/search.ts"
click node_manager_mapping "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/sync/mapping.ts"
click node_manager_totp "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/totp.ts"
click node_news_main "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-news-bot/src/main.ts"
click node_news_http "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-news-bot/src/server.ts"
click node_news_runner "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-news-bot/src/runner.ts"
click node_news_publish "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-news-bot/src/isc/publish.ts"
click node_news_urkunden "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-news-bot/src/urkunden.ts"
click node_alert_caller "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/alert-caller/src/caller.py"
click node_carplay "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/carplay-api/src/cmd/server/main.go"
click node_carplay_power "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/carplay-api/src/internal/clients/poweragent.go"
click node_ticket_gate "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/ticket-gate/src/internal/gate/service.go"
click node_ticket_store "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/ticket-gate/src/internal/store/store.go"
click node_ollama_cli "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/n8n/ollama-pc/cli.js"
click node_ollama_run "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/n8n/ollama-pc/lib/run.js"
click node_ollama_prompt "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/n8n/ollama-pc/lib/prompt.js"
click node_ollama_knowledge "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/n8n/ollama-pc/lib/knowledge.js"
click node_ollama_model "https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/n8n/ollama-pc/lib/ollama.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_clusters,node_promotion,node_tokenreg toneBlue
class node_manager_main,node_manager_http,node_manager_runner,node_manager_isc,node_manager_sewobe,node_manager_mapping,node_manager_totp,node_news_main,node_news_http,node_news_runner,node_news_publish,node_news_urkunden toneAmber
class node_alert_caller,node_carplay,node_carplay_power,node_ticket_gate,node_ticket_store toneMint
class node_ollama_cli,node_ollama_run,node_ollama_prompt,node_ollama_knowledge,node_ollama_model toneRose
class node_operator toneIndigo
```

## Components

### GitOps operations

- [Cluster applications](https://github.com/pkr-lab/capulus-core/tree/main/argocd/apps): `argocd/apps`
- [Promotion chain](https://github.com/pkr-lab/capulus-core/blob/main/scripts/promote-chain.py): `scripts/promote-chain.py`
- [Token register](https://github.com/pkr-lab/capulus-core/blob/main/ops/token-register.yaml): `ops/token-register.yaml`

### ISC automation

- [Manager startup](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/main.ts): `argocd/apps/tech/isc-manager-bot/src/main.ts`
- [Manager HTTP API](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/server.ts): `argocd/apps/tech/isc-manager-bot/src/server.ts`
- [Member sync runner](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/runner.ts): `argocd/apps/tech/isc-manager-bot/src/runner.ts`
- [ISC session and people](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/isc/personen.ts): `argocd/apps/tech/isc-manager-bot/src/isc/personen.ts`
- [SEWOBE session and search](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/sewobe/search.ts): `argocd/apps/tech/isc-manager-bot/src/sewobe/search.ts`
- [Sync mapping and plan](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/sync/mapping.ts): `argocd/apps/tech/isc-manager-bot/src/sync/mapping.ts`
- [TOTP source](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-manager-bot/src/totp.ts): `argocd/apps/tech/isc-manager-bot/src/totp.ts`
- [News bot startup](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-news-bot/src/main.ts): `argocd/apps/tech/isc-news-bot/src/main.ts`
- [News HTTP API](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-news-bot/src/server.ts): `argocd/apps/tech/isc-news-bot/src/server.ts`
- [News workflow runner](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-news-bot/src/runner.ts): `argocd/apps/tech/isc-news-bot/src/runner.ts`
- [News publishing](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-news-bot/src/isc/publish.ts): `argocd/apps/tech/isc-news-bot/src/isc/publish.ts`
- [Certificate queries](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/isc-news-bot/src/urkunden.ts): `argocd/apps/tech/isc-news-bot/src/urkunden.ts`

### TECH services

- [Alert caller](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/alert-caller/src/caller.py): `argocd/apps/tech/alert-caller/src/caller.py`
- [CarPlay API](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/carplay-api/src/cmd/server/main.go): `argocd/apps/tech/carplay-api/src/cmd/server/main.go`
- [Power agent client](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/carplay-api/src/internal/clients/poweragent.go): `argocd/apps/tech/carplay-api/src/internal/clients/poweragent.go`
- [Ticket gate service](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/ticket-gate/src/internal/gate/service.go): `argocd/apps/tech/ticket-gate/src/internal/gate/service.go`
- [Ticket state store](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/ticket-gate/src/internal/store/store.go): `argocd/apps/tech/ticket-gate/src/internal/store/store.go`

### Ollama helper

- [Ollama CLI](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/n8n/ollama-pc/cli.js): `argocd/apps/tech/n8n/ollama-pc/cli.js`
- [Request runner](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/n8n/ollama-pc/lib/run.js): `argocd/apps/tech/n8n/ollama-pc/lib/run.js`
- [Prompt builder](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/n8n/ollama-pc/lib/prompt.js): `argocd/apps/tech/n8n/ollama-pc/lib/prompt.js`
- [Knowledge lookup](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/n8n/ollama-pc/lib/knowledge.js): `argocd/apps/tech/n8n/ollama-pc/lib/knowledge.js`
- [Ollama client](https://github.com/pkr-lab/capulus-core/blob/main/argocd/apps/tech/n8n/ollama-pc/lib/ollama.js): `argocd/apps/tech/n8n/ollama-pc/lib/ollama.js`

### Other components

- **Repository operator**

## Connections

- Repository operator → Cluster applications: defines apps
- Repository operator → Promotion chain: promotes releases
- Repository operator → Token register: maintains secrets
- Manager startup → Manager HTTP API: starts server (evidence: `argocd/apps/tech/isc-manager-bot/src/main.ts`)
- Manager startup → Member sync runner: creates runner (evidence: `argocd/apps/tech/isc-manager-bot/src/main.ts`)
- Manager startup → TOTP source: creates source (evidence: `argocd/apps/tech/isc-manager-bot/src/main.ts`)
- Manager HTTP API → Member sync runner: routes requests (evidence: `argocd/apps/tech/isc-manager-bot/src/server.ts`)
- Member sync runner → ISC session and people: uses ISC (evidence: `argocd/apps/tech/isc-manager-bot/src/runner.ts`)
- Member sync runner → SEWOBE session and search: uses SEWOBE (evidence: `argocd/apps/tech/isc-manager-bot/src/runner.ts`)
- Member sync runner → Sync mapping and plan: builds sync plan (evidence: `argocd/apps/tech/isc-manager-bot/src/runner.ts`)
- News bot startup → News HTTP API: starts server (evidence: `argocd/apps/tech/isc-news-bot/src/main.ts`)
- News bot startup → News workflow runner: creates runner (evidence: `argocd/apps/tech/isc-news-bot/src/main.ts`)
- News HTTP API → News workflow runner: routes requests (evidence: `argocd/apps/tech/isc-news-bot/src/server.ts`)
- News HTTP API → Certificate queries: parses query (evidence: `argocd/apps/tech/isc-news-bot/src/server.ts`)
- News workflow runner → News publishing: publishes news (evidence: `argocd/apps/tech/isc-news-bot/src/runner.ts`)
- Ollama CLI → Request runner: dispatches work (evidence: `argocd/apps/tech/n8n/ollama-pc/cli.js`)
- Ollama CLI → Ollama client: invokes client (evidence: `argocd/apps/tech/n8n/ollama-pc/cli.js`)
- Request runner → Prompt builder: builds prompt
- Prompt builder → Knowledge lookup: uses knowledge (evidence: `argocd/apps/tech/n8n/ollama-pc/lib/prompt.js`)
