Skip to content

Modern Docker Management, Designed for Everyone

refactor: use go workspaces and svelte layout groups (#1049)

Kyle Mendell5e20d23c3c42
diff --git a/.arcane.json b/.arcane.json
new file mode 100644
index 000000000..8d33f4c1f
--- /dev/null
+++ b/.arcane.json
@@ -0,0 +1,4 @@
+{
+ "version": "1.10.1",
+ "revision": "f1e942ab"
+}
diff --git a/.env.dev b/.env.dev
deleted file mode 100644
index 3a456b2a7..000000000
--- a/.env.dev
+++ /dev/null
@@ -1,28 +0,0 @@
-# Arcane Development Environment Configuration
-# Copy this file to .env and customize the values for your development setup
-# WARNING: These are development-only values, never use in production!
-
-# Application Settings
-GIN_MODE=debug
-ENVIRONMENT=development
-PORT=3552
-APP_URL=http://localhost:3000
-
-# User/Group IDs for file permissions
-PUID=1000
-PGID=1000
-
-# General Settings
-UI_CONFIGURATION_DISABLED=true
-
-# Security Settings
-# Generate secure values for production: openssl rand -base64 32
-ENCRYPTION_KEY=dev-encryption-key-replace-in-production-must-be-32-chars
-JWT_SECRET=dev-jwt-secret-replace-in-production-must-be-long-enough
-
-# Database Configuration
-DATABASE_URL=file:data/arcane.db?_pragma=journal_mode(WAL)&_pragma=busy_timeout(2500)&_txlock=immediate
-
-# Agent Configuration (for development agent service)
-# AGENT_MODE=f
-AGENT_BOOTSTRAP_TOKEN=development-bootstrap-token
diff --git a/.env.example b/.env.example
index 643b3f982..a3387ecce 100644
--- a/.env.example
+++ b/.env.example
@@ -1,8 +1,29 @@
-APP_URL="http://localhost:3552"
+# Arcane Environment Configuration
+# Copy this file to .env and customize the values for your production setup
+# Generate secure values with: openssl rand -base64 32
+
+# Application Settings
+GIN_MODE=release
ENVIRONMENT=production
-ENCRYPTION_KEY=f00V7L3pqj+yMtfUkpFAyaRTxoGo+600 #openssl rand -base64 32
-JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
+PORT=3552
+APP_URL=https://your-domain.com
+
+# User/Group IDs for file permissions (used by Docker)
+PUID=1000
+PGID=1000
+
+# Security Settings
+# IMPORTANT: Generate unique values for production!
+ENCRYPTION_KEY=your-32-char-encryption-key-here
+JWT_SECRET=your-super-secret-jwt-key-change-this
+
+# Database Configuration
+DATABASE_URL=file:data/arcane.db?_pragma=journal_mode(WAL)&_pragma=busy_timeout(2500)&_txlock=immediate
# Docker Configuration
# DOCKER_HOST=unix:///var/run/docker.sock # Default: direct socket access
-# DOCKER_HOST=tcp://docker-socket-proxy:2375 # Example: via socket proxy for enhanced security
\ No newline at end of file
+# DOCKER_HOST=tcp://docker-socket-proxy:2375 # Example: via socket proxy for enhanced security
+
+# Agent Configuration (optional)
+# AGENT_MODE=true
+# AGENT_BOOTSTRAP_TOKEN=your-secure-bootstrap-token
\ No newline at end of file
diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml
index 54b0aa53d..09a7fa062 100644
--- a/.github/workflows/backend-tests.yml
+++ b/.github/workflows/backend-tests.yml
@@ -1,20 +1,27 @@
-name: Backend Unit Tests
+name: Go Unit Tests
on:
push:
branches: [main]
paths:
- "backend/**"
+ - "cli/**"
+ - "types/**"
+ - "go.work"
pull_request:
branches: [main]
paths:
- "backend/**"
+ - "cli/**"
+ - "types/**"
+ - "go.work"
permissions:
contents: read
jobs:
- test:
+ test-backend:
+ name: Backend Tests
runs-on: depot-ubuntu-24.04-8
timeout-minutes: 30
defaults:
@@ -54,3 +61,35 @@ jobs:
with:
name: backend-coverage
path: backend/coverage.out
+
+ test-cli:
+ name: CLI Tests
+ runs-on: depot-ubuntu-24.04-8
+ timeout-minutes: 10
+ defaults:
+ run:
+ working-directory: cli
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v6
+
+ - name: Setup Go
+ uses: actions/setup-go@v6
+ with:
+ go-version-file: cli/go.mod
+ cache: true
+ cache-dependency-path: cli/go.sum
+
+ - name: Download modules
+ run: go mod download
+
+ - name: Run unit tests
+ run: go test ./... -race -coverprofile=coverage.out -covermode=atomic -v
+
+ - name: Upload coverage artifact
+ if: always()
+ uses: actions/upload-artifact@v5
+ with:
+ name: cli-coverage
+ path: cli/coverage.out
diff --git a/.github/workflows/go-linter.yml b/.github/workflows/go-linter.yml
index adf01facc..364d4545a 100644
--- a/.github/workflows/go-linter.yml
+++ b/.github/workflows/go-linter.yml
@@ -1,14 +1,20 @@
-name: Run Backend Linter
+name: Run Go Linter
on:
push:
branches: [main]
paths:
- "backend/**"
+ - "cli/**"
+ - "types/**"
+ - "go.work"
pull_request:
branches: [main]
paths:
- "backend/**"
+ - "cli/**"
+ - "types/**"
+ - "go.work"
permissions:
contents: read
@@ -19,6 +25,17 @@ jobs:
golangci-lint:
name: Run Golangci-lint
runs-on: depot-ubuntu-24.04-16
+ strategy:
+ fail-fast: false
+ matrix:
+ module: [backend, cli, types]
+ include:
+ - module: backend
+ args: --build-tags=exclude_frontend
+ - module: cli
+ args: ""
+ - module: types
+ args: ""
steps:
- name: Checkout code
uses: actions/checkout@v6
@@ -26,13 +43,13 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v6
with:
- go-version-file: backend/go.mod
- cache-dependency-path: backend/go.sum
+ go-version-file: ${{ matrix.module }}/go.mod
+ cache-dependency-path: ${{ matrix.module }}/go.sum
- name: Run Golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.6.1
- args: --build-tags=exclude_frontend
- working-directory: backend
+ args: ${{ matrix.args }}
+ working-directory: ${{ matrix.module }}
only-new-issues: ${{ github.event_name == 'pull_request' }}
diff --git a/.gitignore b/.gitignore
index 223bd3b05..efa3afe39 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,7 +28,6 @@ Thumbs.db
.env.*
!.env.example
!.env.test
-!.env.dev
# Vite
vite.config.js.timestamp-*
diff --git a/.revision b/.revision
deleted file mode 100644
index 3af18f87e..000000000
--- a/.revision
+++ /dev/null
@@ -1 +0,0 @@
-f1e942ab
diff --git a/.version b/.version
deleted file mode 100644
index 4dae2985b..000000000
--- a/.version
+++ /dev/null
@@ -1 +0,0 @@
-1.10.1
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 2582e1fe0..4b5300ecd 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -17,7 +17,7 @@
"clear": false,
"echo": false,
"focus": false,
- "showReuseMessage": false,
+ "showReuseMessage": false
},
"isBackground": true,
"options": {
@@ -124,10 +124,7 @@
"detail": "View the logs of the Arcane development environment",
"type": "shell",
"command": "./scripts/development/dev.sh",
- "args": [
- "logs",
- "${input:logService}"
- ],
+ "args": ["logs", "${input:logService}"],
"group": "test",
"presentation": {
"echo": true,
@@ -149,10 +146,7 @@
"detail": "Show current environment configuration from running container",
"type": "shell",
"command": "./scripts/development/dev.sh",
- "args": [
- "env",
- "${input:envService}"
- ],
+ "args": ["env", "${input:envService}"],
"group": "test",
"presentation": {
"echo": true,
@@ -173,11 +167,8 @@
"label": "Open Frontend",
"detail": "Open the frontend application in your default browser",
"type": "shell",
- "command": "sh",
- "args": [
- "-c",
- "if [ -f .env ]; then source .env; fi; open \"${APP_URL:-http://localhost:3000}\""
- ],
+ "command": "open",
+ "args": ["http://localhost:3000"],
"group": "test",
"presentation": {
"reveal": "never",
@@ -203,10 +194,7 @@
"detail": "Open interactive shell in a development service container",
"type": "shell",
"command": "./scripts/development/dev.sh",
- "args": [
- "shell",
- "${input:shellService}"
- ],
+ "args": ["shell", "${input:shellService}"],
"group": "test",
"presentation": {
"echo": true,
@@ -222,7 +210,7 @@
"label": "Shell"
}
}
- },
+ }
],
"inputs": [
{
@@ -290,4 +278,4 @@
"default": "backend"
}
]
-}
\ No newline at end of file
+}
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index a736f912e..940633926 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -5,7 +5,7 @@ Thanks for helping make Arcane better! We've built a modern, streamlined develop
## 🌟 Ways to Contribute
- πŸ› **Report bugs** using our issue templates
-- πŸ’‘ **Suggest features** or improvements
+- πŸ’‘ **Suggest features** or improvements
- πŸ”§ **Code contributions** (frontend, backend, DevOps)
- πŸ“š **Documentation** improvements
- 🌍 **Translations** via [Crowdin](https://crowdin.com/project/arcane-docker-management)
@@ -36,12 +36,14 @@ From the project root directory:
```
That's it! The development environment will automatically:
+
- πŸ”₯ Start both frontend and backend with hot reload
- 🐳 Handle all dependencies via Docker
- πŸ“Š Set up health checks and monitoring
- πŸ’Ύ Create persistent storage for your development data
Access your development environment:
+
- **Frontend**: http://localhost:3000 (SvelteKit with HMR)
- **Backend**: http://localhost:3552 (Go with Air hot reload)
@@ -52,6 +54,7 @@ For the best development experience, we've included VS Code tasks and workspace
### Recommended Extensions
When you open the project in VS Code, you'll be prompted to install our recommended extensions. These provide:
+
- Docker integration and management
- Go language support with debugging
- Svelte/TypeScript support
@@ -61,15 +64,15 @@ When you open the project in VS Code, you'll be prompted to install our recommen
Use `Ctrl/Cmd+Shift+P` β†’ "Tasks: Run Task" to access:
-| Task | Description |
-|------|-------------|
-| **Start** | Start the development environment |
-| **Stop** | Stop all services |
-| **Restart** | Restart all services |
-| **Rebuild** | Rebuild containers (after dependency changes) |
-| **Clean** | Remove all containers and volumes |
-| **Logs** | Interactive log viewer with service selection |
-| **Open Frontend** | Launch frontend in browser |
+| Task | Description |
+| ----------------- | --------------------------------------------- |
+| **Start** | Start the development environment |
+| **Stop** | Stop all services |
+| **Restart** | Restart all services |
+| **Rebuild** | Rebuild containers (after dependency changes) |
+| **Clean** | Remove all containers and volumes |
+| **Logs** | Interactive log viewer with service selection |
+| **Open Frontend** | Launch frontend in browser |
### Quick Build Shortcut
@@ -80,6 +83,7 @@ Press `Ctrl/Cmd+Shift+B` to run the default build task (Start Environment).
### Making Changes
1. **Create a feature branch**:
+
```bash
git switch -c feat/my-awesome-feature
# or
@@ -87,20 +91,22 @@ Press `Ctrl/Cmd+Shift+B` to run the default build task (Start Environment).
```
2. **Start development** (from project root):
+
```bash
./scripts/development/dev.sh start
# or use VS Code Task: "Start"
```
3. **Monitor logs** (choose your preferred method):
+
```bash
# Interactive selector
./scripts/development/dev.sh logs
-
+
# Specific service
./scripts/development/dev.sh logs frontend
./scripts/development/dev.sh logs backend
-
+
# Or use VS Code Task: "Logs"
```
@@ -113,6 +119,7 @@ Press `Ctrl/Cmd+Shift+B` to run the default build task (Start Environment).
**Note**: All commands should be run from the project root directory (`arcane/`).
### Environment Management
+
```bash
# Start development environment
./scripts/development/dev.sh start
@@ -134,6 +141,7 @@ Press `Ctrl/Cmd+Shift+B` to run the default build task (Start Environment).
```
### Debugging & Logs
+
```bash
# Interactive log selection
./scripts/development/dev.sh logs
@@ -167,12 +175,12 @@ If you need to run checks manually:
```bash
# Frontend checks
-docker compose -f docker-compose.dev.yml exec frontend pnpm check
-docker compose -f docker-compose.dev.yml exec frontend pnpm format
+docker compose -f docker/compose.dev.yaml exec frontend pnpm check
+docker compose -f docker/compose.dev.yaml exec frontend pnpm format
-# Backend checks
-docker compose -f docker-compose.dev.yml exec backend go fmt ./...
-docker compose -f docker-compose.dev.yml exec backend go vet ./...
+# Backend checks
+docker compose -f docker/compose.dev.yaml exec backend go fmt ./...
+docker compose -f docker/compose.dev.yaml exec backend go vet ./...
```
## πŸ“ Commit Guidelines
@@ -200,7 +208,7 @@ git commit -m "refactor: simplify API response handling"
- [ ] Code builds successfully in development environment
- [ ] Frontend hot reload works correctly
-- [ ] Backend hot reload works correctly
+- [ ] Backend hot reload works correctly
- [ ] No linting errors
- [ ] Commit messages follow conventional format
- [ ] PR description explains the change and why it's needed
@@ -210,6 +218,7 @@ git commit -m "refactor: simplify API response handling"
### Common Issues
**Port conflicts:**
+
```bash
# Stop and clean everything (from project root)
./scripts/development/dev.sh clean
@@ -220,6 +229,7 @@ lsof -i :3552 # Backend port
```
**Docker issues:**
+
```bash
# Reset Docker environment (from project root)
./scripts/development/dev.sh clean
@@ -230,6 +240,7 @@ docker system prune -f
```
**VS Code tasks not working:**
+
- Ensure you've opened the project root folder (`arcane/`) in VS Code, not a subfolder or parent directory
- Install recommended extensions when prompted
- Restart VS Code if tasks don't appear
diff --git a/backend/go.mod b/backend/go.mod
index 466c2bf64..1d373b8cd 100644
--- a/backend/go.mod
+++ b/backend/go.mod
@@ -2,6 +2,11 @@ module github.com/getarcaneapp/arcane/backend
go 1.25.4
+// TODO: Remove these replace directives after publishing modules
+replace go.getarcane.app/types => ../types
+
+replace go.getarcane.app/cli => ../cli
+
require (
github.com/cenkalti/backoff/v5 v5.0.3
github.com/compose-spec/compose-go/v2 v2.10.0
@@ -32,6 +37,8 @@ require (
github.com/shirou/gopsutil/v4 v4.25.11
github.com/spf13/cobra v1.10.1
github.com/stretchr/testify v1.11.1
+ go.getarcane.app/cli v0.0.0-00010101000000-000000000000
+ go.getarcane.app/types v0.0.0
go.podman.io/image/v5 v5.38.0
golang.org/x/crypto v0.45.0
golang.org/x/oauth2 v0.33.0
@@ -52,6 +59,8 @@ require (
github.com/bytedance/sonic v1.14.1 // indirect
github.com/bytedance/sonic/loader v0.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
+ github.com/clipperhouse/stringish v0.1.1 // indirect
+ github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
github.com/cloudwego/base64x v0.1.6 // indirect
github.com/containerd/console v1.0.5 // indirect
github.com/containerd/containerd/api v1.10.0 // indirect
@@ -116,7 +125,7 @@ require (
github.com/lib/pq v1.10.9 // indirect
github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
- github.com/mattn/go-runewidth v0.0.16 // indirect
+ github.com/mattn/go-runewidth v0.0.19 // indirect
github.com/mattn/go-shellwords v1.0.12 // indirect
github.com/mattn/go-sqlite3 v1.14.32 // indirect
github.com/miekg/pkcs11 v1.1.1 // indirect
@@ -154,7 +163,6 @@ require (
github.com/quic-go/qpack v0.5.1 // indirect
github.com/quic-go/quic-go v0.54.1 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
- github.com/rivo/uniseg v0.4.7 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.9.1 // indirect
diff --git a/backend/go.sum b/backend/go.sum
index 32cb71fdf..4d5088497 100644
--- a/backend/go.sum
+++ b/backend/go.sum
@@ -45,6 +45,10 @@ github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1x
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs=
+github.com/clipperhouse/stringish v0.1.1/go.mod h1:v/WhFtE1q0ovMta2+m+UbpZ+2/HEXNWYXQgCt4hdOzA=
+github.com/clipperhouse/uax29/v2 v2.3.0 h1:SNdx9DVUqMoBuBoW3iLOj4FQv3dN5mDtuqwuhIGpJy4=
+github.com/clipperhouse/uax29/v2 v2.3.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004 h1:lkAMpLVBDaj17e85keuznYcH5rqI438v41pKcBl4ZxQ=
github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA=
github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M=
@@ -311,8 +315,8 @@ github.com/magiconair/properties v1.8.9 h1:nWcCbLq1N2v/cpNsy5WvQ37Fb+YElfq20WJ/a
github.com/magiconair/properties v1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
-github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
-github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
+github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw=
+github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
github.com/mattn/go-sqlite3 v1.6.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
@@ -432,9 +436,6 @@ github.com/quic-go/quic-go v0.54.1 h1:4ZAWm0AhCb6+hE+l5Q1NAL0iRn/ZrMwqHRGQiFwj2e
github.com/quic-go/quic-go v0.54.1/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
-github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
-github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
-github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
diff --git a/backend/internal/api/auth_handler.go b/backend/internal/api/auth_handler.go
index 694b5fbde..410d12544 100644
--- a/backend/internal/api/auth_handler.go
+++ b/backend/internal/api/auth_handler.go
@@ -6,11 +6,13 @@ import (
"time"
"github.com/getarcaneapp/arcane/backend/internal/common"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/services"
"github.com/getarcaneapp/arcane/backend/internal/utils/cookie"
+ "github.com/getarcaneapp/arcane/backend/internal/utils/mapper"
"github.com/gin-gonic/gin"
+ "go.getarcane.app/types/auth"
+ "go.getarcane.app/types/user"
)
type AuthHandler struct {
@@ -33,7 +35,7 @@ func NewAuthHandler(group *gin.RouterGroup, userService *services.UserService, a
}
func (h *AuthHandler) Login(c *gin.Context) {
- var req dto.LoginRequest
+ var req auth.Login
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"success": false, "data": gin.H{"error": (&common.InvalidRequestFormatError{Err: err}).Error()}})
return
@@ -49,7 +51,7 @@ func (h *AuthHandler) Login(c *gin.Context) {
return
}
- user, tokenPair, err := h.authService.Login(c.Request.Context(), req.Username, req.Password)
+ userModel, tokenPair, err := h.authService.Login(c.Request.Context(), req.Username, req.Password)
if err != nil {
var statusCode int
var errorMsg string
@@ -77,8 +79,8 @@ func (h *AuthHandler) Login(c *gin.Context) {
maxAge += 60
cookie.CreateTokenCookie(c, maxAge, tokenPair.AccessToken)
- var out dto.UserResponseDto
- if mapErr := dto.MapStruct(user, &out); mapErr != nil {
+ var out user.Response
+ if mapErr := mapper.MapStruct(userModel, &out); mapErr != nil {
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": (&common.UserMappingError{Err: mapErr}).Error()}})
return
}
@@ -107,14 +109,14 @@ func (h *AuthHandler) GetCurrentUser(c *gin.Context) {
return
}
- user, err := h.userService.GetUser(c.Request.Context(), userID)
+ userModel, err := h.userService.GetUser(c.Request.Context(), userID)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": (&common.UserRetrievalError{Err: err}).Error()}})
return
}
- var out dto.UserResponseDto
- if mapErr := dto.MapStruct(user, &out); mapErr != nil {
+ var out user.Response
+ if mapErr := mapper.MapStruct(userModel, &out); mapErr != nil {
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": (&common.UserMappingError{Err: mapErr}).Error()}})
return
}
@@ -123,7 +125,7 @@ func (h *AuthHandler) GetCurrentUser(c *gin.Context) {
}
func (h *AuthHandler) RefreshToken(c *gin.Context) {
- var req dto.RefreshRequest
+ var req auth.Refresh
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"success": false, "data": gin.H{"error": (&common.InvalidRequestFormatError{Err: err}).Error()}})
return
@@ -165,12 +167,12 @@ func (h *AuthHandler) RefreshToken(c *gin.Context) {
}
func (h *AuthHandler) ChangePassword(c *gin.Context) {
- user, ok := middleware.RequireAuthentication(c)
+ userModel, ok := middleware.RequireAuthentication(c)
if !ok {
return
}
- var req dto.PasswordChangeRequest
+ var req auth.PasswordChange
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"success": false, "data": gin.H{"error": (&common.InvalidRequestFormatError{Err: err}).Error()}})
return
@@ -181,7 +183,7 @@ func (h *AuthHandler) ChangePassword(c *gin.Context) {
return
}
- err := h.authService.ChangePassword(c.Request.Context(), user.ID, req.CurrentPassword, req.NewPassword)
+ err := h.authService.ChangePassword(c.Request.Context(), userModel.ID, req.CurrentPassword, req.NewPassword)
if err != nil {
var statusCode int
var errorMsg string
diff --git a/backend/internal/api/container_handler.go b/backend/internal/api/container_handler.go
index c3bb06c82..c2946713c 100644
--- a/backend/internal/api/container_handler.go
+++ b/backend/internal/api/container_handler.go
@@ -17,7 +17,6 @@ import (
"github.com/docker/go-connections/nat"
"github.com/getarcaneapp/arcane/backend/internal/common"
"github.com/getarcaneapp/arcane/backend/internal/config"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/services"
httputil "github.com/getarcaneapp/arcane/backend/internal/utils/http"
@@ -25,6 +24,7 @@ import (
ws "github.com/getarcaneapp/arcane/backend/internal/utils/ws"
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
+ containertypes "go.getarcane.app/types/container"
)
type ContainerHandler struct {
@@ -316,7 +316,7 @@ func (h *ContainerHandler) List(c *gin.Context) {
return
}
- pagination.ApplyFilterResultsHeaders(&c.Writer, pagination.FilterResult[dto.ContainerSummaryDto]{
+ pagination.ApplyFilterResultsHeaders(&c.Writer, pagination.FilterResult[containertypes.Summary]{
Items: containers,
TotalCount: paginationResp.TotalItems,
TotalAvailable: paginationResp.GrandTotalItems,
@@ -341,7 +341,7 @@ func (h *ContainerHandler) GetByID(c *gin.Context) {
return
}
- details := dto.NewContainerDetailsDto(container)
+ details := containertypes.NewDetails(container)
c.JSON(http.StatusOK, gin.H{
"success": true,
@@ -445,7 +445,7 @@ func (h *ContainerHandler) GetContainerStatusCounts(c *gin.Context) {
return
}
- out := dto.ContainerStatusLengthsDto{
+ out := containertypes.StatusCounts{
RunningContainers: running,
StoppedContainers: stopped,
TotalContainers: total,
@@ -458,7 +458,7 @@ func (h *ContainerHandler) GetContainerStatusCounts(c *gin.Context) {
}
func (h *ContainerHandler) Create(c *gin.Context) {
- var req dto.CreateContainerDto
+ var req containertypes.Create
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
@@ -546,7 +546,7 @@ func (h *ContainerHandler) Create(c *gin.Context) {
return
}
- out := dto.ContainerCreatedDto{
+ out := containertypes.Created{
ID: containerJSON.ID,
Name: containerJSON.Name,
Image: containerJSON.Config.Image,
diff --git a/backend/internal/api/container_registry_handler.go b/backend/internal/api/container_registry_handler.go
index 6ed1147c8..eefffded1 100644
--- a/backend/internal/api/container_registry_handler.go
+++ b/backend/internal/api/container_registry_handler.go
@@ -6,14 +6,15 @@ import (
"net/http"
"github.com/getarcaneapp/arcane/backend/internal/common"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/services"
"github.com/getarcaneapp/arcane/backend/internal/utils"
+ "github.com/getarcaneapp/arcane/backend/internal/utils/mapper"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
registry "github.com/getarcaneapp/arcane/backend/internal/utils/registry"
"github.com/gin-gonic/gin"
+ "go.getarcane.app/types/containerregistry"
)
type ContainerRegistryHandler struct {
@@ -69,7 +70,7 @@ func (h *ContainerRegistryHandler) GetRegistry(c *gin.Context) {
return
}
- out, mapErr := dto.MapOne[*models.ContainerRegistry, dto.ContainerRegistryDto](registry)
+ out, mapErr := mapper.MapOne[*models.ContainerRegistry, containerregistry.Response](registry)
if mapErr != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
@@ -104,7 +105,7 @@ func (h *ContainerRegistryHandler) CreateRegistry(c *gin.Context) {
return
}
- out, mapErr := dto.MapOne[*models.ContainerRegistry, dto.ContainerRegistryDto](registry)
+ out, mapErr := mapper.MapOne[*models.ContainerRegistry, containerregistry.Response](registry)
if mapErr != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
@@ -141,7 +142,7 @@ func (h *ContainerRegistryHandler) UpdateRegistry(c *gin.Context) {
return
}
- out, mapErr := dto.MapOne[*models.ContainerRegistry, dto.ContainerRegistryDto](registry)
+ out, mapErr := mapper.MapOne[*models.ContainerRegistry, containerregistry.Response](registry)
if mapErr != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
@@ -212,7 +213,7 @@ func (h *ContainerRegistryHandler) TestRegistry(c *gin.Context) {
}
func (h *ContainerRegistryHandler) SyncRegistries(c *gin.Context) {
- var req dto.SyncRegistriesRequest
+ var req containerregistry.SyncRequest
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
diff --git a/backend/internal/api/customize_handler.go b/backend/internal/api/customize_handler.go
index 95a269da8..923c7f09c 100644
--- a/backend/internal/api/customize_handler.go
+++ b/backend/internal/api/customize_handler.go
@@ -5,10 +5,10 @@ import (
"strings"
"github.com/getarcaneapp/arcane/backend/internal/common"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/services"
"github.com/gin-gonic/gin"
+ "go.getarcane.app/types/search"
)
type CustomizeHandler struct {
@@ -28,7 +28,7 @@ func NewCustomizeHandler(group *gin.RouterGroup, customizeSearchService *service
// Search delegates to the customize search service and returns relevance-scored results
func (h *CustomizeHandler) Search(c *gin.Context) {
- var req dto.CustomizeSearchRequest
+ var req search.Request
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
diff --git a/backend/internal/api/environment_handler.go b/backend/internal/api/environment_handler.go
index cf2e245fa..67c8f7857 100644
--- a/backend/internal/api/environment_handler.go
+++ b/backend/internal/api/environment_handler.go
@@ -8,13 +8,14 @@ import (
"github.com/getarcaneapp/arcane/backend/internal/common"
"github.com/getarcaneapp/arcane/backend/internal/config"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/services"
"github.com/getarcaneapp/arcane/backend/internal/utils"
+ "github.com/getarcaneapp/arcane/backend/internal/utils/mapper"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
"github.com/gin-gonic/gin"
+ "go.getarcane.app/types/environment"
)
const LOCAL_DOCKER_ENVIRONMENT_ID = "0"
@@ -88,7 +89,7 @@ func (h *EnvironmentHandler) PairAgent(c *gin.Context) {
// Create
func (h *EnvironmentHandler) CreateEnvironment(c *gin.Context) {
- var req dto.CreateEnvironmentDto
+ var req environment.Create
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
@@ -152,7 +153,7 @@ func (h *EnvironmentHandler) CreateEnvironment(c *gin.Context) {
}()
}
- out, mapErr := dto.MapOne[*models.Environment, dto.EnvironmentDto](created)
+ out, mapErr := mapper.MapOne[*models.Environment, environment.Response](created)
if mapErr != nil {
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": (&common.EnvironmentMappingError{Err: mapErr}).Error()}})
return
@@ -181,13 +182,13 @@ func (h *EnvironmentHandler) ListEnvironments(c *gin.Context) {
func (h *EnvironmentHandler) GetEnvironment(c *gin.Context) {
environmentID := c.Param("id")
- environment, err := h.environmentService.GetEnvironmentByID(c.Request.Context(), environmentID)
+ env, err := h.environmentService.GetEnvironmentByID(c.Request.Context(), environmentID)
if err != nil {
c.JSON(http.StatusNotFound, gin.H{"success": false, "data": gin.H{"error": (&common.EnvironmentNotFoundError{}).Error()}})
return
}
- out, mapErr := dto.MapOne[*models.Environment, dto.EnvironmentDto](environment)
+ out, mapErr := mapper.MapOne[*models.Environment, environment.Response](env)
if mapErr != nil {
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": (&common.EnvironmentMappingError{Err: mapErr}).Error()}})
return
@@ -204,7 +205,7 @@ func (h *EnvironmentHandler) UpdateEnvironment(c *gin.Context) {
environmentID := c.Param("id")
isLocalEnv := environmentID == LOCAL_DOCKER_ENVIRONMENT_ID
- var req dto.UpdateEnvironmentDto
+ var req environment.Update
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
@@ -229,7 +230,7 @@ func (h *EnvironmentHandler) UpdateEnvironment(c *gin.Context) {
h.triggerPostUpdateTasksInternal(environmentID, updated, pairingSucceeded, &req)
- out, mapErr := dto.MapOne[*models.Environment, dto.EnvironmentDto](updated)
+ out, mapErr := mapper.MapOne[*models.Environment, environment.Response](updated)
if mapErr != nil {
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": (&common.EnvironmentMappingError{Err: mapErr}).Error()}})
return
@@ -238,7 +239,7 @@ func (h *EnvironmentHandler) UpdateEnvironment(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"success": true, "data": out})
}
-func (h *EnvironmentHandler) buildUpdateMapInternal(req *dto.UpdateEnvironmentDto, isLocalEnv bool) map[string]any {
+func (h *EnvironmentHandler) buildUpdateMapInternal(req *environment.Update, isLocalEnv bool) map[string]any {
updates := map[string]any{}
// For local environment, only allow name
@@ -263,7 +264,7 @@ type updateError struct {
message string
}
-func (h *EnvironmentHandler) handleEnvironmentPairingInternal(ctx context.Context, environmentID string, req *dto.UpdateEnvironmentDto, updates map[string]any, isLocalEnv bool) (bool, *updateError) {
+func (h *EnvironmentHandler) handleEnvironmentPairingInternal(ctx context.Context, environmentID string, req *environment.Update, updates map[string]any, isLocalEnv bool) (bool, *updateError) {
pairingSucceeded := false
// Local environment cannot be paired or have access token updated
@@ -301,7 +302,7 @@ func (h *EnvironmentHandler) handleEnvironmentPairingInternal(ctx context.Contex
return pairingSucceeded, nil
}
-func (h *EnvironmentHandler) triggerPostUpdateTasksInternal(environmentID string, updated *models.Environment, pairingSucceeded bool, req *dto.UpdateEnvironmentDto) {
+func (h *EnvironmentHandler) triggerPostUpdateTasksInternal(environmentID string, updated *models.Environment, pairingSucceeded bool, req *environment.Update) {
// Trigger health check after update to verify new configuration
// This runs in background and doesn't block the response
if updated.Enabled {
@@ -367,7 +368,7 @@ func (h *EnvironmentHandler) TestConnection(c *gin.Context) {
_ = c.ShouldBindJSON(&req)
status, err := h.environmentService.TestConnection(c.Request.Context(), environmentID, req.ApiUrl)
- resp := dto.TestConnectionDto{Status: status}
+ resp := environment.Test{Status: status}
if err != nil {
msg := err.Error()
resp.Message = &msg
diff --git a/backend/internal/api/event_handler.go b/backend/internal/api/event_handler.go
index cdb010f1a..675f76d6d 100644
--- a/backend/internal/api/event_handler.go
+++ b/backend/internal/api/event_handler.go
@@ -4,11 +4,11 @@ import (
"net/http"
"github.com/getarcaneapp/arcane/backend/internal/common"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/services"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
"github.com/gin-gonic/gin"
+ "go.getarcane.app/types/event"
)
type EventHandler struct {
@@ -76,7 +76,7 @@ func (h *EventHandler) GetEventsByEnvironment(c *gin.Context) {
}
func (h *EventHandler) CreateEvent(c *gin.Context) {
- var req dto.CreateEventDto
+ var req event.Create
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
diff --git a/backend/internal/api/image_handler.go b/backend/internal/api/image_handler.go
index 4cc6c7c3e..08404c8dc 100644
--- a/backend/internal/api/image_handler.go
+++ b/backend/internal/api/image_handler.go
@@ -11,11 +11,11 @@ import (
"strings"
"github.com/getarcaneapp/arcane/backend/internal/common"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/services"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
"github.com/gin-gonic/gin"
+ "go.getarcane.app/types/image"
)
type ImageHandler struct {
@@ -57,7 +57,7 @@ func (h *ImageHandler) List(c *gin.Context) {
return
}
- pagination.ApplyFilterResultsHeaders(&c.Writer, pagination.FilterResult[dto.ImageSummaryDto]{
+ pagination.ApplyFilterResultsHeaders(&c.Writer, pagination.FilterResult[image.Summary]{
Items: images,
TotalCount: paginationResp.TotalItems,
TotalAvailable: paginationResp.GrandTotalItems,
@@ -79,7 +79,7 @@ func (h *ImageHandler) GetByID(c *gin.Context) {
return
}
- out := dto.NewImageDetailSummaryDto(img)
+ out := image.NewDetailSummary(img)
c.JSON(http.StatusOK, gin.H{
"success": true,
@@ -111,7 +111,7 @@ func (h *ImageHandler) Remove(c *gin.Context) {
func (h *ImageHandler) Pull(c *gin.Context) {
ctx := c.Request.Context()
- var req dto.ImagePullDto
+ var req image.PullOptions
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
@@ -179,7 +179,7 @@ func (h *ImageHandler) Prune(c *gin.Context) {
return
}
- out := dto.NewImagePruneReportDto(*report)
+ out := image.NewPruneReport(*report)
c.JSON(http.StatusOK, gin.H{"success": true, "data": out})
}
@@ -214,7 +214,7 @@ func (h *ImageHandler) GetImageUsageCounts(c *gin.Context) {
return
}
- out := dto.ImageUsageCountsDto{
+ out := image.UsageCounts{
Inuse: inuse,
Unused: unused,
Total: total,
diff --git a/backend/internal/api/image_update_handler.go b/backend/internal/api/image_update_handler.go
index 344af5982..dbd6fa14e 100644
--- a/backend/internal/api/image_update_handler.go
+++ b/backend/internal/api/image_update_handler.go
@@ -4,10 +4,10 @@ import (
"net/http"
"github.com/getarcaneapp/arcane/backend/internal/common"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/services"
"github.com/gin-gonic/gin"
+ "go.getarcane.app/types/imageupdate"
)
type ImageUpdateHandler struct {
@@ -80,7 +80,7 @@ func (h *ImageUpdateHandler) CheckImageUpdateByID(c *gin.Context) {
}
func (h *ImageUpdateHandler) CheckMultipleImages(c *gin.Context) {
- var req dto.BatchImageUpdateRequest
+ var req imageupdate.BatchImageUpdateRequest
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
@@ -106,7 +106,7 @@ func (h *ImageUpdateHandler) CheckMultipleImages(c *gin.Context) {
return
}
- response := dto.BatchImageUpdateResponse(results)
+ response := imageupdate.BatchResponse(results)
c.JSON(http.StatusOK, gin.H{
"success": true,
@@ -115,7 +115,7 @@ func (h *ImageUpdateHandler) CheckMultipleImages(c *gin.Context) {
}
func (h *ImageUpdateHandler) CheckAllImages(c *gin.Context) {
- var req dto.BatchImageUpdateRequest
+ var req imageupdate.BatchImageUpdateRequest
_ = c.ShouldBindJSON(&req)
results, err := h.imageUpdateService.CheckAllImages(c.Request.Context(), 0, req.Credentials)
@@ -127,7 +127,7 @@ func (h *ImageUpdateHandler) CheckAllImages(c *gin.Context) {
return
}
- response := dto.BatchImageUpdateResponse(results)
+ response := imageupdate.BatchResponse(results)
c.JSON(http.StatusOK, gin.H{
"success": true,
diff --git a/backend/internal/api/network_handler.go b/backend/internal/api/network_handler.go
index 19a6dcffb..c33f7c3ef 100644
--- a/backend/internal/api/network_handler.go
+++ b/backend/internal/api/network_handler.go
@@ -5,11 +5,12 @@ import (
"github.com/docker/docker/api/types/network"
"github.com/getarcaneapp/arcane/backend/internal/common"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/services"
+ "github.com/getarcaneapp/arcane/backend/internal/utils/mapper"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
"github.com/gin-gonic/gin"
+ networktypes "go.getarcane.app/types/network"
)
type NetworkHandler struct {
@@ -48,7 +49,7 @@ func (h *NetworkHandler) List(c *gin.Context) {
return
}
- pagination.ApplyFilterResultsHeaders(&c.Writer, pagination.FilterResult[dto.NetworkSummaryDto]{
+ pagination.ApplyFilterResultsHeaders(&c.Writer, pagination.FilterResult[networktypes.Summary]{
Items: networks,
TotalCount: paginationResp.TotalItems,
TotalAvailable: paginationResp.GrandTotalItems,
@@ -73,7 +74,7 @@ func (h *NetworkHandler) GetByID(c *gin.Context) {
return
}
- out, mapErr := dto.MapOne[network.Inspect, dto.NetworkInspectDto](*networkInspect)
+ out, mapErr := mapper.MapOne[network.Inspect, networktypes.Inspect](*networkInspect)
if mapErr != nil {
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": (&common.NetworkMappingError{Err: mapErr}).Error()}})
return
@@ -113,7 +114,7 @@ func (h *NetworkHandler) Create(c *gin.Context) {
return
}
- out, mapErr := dto.MapOne[network.CreateResponse, dto.NetworkCreateResponseDto](*response)
+ out, mapErr := mapper.MapOne[network.CreateResponse, networktypes.CreateResponse](*response)
if mapErr != nil {
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": (&common.NetworkMappingError{Err: mapErr}).Error()}})
return
@@ -157,7 +158,7 @@ func (h *NetworkHandler) GetNetworkUsageCounts(c *gin.Context) {
return
}
- out := dto.NetworkUsageCounts{
+ out := networktypes.UsageCounts{
Inuse: inuse,
Unused: unused,
Total: total,
@@ -179,7 +180,7 @@ func (h *NetworkHandler) Prune(c *gin.Context) {
return
}
- out, mapErr := dto.MapOne[network.PruneReport, dto.NetworkPruneReportDto](*report)
+ out, mapErr := mapper.MapOne[network.PruneReport, networktypes.PruneReport](*report)
if mapErr != nil {
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": (&common.NetworkMappingError{Err: mapErr}).Error()}})
return
diff --git a/backend/internal/api/notification_handler.go b/backend/internal/api/notification_handler.go
index 27f277ebd..a3ce5f68e 100644
--- a/backend/internal/api/notification_handler.go
+++ b/backend/internal/api/notification_handler.go
@@ -4,11 +4,12 @@ import (
"net/http"
"github.com/getarcaneapp/arcane/backend/internal/common"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/services"
"github.com/gin-gonic/gin"
+ "go.getarcane.app/types/base"
+ "go.getarcane.app/types/notification"
)
type NotificationHandler struct {
@@ -45,13 +46,13 @@ func (h *NotificationHandler) GetAllSettings(c *gin.Context) {
}
// Map to DTOs
- responses := make([]dto.NotificationSettingsResponse, len(settings))
+ responses := make([]notification.Response, len(settings))
for i, setting := range settings {
- responses[i] = dto.NotificationSettingsResponse{
+ responses[i] = notification.Response{
ID: setting.ID,
- Provider: setting.Provider,
+ Provider: notification.Provider(setting.Provider),
Enabled: setting.Enabled,
- Config: setting.Config,
+ Config: base.JsonObject(setting.Config),
}
}
@@ -75,18 +76,18 @@ func (h *NotificationHandler) GetSettings(c *gin.Context) {
return
}
- response := dto.NotificationSettingsResponse{
+ response := notification.Response{
ID: settings.ID,
- Provider: settings.Provider,
+ Provider: notification.Provider(settings.Provider),
Enabled: settings.Enabled,
- Config: settings.Config,
+ Config: base.JsonObject(settings.Config),
}
c.JSON(http.StatusOK, response)
}
func (h *NotificationHandler) CreateOrUpdateSettings(c *gin.Context) {
- var req dto.NotificationSettingsRequest
+ var req notification.Update
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": (&common.InvalidRequestFormatError{Err: err}).Error()})
return
@@ -94,20 +95,20 @@ func (h *NotificationHandler) CreateOrUpdateSettings(c *gin.Context) {
settings, err := h.notificationService.CreateOrUpdateSettings(
c.Request.Context(),
- req.Provider,
+ models.NotificationProvider(req.Provider),
req.Enabled,
- req.Config,
+ models.JSON(req.Config),
)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": (&common.NotificationSettingsUpdateError{Err: err}).Error()})
return
}
- response := dto.NotificationSettingsResponse{
+ response := notification.Response{
ID: settings.ID,
- Provider: settings.Provider,
+ Provider: notification.Provider(settings.Provider),
Enabled: settings.Enabled,
- Config: settings.Config,
+ Config: base.JsonObject(settings.Config),
}
c.JSON(http.StatusOK, response)
@@ -160,7 +161,7 @@ func (h *NotificationHandler) GetAppriseSettings(c *gin.Context) {
return
}
- response := dto.AppriseSettingsResponse{
+ response := notification.AppriseResponse{
ID: settings.ID,
APIURL: settings.APIURL,
Enabled: settings.Enabled,
@@ -172,7 +173,7 @@ func (h *NotificationHandler) GetAppriseSettings(c *gin.Context) {
}
func (h *NotificationHandler) CreateOrUpdateAppriseSettings(c *gin.Context) {
- var req dto.AppriseSettingsRequest
+ var req notification.AppriseUpdate
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": (&common.InvalidRequestFormatError{Err: err}).Error()})
return
@@ -195,7 +196,7 @@ func (h *NotificationHandler) CreateOrUpdateAppriseSettings(c *gin.Context) {
return
}
- response := dto.AppriseSettingsResponse{
+ response := notification.AppriseResponse{
ID: settings.ID,
APIURL: settings.APIURL,
Enabled: settings.Enabled,
diff --git a/backend/internal/api/oidc_handler.go b/backend/internal/api/oidc_handler.go
index 8c4e3f485..98f3a0213 100644
--- a/backend/internal/api/oidc_handler.go
+++ b/backend/internal/api/oidc_handler.go
@@ -5,10 +5,11 @@ import (
"time"
"github.com/getarcaneapp/arcane/backend/internal/common"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/services"
"github.com/getarcaneapp/arcane/backend/internal/utils/cookie"
"github.com/gin-gonic/gin"
+ "go.getarcane.app/types/auth"
+ "go.getarcane.app/types/user"
)
type OidcHandler struct {
@@ -42,7 +43,7 @@ func (h *OidcHandler) GetOidcStatus(c *gin.Context) {
}
func (h *OidcHandler) GetOidcAuthUrl(c *gin.Context) {
- var req dto.OidcAuthUrlRequest
+ var req auth.OidcAuthUrlRequest
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
@@ -98,7 +99,7 @@ func (h *OidcHandler) HandleOidcCallback(c *gin.Context) {
return
}
- user, tokenPair, err := h.authService.OidcLogin(c.Request.Context(), *userInfo, tokenResp)
+ userModel, tokenPair, err := h.authService.OidcLogin(c.Request.Context(), *userInfo, tokenResp)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": (&common.AuthFailedError{Err: err}).Error()})
return
@@ -118,13 +119,13 @@ func (h *OidcHandler) HandleOidcCallback(c *gin.Context) {
"token": tokenPair.AccessToken,
"refreshToken": tokenPair.RefreshToken,
"expiresAt": tokenPair.ExpiresAt,
- "user": dto.UserResponseDto{
- ID: user.ID,
- Username: user.Username,
- DisplayName: user.DisplayName,
- Email: user.Email,
- Roles: user.Roles,
- OidcSubjectId: user.OidcSubjectId,
+ "user": user.Response{
+ ID: userModel.ID,
+ Username: userModel.Username,
+ DisplayName: userModel.DisplayName,
+ Email: userModel.Email,
+ Roles: userModel.Roles,
+ OidcSubjectId: userModel.OidcSubjectId,
},
})
}
diff --git a/backend/internal/api/project_handler.go b/backend/internal/api/project_handler.go
index ef274a4eb..6b4923fe4 100644
--- a/backend/internal/api/project_handler.go
+++ b/backend/internal/api/project_handler.go
@@ -12,15 +12,16 @@ import (
"github.com/getarcaneapp/arcane/backend/internal/common"
"github.com/getarcaneapp/arcane/backend/internal/config"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/services"
"github.com/getarcaneapp/arcane/backend/internal/utils"
httputil "github.com/getarcaneapp/arcane/backend/internal/utils/http"
+ "github.com/getarcaneapp/arcane/backend/internal/utils/mapper"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
ws "github.com/getarcaneapp/arcane/backend/internal/utils/ws"
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
+ "go.getarcane.app/types/project"
)
type ProjectHandler struct {
@@ -87,7 +88,7 @@ func (h *ProjectHandler) ListProjects(c *gin.Context) {
return
}
if projectsResponse == nil {
- projectsResponse = []dto.ProjectDetailsDto{}
+ projectsResponse = []project.Details{}
}
c.JSON(http.StatusOK, gin.H{
@@ -142,7 +143,7 @@ func (h *ProjectHandler) DownProject(c *gin.Context) {
}
func (h *ProjectHandler) CreateProject(c *gin.Context) {
- var req dto.CreateProjectDto
+ var req project.Create
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"success": false, "error": (&common.InvalidRequestFormatError{Err: err}).Error()})
return
@@ -155,8 +156,8 @@ func (h *ProjectHandler) CreateProject(c *gin.Context) {
return
}
- var response dto.CreateProjectReponseDto
- if err := dto.MapStruct(proj, &response); err != nil {
+ var response project.CreateReponse
+ if err := mapper.MapStruct(proj, &response); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": "failed to map response"})
return
}
@@ -220,7 +221,7 @@ func (h *ProjectHandler) RedeployProject(c *gin.Context) {
func (h *ProjectHandler) DestroyProject(c *gin.Context) {
projectID := c.Param("projectId")
- var req dto.DestroyProjectDto
+ var req project.Destroy
if c.Request.ContentLength > 0 {
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"success": false, "error": (&common.InvalidRequestFormatError{Err: err}).Error()})
@@ -250,7 +251,7 @@ func (h *ProjectHandler) PullProjectImages(c *gin.Context) {
return
}
- var req dto.ProjectImagePullDto
+ var req project.ImagePullRequest
if c.Request.ContentLength > 0 {
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"success": false, "error": (&common.InvalidRequestFormatError{Err: err}).Error()})
@@ -280,7 +281,7 @@ func (h *ProjectHandler) UpdateProject(c *gin.Context) {
return
}
- var req dto.UpdateProjectDto
+ var req project.Update
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"success": false, "error": (&common.InvalidRequestFormatError{Err: err}).Error()})
return
@@ -310,7 +311,7 @@ func (h *ProjectHandler) UpdateProjectInclude(c *gin.Context) {
return
}
- var req dto.UpdateProjectIncludeDto
+ var req project.UpdateIncludeFile
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"success": false, "error": (&common.InvalidRequestFormatError{Err: err}).Error()})
return
@@ -447,7 +448,7 @@ func (h *ProjectHandler) GetProjectStatusCounts(c *gin.Context) {
return
}
- out := dto.ProjectStatusCounts{
+ out := project.StatusCounts{
RunningProjects: int(running),
StoppedProjects: int(stopped),
TotalProjects: int(total),
diff --git a/backend/internal/api/settings_handler.go b/backend/internal/api/settings_handler.go
index e10f3daca..221165f7a 100644
--- a/backend/internal/api/settings_handler.go
+++ b/backend/internal/api/settings_handler.go
@@ -7,10 +7,12 @@ import (
"github.com/getarcaneapp/arcane/backend/internal/common"
"github.com/getarcaneapp/arcane/backend/internal/config"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/services"
+ "github.com/getarcaneapp/arcane/backend/internal/utils/mapper"
"github.com/gin-gonic/gin"
+ "go.getarcane.app/types/search"
+ "go.getarcane.app/types/settings"
)
type SettingsHandler struct {
@@ -38,7 +40,7 @@ func NewSettingsHandler(group *gin.RouterGroup, settingsService *services.Settin
// Search delegates to the settings search service and returns relevance-scored results
func (h *SettingsHandler) Search(c *gin.Context) {
- var req dto.SettingsSearchRequest
+ var req search.Request
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
@@ -69,10 +71,10 @@ func (h *SettingsHandler) GetSettings(c *gin.Context) {
environmentID := c.Param("id")
showAll := environmentID == "0"
- settings := h.settingsService.ListSettings(showAll)
+ settingsList := h.settingsService.ListSettings(showAll)
- var settingsDto []dto.PublicSettingDto
- if err := dto.MapStructList(settings, &settingsDto); err != nil {
+ var settingsDto []settings.PublicSetting
+ if err := mapper.MapStructList(settingsList, &settingsDto); err != nil {
_ = c.Error(err)
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
@@ -81,7 +83,7 @@ func (h *SettingsHandler) GetSettings(c *gin.Context) {
return
}
- settingsDto = append(settingsDto, dto.PublicSettingDto{
+ settingsDto = append(settingsDto, settings.PublicSetting{
Key: "uiConfigDisabled",
Value: strconv.FormatBool(config.Load().UIConfigurationDisabled),
Type: "boolean",
@@ -91,10 +93,10 @@ func (h *SettingsHandler) GetSettings(c *gin.Context) {
}
func (h *SettingsHandler) GetPublicSettings(c *gin.Context) {
- settings := h.settingsService.ListSettings(false)
+ settingsList := h.settingsService.ListSettings(false)
- var settingsDto []dto.PublicSettingDto
- if err := dto.MapStructList(settings, &settingsDto); err != nil {
+ var settingsDto []settings.PublicSetting
+ if err := mapper.MapStructList(settingsList, &settingsDto); err != nil {
_ = c.Error(err)
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
@@ -103,7 +105,7 @@ func (h *SettingsHandler) GetPublicSettings(c *gin.Context) {
return
}
- settingsDto = append(settingsDto, dto.PublicSettingDto{
+ settingsDto = append(settingsDto, settings.PublicSetting{
Key: "uiConfigDisabled",
Value: strconv.FormatBool(config.Load().UIConfigurationDisabled),
Type: "boolean",
@@ -115,7 +117,7 @@ func (h *SettingsHandler) GetPublicSettings(c *gin.Context) {
func (h *SettingsHandler) UpdateSettings(c *gin.Context) {
environmentID := c.Param("id")
- var req dto.UpdateSettingsDto
+ var req settings.Update
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
@@ -148,10 +150,10 @@ func (h *SettingsHandler) UpdateSettings(c *gin.Context) {
return
}
- settingDtos := make([]dto.SettingDto, 0, len(updatedSettings))
+ settingDtos := make([]settings.SettingDto, 0, len(updatedSettings))
for _, setting := range updatedSettings {
- settingDtos = append(settingDtos, dto.SettingDto{
- PublicSettingDto: dto.PublicSettingDto{
+ settingDtos = append(settingDtos, settings.SettingDto{
+ PublicSetting: settings.PublicSetting{
Key: setting.Key,
Type: "string",
Value: setting.Value,
diff --git a/backend/internal/api/system_handler.go b/backend/internal/api/system_handler.go
index 0dde56b4e..fc7fdbca6 100644
--- a/backend/internal/api/system_handler.go
+++ b/backend/internal/api/system_handler.go
@@ -19,7 +19,6 @@ import (
"github.com/getarcaneapp/arcane/backend/internal/common"
"github.com/getarcaneapp/arcane/backend/internal/config"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/services"
@@ -31,6 +30,8 @@ import (
"github.com/shirou/gopsutil/v4/disk"
"github.com/shirou/gopsutil/v4/host"
"github.com/shirou/gopsutil/v4/mem"
+ "go.getarcane.app/types/dockerinfo"
+ "go.getarcane.app/types/system"
)
const (
@@ -186,7 +187,7 @@ func (h *SystemHandler) GetDockerInfo(c *gin.Context) {
info.NCPU = cpuCount
info.MemTotal = memTotal
- dockerInfo := dto.DockerInfoDto{
+ dockerInfo := dockerinfo.Info{
Success: true,
APIVersion: version.APIVersion,
GitCommit: version.GitCommit,
@@ -204,7 +205,7 @@ func (h *SystemHandler) PruneAll(c *gin.Context) {
ctx := c.Request.Context()
slog.InfoContext(ctx, "System prune operation initiated")
- var req dto.PruneSystemDto
+ var req system.PruneAllRequest
if err := c.ShouldBindJSON(&req); err != nil {
slog.ErrorContext(ctx, "Failed to bind prune request JSON", "error", err, "client_ip", c.ClientIP())
c.JSON(http.StatusBadRequest, gin.H{
diff --git a/backend/internal/api/template_handler.go b/backend/internal/api/template_handler.go
index 395d2677d..dc3ee187f 100644
--- a/backend/internal/api/template_handler.go
+++ b/backend/internal/api/template_handler.go
@@ -5,12 +5,14 @@ import (
"net/http"
"github.com/getarcaneapp/arcane/backend/internal/common"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/services"
+ "github.com/getarcaneapp/arcane/backend/internal/utils/mapper"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
"github.com/gin-gonic/gin"
+ "go.getarcane.app/types/env"
+ "go.getarcane.app/types/template"
)
type TemplateHandler struct {
@@ -62,7 +64,7 @@ func (h *TemplateHandler) GetAllTemplatesPaginated(c *gin.Context) {
return
}
- pagination.ApplyFilterResultsHeaders(&c.Writer, pagination.FilterResult[dto.ComposeTemplateDto]{
+ pagination.ApplyFilterResultsHeaders(&c.Writer, pagination.FilterResult[template.Template]{
Items: templates,
TotalCount: paginationResp.TotalItems,
TotalAvailable: paginationResp.GrandTotalItems,
@@ -85,8 +87,8 @@ func (h *TemplateHandler) GetAllTemplates(c *gin.Context) {
return
}
- var out []dto.ComposeTemplateDto
- if mapped, mapErr := dto.MapSlice[models.ComposeTemplate, dto.ComposeTemplateDto](templates); mapErr == nil {
+ var out []template.Template
+ if mapped, mapErr := mapper.MapSlice[models.ComposeTemplate, template.Template](templates); mapErr == nil {
out = mapped
} else {
c.JSON(http.StatusInternalServerError, gin.H{
@@ -112,7 +114,7 @@ func (h *TemplateHandler) GetTemplate(c *gin.Context) {
return
}
- template, err := h.templateService.GetTemplate(c.Request.Context(), id)
+ tmpl, err := h.templateService.GetTemplate(c.Request.Context(), id)
if err != nil {
status := http.StatusInternalServerError
var msg string
@@ -129,8 +131,8 @@ func (h *TemplateHandler) GetTemplate(c *gin.Context) {
return
}
- var out dto.ComposeTemplateDto
- if mapErr := dto.MapStruct(template, &out); mapErr != nil {
+ var out template.Template
+ if mapErr := mapper.MapStruct(tmpl, &out); mapErr != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
"data": gin.H{"error": (&common.TemplateMappingError{Err: mapErr}).Error()},
@@ -185,7 +187,7 @@ func (h *TemplateHandler) CreateTemplate(c *gin.Context) {
return
}
- template := &models.ComposeTemplate{
+ tmpl := &models.ComposeTemplate{
Name: req.Name,
Description: req.Description,
Content: req.Content,
@@ -193,10 +195,10 @@ func (h *TemplateHandler) CreateTemplate(c *gin.Context) {
IsRemote: false,
}
if req.EnvContent != "" {
- template.EnvContent = &req.EnvContent
+ tmpl.EnvContent = &req.EnvContent
}
- if err := h.templateService.CreateTemplate(c.Request.Context(), template); err != nil {
+ if err := h.templateService.CreateTemplate(c.Request.Context(), tmpl); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
"data": gin.H{"error": (&common.TemplateCreationError{Err: err}).Error()},
@@ -204,8 +206,8 @@ func (h *TemplateHandler) CreateTemplate(c *gin.Context) {
return
}
- var out dto.ComposeTemplateDto
- if mapErr := dto.MapStruct(template, &out); mapErr != nil {
+ var out template.Template
+ if mapErr := mapper.MapStruct(tmpl, &out); mapErr != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
"data": gin.H{"error": (&common.TemplateMappingError{Err: mapErr}).Error()},
@@ -279,8 +281,8 @@ func (h *TemplateHandler) UpdateTemplate(c *gin.Context) {
return
}
- var out dto.ComposeTemplateDto
- if mapErr := dto.MapStruct(updated, &out); mapErr != nil {
+ var out template.Template
+ if mapErr := mapper.MapStruct(updated, &out); mapErr != nil {
c.JSON(http.StatusOK, gin.H{
"success": true,
"data": gin.H{"message": "Template updated successfully"},
@@ -384,7 +386,7 @@ func (h *TemplateHandler) GetRegistries(c *gin.Context) {
return
}
- out, mapErr := dto.MapSlice[models.TemplateRegistry, dto.TemplateRegistryDto](registries)
+ out, mapErr := mapper.MapSlice[models.TemplateRegistry, template.Registry](registries)
if mapErr != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
@@ -428,8 +430,8 @@ func (h *TemplateHandler) CreateRegistry(c *gin.Context) {
return
}
- var out dto.TemplateRegistryDto
- if mapErr := dto.MapStruct(registry, &out); mapErr != nil {
+ var out template.Registry
+ if mapErr := mapper.MapStruct(registry, &out); mapErr != nil {
c.JSON(http.StatusCreated, gin.H{
"success": true,
"data": gin.H{"message": "Registry created"},
@@ -562,24 +564,24 @@ func (h *TemplateHandler) DownloadTemplate(c *gin.Context) {
return
}
- template, err := h.templateService.GetTemplate(c.Request.Context(), id)
+ tmpl, err := h.templateService.GetTemplate(c.Request.Context(), id)
if err != nil {
c.JSON(http.StatusNotFound, gin.H{"success": false, "data": gin.H{"error": (&common.TemplateNotFoundError{}).Error()}})
return
}
- if !template.IsRemote {
+ if !tmpl.IsRemote {
c.JSON(http.StatusBadRequest, gin.H{"success": false, "data": gin.H{"error": (&common.TemplateAlreadyLocalError{}).Error()}})
return
}
- localTemplate, err := h.templateService.DownloadTemplate(c.Request.Context(), template)
+ localTemplate, err := h.templateService.DownloadTemplate(c.Request.Context(), tmpl)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "data": gin.H{"error": (&common.TemplateDownloadError{Err: err}).Error()}})
return
}
- var out dto.ComposeTemplateDto
- if mapErr := dto.MapStruct(localTemplate, &out); mapErr != nil {
+ var out template.Template
+ if mapErr := mapper.MapStruct(localTemplate, &out); mapErr != nil {
c.JSON(http.StatusOK, gin.H{"success": true, "data": gin.H{"message": "Template downloaded successfully"}})
return
}
@@ -607,7 +609,7 @@ func (h *TemplateHandler) GetGlobalVariables(c *gin.Context) {
}
func (h *TemplateHandler) UpdateGlobalVariables(c *gin.Context) {
- var req dto.UpdateVariablesRequest
+ var req env.Summary
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
diff --git a/backend/internal/api/updater_handler.go b/backend/internal/api/updater_handler.go
index db9881df0..bb7ce222f 100644
--- a/backend/internal/api/updater_handler.go
+++ b/backend/internal/api/updater_handler.go
@@ -5,10 +5,10 @@ import (
"strconv"
"github.com/getarcaneapp/arcane/backend/internal/common"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/services"
"github.com/gin-gonic/gin"
+ "go.getarcane.app/types/updater"
)
type UpdaterHandler struct {
@@ -28,7 +28,7 @@ func NewUpdaterHandler(group *gin.RouterGroup, updaterService *services.UpdaterS
}
func (h *UpdaterHandler) Run(c *gin.Context) {
- var req dto.UpdaterRunRequest
+ var req updater.Options
_ = c.ShouldBindJSON(&req)
out, err := h.updaterService.ApplyPending(c.Request.Context(), req.DryRun)
diff --git a/backend/internal/api/user_handler.go b/backend/internal/api/user_handler.go
index 6d8605b6c..8989850d1 100644
--- a/backend/internal/api/user_handler.go
+++ b/backend/internal/api/user_handler.go
@@ -5,12 +5,13 @@ import (
"time"
"github.com/getarcaneapp/arcane/backend/internal/common"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/services"
+ "github.com/getarcaneapp/arcane/backend/internal/utils/mapper"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
"github.com/gin-gonic/gin"
+ "go.getarcane.app/types/user"
)
type UserHandler struct {
@@ -52,7 +53,7 @@ func (h *UserHandler) ListUsers(c *gin.Context) {
}
func (h *UserHandler) CreateUser(c *gin.Context) {
- var req dto.CreateUserDto
+ var req user.Create
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
@@ -70,7 +71,7 @@ func (h *UserHandler) CreateUser(c *gin.Context) {
return
}
- user := &models.User{
+ userModel := &models.User{
Username: req.Username,
PasswordHash: hashedPassword,
DisplayName: req.DisplayName,
@@ -82,11 +83,11 @@ func (h *UserHandler) CreateUser(c *gin.Context) {
},
}
- if user.Roles == nil {
- user.Roles = []string{"user"}
+ if userModel.Roles == nil {
+ userModel.Roles = []string{"user"}
}
- createdUser, err := h.userService.CreateUser(c.Request.Context(), user)
+ createdUser, err := h.userService.CreateUser(c.Request.Context(), userModel)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
@@ -95,7 +96,7 @@ func (h *UserHandler) CreateUser(c *gin.Context) {
return
}
- out, err := dto.MapOne[*models.User, dto.UserResponseDto](createdUser)
+ out, err := mapper.MapOne[*models.User, user.Response](createdUser)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
@@ -113,7 +114,7 @@ func (h *UserHandler) CreateUser(c *gin.Context) {
func (h *UserHandler) GetUser(c *gin.Context) {
userID := c.Param("id")
- user, err := h.userService.GetUserByID(c.Request.Context(), userID)
+ userModel, err := h.userService.GetUserByID(c.Request.Context(), userID)
if err != nil {
c.JSON(http.StatusNotFound, gin.H{
"success": false,
@@ -122,7 +123,7 @@ func (h *UserHandler) GetUser(c *gin.Context) {
return
}
- out, err := dto.MapOne[*models.User, dto.UserResponseDto](user)
+ out, err := mapper.MapOne[*models.User, user.Response](userModel)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
@@ -140,7 +141,7 @@ func (h *UserHandler) GetUser(c *gin.Context) {
func (h *UserHandler) UpdateUser(c *gin.Context) {
userID := c.Param("id")
- var req dto.UpdateUserDto
+ var req user.Update
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
@@ -149,7 +150,7 @@ func (h *UserHandler) UpdateUser(c *gin.Context) {
return
}
- user, err := h.userService.GetUserByID(c.Request.Context(), userID)
+ userModel, err := h.userService.GetUserByID(c.Request.Context(), userID)
if err != nil {
c.JSON(http.StatusNotFound, gin.H{
"success": false,
@@ -159,16 +160,16 @@ func (h *UserHandler) UpdateUser(c *gin.Context) {
}
if req.DisplayName != nil {
- user.DisplayName = req.DisplayName
+ userModel.DisplayName = req.DisplayName
}
if req.Email != nil {
- user.Email = req.Email
+ userModel.Email = req.Email
}
if req.Roles != nil {
- user.Roles = req.Roles
+ userModel.Roles = req.Roles
}
if req.Locale != nil {
- user.Locale = req.Locale
+ userModel.Locale = req.Locale
}
if req.Password != nil && *req.Password != "" {
@@ -180,13 +181,13 @@ func (h *UserHandler) UpdateUser(c *gin.Context) {
})
return
}
- user.PasswordHash = hashedPassword
+ userModel.PasswordHash = hashedPassword
}
now := time.Now()
- user.UpdatedAt = &now
+ userModel.UpdatedAt = &now
- updatedUser, err := h.userService.UpdateUser(c.Request.Context(), user)
+ updatedUser, err := h.userService.UpdateUser(c.Request.Context(), userModel)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
@@ -195,7 +196,7 @@ func (h *UserHandler) UpdateUser(c *gin.Context) {
return
}
- out, err := dto.MapOne[*models.User, dto.UserResponseDto](updatedUser)
+ out, err := mapper.MapOne[*models.User, user.Response](updatedUser)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
diff --git a/backend/internal/api/volume_handler.go b/backend/internal/api/volume_handler.go
index 2b904da42..d00dd59b5 100644
--- a/backend/internal/api/volume_handler.go
+++ b/backend/internal/api/volume_handler.go
@@ -5,11 +5,11 @@ import (
"github.com/docker/docker/api/types/volume"
"github.com/getarcaneapp/arcane/backend/internal/common"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/middleware"
"github.com/getarcaneapp/arcane/backend/internal/services"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
"github.com/gin-gonic/gin"
+ volumetypes "go.getarcane.app/types/volume"
)
type VolumeHandler struct {
@@ -49,7 +49,7 @@ func (h *VolumeHandler) List(c *gin.Context) {
return
}
- pagination.ApplyFilterResultsHeaders(&c.Writer, pagination.FilterResult[dto.VolumeDto]{
+ pagination.ApplyFilterResultsHeaders(&c.Writer, pagination.FilterResult[volumetypes.Volume]{
Items: volumes,
TotalCount: paginationResp.TotalItems,
TotalAvailable: paginationResp.GrandTotalItems,
@@ -82,7 +82,7 @@ func (h *VolumeHandler) GetByName(c *gin.Context) {
}
func (h *VolumeHandler) Create(c *gin.Context) {
- var req dto.CreateVolumeDto
+ var req volumetypes.Create
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
@@ -188,7 +188,7 @@ func (h *VolumeHandler) GetVolumeUsageCounts(c *gin.Context) {
return
}
- out := dto.VolumeUsageCounts{
+ out := volumetypes.UsageCounts{
Inuse: running,
Unused: stopped,
Total: total,
diff --git a/backend/internal/cli/root.go b/backend/internal/cli/root.go
index 31f7d100b..ec37a5ad5 100644
--- a/backend/internal/cli/root.go
+++ b/backend/internal/cli/root.go
@@ -8,10 +8,10 @@ import (
"github.com/spf13/cobra"
"github.com/getarcaneapp/arcane/backend/internal/bootstrap"
- "github.com/getarcaneapp/arcane/backend/internal/cli/generate"
"github.com/getarcaneapp/arcane/backend/internal/cli/upgrade"
"github.com/getarcaneapp/arcane/backend/internal/config"
"github.com/getarcaneapp/arcane/backend/internal/utils/signals"
+ "go.getarcane.app/cli/pkg/generate"
)
var rootCmd = &cobra.Command{
diff --git a/backend/internal/dto/auth_dto.go b/backend/internal/dto/auth_dto.go
deleted file mode 100644
index c10ecd8d1..000000000
--- a/backend/internal/dto/auth_dto.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package dto
-
-type LoginRequest struct {
- Username string `json:"username" binding:"required"`
- Password string `json:"password" binding:"required"`
-}
-
-type RefreshRequest struct {
- RefreshToken string `json:"refreshToken" binding:"required"`
-}
-
-type PasswordChangeRequest struct {
- CurrentPassword string `json:"currentPassword"`
- NewPassword string `json:"newPassword" binding:"required"`
-}
diff --git a/backend/internal/dto/container_dto.go b/backend/internal/dto/container_dto.go
deleted file mode 100644
index 0f1840620..000000000
--- a/backend/internal/dto/container_dto.go
+++ /dev/null
@@ -1,369 +0,0 @@
-package dto
-
-import (
- "strconv"
- "strings"
-
- "github.com/docker/docker/api/types/container"
- "github.com/docker/docker/api/types/network"
-)
-
-type CreateContainerDto struct {
- Name string `json:"name" binding:"required"`
- Image string `json:"image" binding:"required"`
- Command []string `json:"command,omitempty"`
- Entrypoint []string `json:"entrypoint,omitempty"`
- WorkingDir string `json:"workingDir,omitempty"`
- User string `json:"user,omitempty"`
- Environment []string `json:"environment,omitempty"`
- Ports map[string]string `json:"ports,omitempty"`
- Volumes []string `json:"volumes,omitempty"`
- Networks []string `json:"networks,omitempty"`
- RestartPolicy string `json:"restartPolicy,omitempty"`
- Privileged bool `json:"privileged,omitempty"`
- AutoRemove bool `json:"autoRemove,omitempty"`
- Memory int64 `json:"memory,omitempty"`
- CPUs float64 `json:"cpus,omitempty"`
- Credentials []ContainerRegistryCredential `json:"credentials,omitempty"`
-}
-
-type ContainerStatusLengthsDto struct {
- RunningContainers int `json:"runningContainers"`
- StoppedContainers int `json:"stoppedContainers"`
- TotalContainers int `json:"totalContainers"`
-}
-
-type ContainerActionResult struct {
- Started []string `json:"started,omitempty"`
- Stopped []string `json:"stopped,omitempty"`
- Failed []string `json:"failed,omitempty"`
- Success bool `json:"success"`
- Errors []string `json:"errors,omitempty"`
-}
-
-type PortDto struct {
- IP string `json:"ip,omitempty"`
- PrivatePort int `json:"privatePort"`
- PublicPort int `json:"publicPort,omitempty"`
- Type string `json:"type"`
-}
-
-type MountDto struct {
- Type string `json:"type"`
- Name string `json:"name,omitempty"`
- Source string `json:"source,omitempty"`
- Destination string `json:"destination"`
- Driver string `json:"driver,omitempty"`
- Mode string `json:"mode,omitempty"`
- RW bool `json:"rw,omitempty"`
- Propagation string `json:"propagation,omitempty"`
-}
-
-type NetworkDto struct {
- IPAMConfig any `json:"ipamConfig"`
- Links []string `json:"links"`
- Aliases []string `json:"aliases"`
- MacAddress string `json:"macAddress"`
- DriverOpts map[string]string `json:"driverOpts"`
- GwPriority int `json:"gwPriority"`
- NetworkID string `json:"networkId"`
- EndpointID string `json:"endpointId"`
- Gateway string `json:"gateway"`
- IPAddress string `json:"ipAddress"`
- IPPrefixLen int `json:"ipPrefixLen"`
- IPv6Gateway string `json:"ipv6Gateway"`
- GlobalIPv6Address string `json:"globalIPv6Address"`
- GlobalIPv6PrefixLen int `json:"globalIPv6PrefixLen"`
- DNSNames []string `json:"dnsNames"`
-}
-
-type HostConfigDto struct {
- NetworkMode string `json:"networkMode"`
-}
-
-type NetworkSettingsDto struct {
- Networks map[string]NetworkDto `json:"networks"`
-}
-
-type ContainerSummaryDto struct {
- ID string `json:"id"`
- Names []string `json:"names"`
- Image string `json:"image"`
- ImageID string `json:"imageId"`
- Command string `json:"command"`
- Created int64 `json:"created"`
- Ports []PortDto `json:"ports"`
- Labels map[string]string `json:"labels"`
- State string `json:"state"`
- Status string `json:"status"`
- HostConfig HostConfigDto `json:"hostConfig"`
- NetworkSettings NetworkSettingsDto `json:"networkSettings"`
- Mounts []MountDto `json:"mounts"`
-}
-
-func NewContainerSummaryDto(c container.Summary) ContainerSummaryDto {
- ports := make([]PortDto, 0, len(c.Ports))
- for _, p := range c.Ports {
- ports = append(ports, PortDto{
- IP: p.IP,
- PrivatePort: int(p.PrivatePort),
- PublicPort: int(p.PublicPort),
- Type: p.Type,
- })
- }
-
- mounts := make([]MountDto, 0, len(c.Mounts))
- for _, m := range c.Mounts {
- mounts = append(mounts, MountDto{
- Type: string(m.Type),
- Name: m.Name,
- Source: m.Source,
- Destination: m.Destination,
- Driver: m.Driver,
- Mode: m.Mode,
- RW: m.RW,
- Propagation: string(m.Propagation),
- })
- }
-
- networks := map[string]NetworkDto{}
- if c.NetworkSettings != nil && c.NetworkSettings.Networks != nil {
- for name, n := range c.NetworkSettings.Networks {
- networks[name] = mapEndpointSettings(n)
- }
- }
-
- return ContainerSummaryDto{
- ID: c.ID,
- Names: c.Names,
- Image: c.Image,
- ImageID: c.ImageID,
- Command: c.Command,
- Created: c.Created,
- Ports: ports,
- Labels: c.Labels,
- State: c.State,
- Status: c.Status,
- HostConfig: HostConfigDto{
- NetworkMode: c.HostConfig.NetworkMode,
- },
- NetworkSettings: NetworkSettingsDto{
- Networks: networks,
- },
- Mounts: mounts,
- }
-}
-
-func mapEndpointSettings(n *network.EndpointSettings) NetworkDto {
- if n == nil {
- return NetworkDto{}
- }
- // DriverOpts can be nil in Docker types; ensure non-nil map for JSON stability if needed
- var driverOpts map[string]string
- if n.DriverOpts != nil {
- driverOpts = n.DriverOpts
- }
-
- return NetworkDto{
- IPAMConfig: n.IPAMConfig,
- Links: n.Links,
- Aliases: n.Aliases,
- MacAddress: n.MacAddress,
- DriverOpts: driverOpts,
- GwPriority: n.GwPriority,
- NetworkID: n.NetworkID,
- EndpointID: n.EndpointID,
- Gateway: n.Gateway,
- IPAddress: n.IPAddress,
- IPPrefixLen: n.IPPrefixLen,
- IPv6Gateway: n.IPv6Gateway,
- GlobalIPv6Address: n.GlobalIPv6Address,
- GlobalIPv6PrefixLen: n.GlobalIPv6PrefixLen,
- DNSNames: n.DNSNames,
- }
-}
-
-type ContainerStateDto struct {
- Status string `json:"status"`
- Running bool `json:"running"`
- ExitCode int `json:"exitCode,omitempty"`
- StartedAt string `json:"startedAt,omitempty"`
- FinishedAt string `json:"finishedAt,omitempty"`
-}
-
-type ContainerConfigDetailsDto struct {
- Env []string `json:"env,omitempty"`
- Cmd []string `json:"cmd,omitempty"`
- Entrypoint []string `json:"entrypoint,omitempty"`
- WorkingDir string `json:"workingDir,omitempty"`
- User string `json:"user,omitempty"`
-}
-
-type HostConfigDetailsDto struct {
- RestartPolicy string `json:"restartPolicy,omitempty"`
- Privileged bool `json:"privileged,omitempty"`
- AutoRemove bool `json:"autoRemove,omitempty"`
- NanoCPUs int64 `json:"nanoCpus,omitempty"`
- Memory int64 `json:"memory,omitempty"`
-}
-
-type ContainerDetailsDto struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Image string `json:"image"`
- ImageID string `json:"imageId"`
- Created string `json:"created"`
- State ContainerStateDto `json:"state"`
- Config ContainerConfigDetailsDto `json:"config"`
- HostConfig HostConfigDetailsDto `json:"hostConfig"`
- NetworkSettings NetworkSettingsDto `json:"networkSettings"`
- Ports []PortDto `json:"ports"`
- Mounts []MountDto `json:"mounts"`
- Labels map[string]string `json:"labels,omitempty"`
-}
-
-type ContainerCreatedDto struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Image string `json:"image"`
- Status string `json:"status"`
- Created string `json:"created"`
-}
-
-func NewContainerDetailsDto(c *container.InspectResponse) ContainerDetailsDto {
- ports := make([]PortDto, 0)
- if c.NetworkSettings != nil && c.NetworkSettings.Ports != nil {
- for p, bindings := range c.NetworkSettings.Ports {
- privatePort, _ := strconv.Atoi(p.Port())
- typ := string(p.Proto())
-
- // When no host bindings exist, still include the private port
- if len(bindings) == 0 {
- ports = append(ports, PortDto{
- PrivatePort: privatePort,
- Type: typ,
- })
- continue
- }
- for _, b := range bindings {
- pub, _ := strconv.Atoi(b.HostPort)
- ports = append(ports, PortDto{
- IP: b.HostIP,
- PrivatePort: privatePort,
- PublicPort: pub,
- Type: typ,
- })
- }
- }
- }
-
- mounts := make([]MountDto, 0, len(c.Mounts))
- for _, m := range c.Mounts {
- mounts = append(mounts, mapMountPoint(m))
- }
-
- networks := map[string]NetworkDto{}
- if c.NetworkSettings != nil && c.NetworkSettings.Networks != nil {
- for name, n := range c.NetworkSettings.Networks {
- networks[name] = mapEndpointSettings(n)
- }
- }
-
- var host HostConfigDetailsDto
- if c.HostConfig != nil {
- host = HostConfigDetailsDto{
- RestartPolicy: string(c.HostConfig.RestartPolicy.Name),
- Privileged: c.HostConfig.Privileged,
- AutoRemove: c.HostConfig.AutoRemove,
- NanoCPUs: c.HostConfig.NanoCPUs,
- Memory: c.HostConfig.Memory,
- }
- }
-
- var cfg ContainerConfigDetailsDto
- labels := map[string]string{}
- imageName := ""
- if c.Config != nil {
- cfg = ContainerConfigDetailsDto{
- Env: append([]string{}, c.Config.Env...),
- Cmd: append([]string{}, c.Config.Cmd...),
- Entrypoint: append([]string{}, c.Config.Entrypoint...),
- WorkingDir: c.Config.WorkingDir,
- User: c.Config.User,
- }
- imageName = c.Config.Image
- if c.Config.Labels != nil {
- for k, v := range c.Config.Labels {
- labels[k] = v
- }
- }
- }
-
- name := strings.TrimPrefix(c.Name, "/")
-
- out := ContainerDetailsDto{
- ID: c.ID,
- Name: name,
- Image: imageName,
- ImageID: c.Image,
- Created: c.Created,
- State: ContainerStateDto{
- Status: safeStateStatus(c),
- Running: safeStateRunning(c),
- ExitCode: safeStateExitCode(c),
- StartedAt: safeStateStartedAt(c),
- FinishedAt: safeStateFinishedAt(c),
- },
- Config: cfg,
- HostConfig: host,
- NetworkSettings: NetworkSettingsDto{
- Networks: networks,
- },
- Ports: ports,
- Mounts: mounts,
- Labels: labels,
- }
-
- return out
-}
-
-func mapMountPoint(m container.MountPoint) MountDto {
- return MountDto{
- Type: string(m.Type),
- Name: m.Name,
- Source: m.Source,
- Destination: m.Destination,
- Driver: m.Driver,
- Mode: m.Mode,
- RW: m.RW,
- Propagation: string(m.Propagation),
- }
-}
-
-func safeStateStatus(c *container.InspectResponse) string {
- if c.State == nil {
- return ""
- }
- return c.State.Status
-}
-func safeStateRunning(c *container.InspectResponse) bool {
- return c.State != nil && c.State.Running
-}
-func safeStateExitCode(c *container.InspectResponse) int {
- if c.State == nil {
- return 0
- }
- return c.State.ExitCode
-}
-func safeStateStartedAt(c *container.InspectResponse) string {
- if c.State == nil {
- return ""
- }
- return c.State.StartedAt
-}
-func safeStateFinishedAt(c *container.InspectResponse) string {
- if c.State == nil {
- return ""
- }
- return c.State.FinishedAt
-}
diff --git a/backend/internal/dto/container_registry_dto.go b/backend/internal/dto/container_registry_dto.go
deleted file mode 100644
index 17c3f0893..000000000
--- a/backend/internal/dto/container_registry_dto.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package dto
-
-import "time"
-
-type ContainerRegistryDto struct {
- ID string `json:"id"`
- URL string `json:"url"`
- Username string `json:"username"`
- Description *string `json:"description,omitempty"`
- Insecure bool `json:"insecure"`
- Enabled bool `json:"enabled"`
- CreatedAt time.Time `json:"createdAt"`
- UpdatedAt time.Time `json:"updatedAt"`
-}
-
-type ContainerRegistrySyncDto struct {
- ID string `json:"id" binding:"required"`
- URL string `json:"url" binding:"required"`
- Username string `json:"username" binding:"required"`
- Token string `json:"token" binding:"required"`
- Description *string `json:"description,omitempty"`
- Insecure bool `json:"insecure"`
- Enabled bool `json:"enabled"`
- CreatedAt time.Time `json:"createdAt"`
- UpdatedAt time.Time `json:"updatedAt"`
-}
-
-type ContainerRegistryCredential struct {
- URL string `json:"url" binding:"required"`
- Username string `json:"username" binding:"required"`
- Token string `json:"token" binding:"required"`
- Enabled bool `json:"enabled"`
-}
-
-type SyncRegistriesRequest struct {
- Registries []ContainerRegistrySyncDto `json:"registries" binding:"required"`
-}
diff --git a/backend/internal/dto/customize_search_dto.go b/backend/internal/dto/customize_search_dto.go
deleted file mode 100644
index f58e7d445..000000000
--- a/backend/internal/dto/customize_search_dto.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package dto
-
-type CustomizationMeta struct {
- Key string `json:"key"`
- Label string `json:"label"`
- Type string `json:"type"`
- Keywords []string `json:"keywords,omitempty"`
- Description string `json:"description,omitempty"`
-}
-
-type CustomizeCategory struct {
- ID string `json:"id"`
- Title string `json:"title"`
- Description string `json:"description"`
- Icon string `json:"icon"`
- URL string `json:"url"`
- Keywords []string `json:"keywords"`
- Customizations []CustomizationMeta `json:"customizations"`
- MatchingCustomizations []CustomizationMeta `json:"matchingCustomizations,omitempty"`
- RelevanceScore int `json:"relevanceScore,omitempty"`
-}
-
-type CustomizeSearchRequest struct {
- Query string `json:"query" binding:"required,min=1"`
-}
-
-type CustomizeSearchResponse struct {
- Results []CustomizeCategory `json:"results"`
- Query string `json:"query"`
- Count int `json:"count"`
-}
diff --git a/backend/internal/dto/docker_info_dto.go b/backend/internal/dto/docker_info_dto.go
deleted file mode 100644
index 5d5167609..000000000
--- a/backend/internal/dto/docker_info_dto.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package dto
-
-import "github.com/docker/docker/api/types/system"
-
-type DockerInfoDto struct {
- Success bool `json:"success"`
- APIVersion string `json:"apiVersion"`
- GitCommit string `json:"gitCommit"`
- GoVersion string `json:"goVersion"`
- Os string `json:"os"`
- Arch string `json:"arch"`
- BuildTime string `json:"buildTime"`
- system.Info
-}
diff --git a/backend/internal/dto/environment_dto.go b/backend/internal/dto/environment_dto.go
deleted file mode 100644
index b9d5d0ee5..000000000
--- a/backend/internal/dto/environment_dto.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package dto
-
-type CreateEnvironmentDto struct {
- ApiUrl string `json:"apiUrl" binding:"required,url"`
- Name *string `json:"name,omitempty"`
- Enabled *bool `json:"enabled,omitempty"`
- AccessToken *string `json:"accessToken,omitempty"`
- BootstrapToken *string `json:"bootstrapToken,omitempty"`
-}
-
-type UpdateEnvironmentDto struct {
- ApiUrl *string `json:"apiUrl,omitempty" binding:"omitempty,url"`
- Name *string `json:"name,omitempty"`
- Enabled *bool `json:"enabled,omitempty"`
- AccessToken *string `json:"accessToken,omitempty"`
- BootstrapToken *string `json:"bootstrapToken,omitempty"`
-}
-
-type TestConnectionDto struct {
- Status string `json:"status"`
- Message *string `json:"message,omitempty"`
-}
-
-type EnvironmentDto struct {
- ID string `json:"id"`
- Name string `json:"name,omitempty"`
- ApiUrl string `json:"apiUrl"`
- Status string `json:"status"`
- Enabled bool `json:"enabled"`
-}
diff --git a/backend/internal/dto/event_dto.go b/backend/internal/dto/event_dto.go
deleted file mode 100644
index 03f79b845..000000000
--- a/backend/internal/dto/event_dto.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package dto
-
-import "time"
-
-type EventDto struct {
- ID string `json:"id"`
- Type string `json:"type"`
- Severity string `json:"severity"`
- Title string `json:"title"`
- Description string `json:"description,omitempty"`
- ResourceType *string `json:"resourceType,omitempty"`
- ResourceID *string `json:"resourceId,omitempty"`
- ResourceName *string `json:"resourceName,omitempty"`
- UserID *string `json:"userId,omitempty"`
- Username *string `json:"username,omitempty"`
- EnvironmentID *string `json:"environmentId,omitempty"`
- Metadata map[string]interface{} `json:"metadata,omitempty"`
- Timestamp time.Time `json:"timestamp"`
- CreatedAt time.Time `json:"createdAt"`
- UpdatedAt *time.Time `json:"updatedAt,omitempty"`
-}
-
-type CreateEventDto struct {
- Type string `json:"type" binding:"required"`
- Severity string `json:"severity,omitempty"`
- Title string `json:"title" binding:"required"`
- Description string `json:"description,omitempty"`
- ResourceType *string `json:"resourceType,omitempty"`
- ResourceID *string `json:"resourceId,omitempty"`
- ResourceName *string `json:"resourceName,omitempty"`
- UserID *string `json:"userId,omitempty"`
- Username *string `json:"username,omitempty"`
- EnvironmentID *string `json:"environmentId,omitempty"`
- Metadata map[string]interface{} `json:"metadata,omitempty"`
-}
-
-type EventListDto struct {
- Events []EventDto `json:"events"`
- Total int `json:"total"`
- Page int `json:"page"`
- PageSize int `json:"pageSize"`
- TotalPages int `json:"totalPages"`
- HasNext bool `json:"hasNext"`
- HasPrevious bool `json:"hasPrevious"`
-}
diff --git a/backend/internal/dto/image_dto.go b/backend/internal/dto/image_dto.go
deleted file mode 100644
index 64f8c718b..000000000
--- a/backend/internal/dto/image_dto.go
+++ /dev/null
@@ -1,199 +0,0 @@
-package dto
-
-import (
- "strings"
- "time"
-
- "github.com/docker/docker/api/types/image"
-)
-
-type ImagePullDto struct {
- ImageName string `json:"imageName" binding:"required"`
- Credentials []ContainerRegistryCredential `json:"credentials,omitempty"`
-}
-
-type ImageUpdateInfoDto struct {
- HasUpdate bool `json:"hasUpdate"`
- UpdateType string `json:"updateType"`
- CurrentVersion string `json:"currentVersion"`
- LatestVersion string `json:"latestVersion"`
- CurrentDigest string `json:"currentDigest"`
- LatestDigest string `json:"latestDigest"`
- CheckTime time.Time `json:"checkTime"`
- ResponseTimeMs int `json:"responseTimeMs"`
- Error string `json:"error"`
-
- AuthMethod string `json:"authMethod,omitempty"`
- AuthUsername string `json:"authUsername,omitempty"`
- AuthRegistry string `json:"authRegistry,omitempty"`
- UsedCredential bool `json:"usedCredential,omitempty"`
-}
-
-type ImageUsageCountsDto struct {
- Inuse int `json:"imagesInuse"`
- Unused int `json:"imagesUnused"`
- Total int `json:"totalImages"`
- TotalSize int64 `json:"totalImageSize"`
-}
-
-type ImageSummaryDto struct {
- ID string `json:"id" sortable:"true"`
- RepoTags []string `json:"repoTags"`
- RepoDigests []string `json:"repoDigests"`
- Created int64 `json:"created" sortable:"true"`
- Size int64 `json:"size" sortable:"true"`
- VirtualSize int64 `json:"virtualSize"`
- Labels map[string]interface{} `json:"labels"`
- InUse bool `json:"inUse" sortable:"true"`
- Repo string `json:"repo" sortable:"true"`
- Tag string `json:"tag" sortable:"true"`
- UpdateInfo *ImageUpdateInfoDto `json:"updateInfo,omitempty"`
-}
-
-type ImageDetailSummaryDto struct {
- Id string `json:"id"`
- RepoTags []string `json:"repoTags"`
- RepoDigests []string `json:"repoDigests"`
- Parent string `json:"parent"`
- Comment string `json:"comment"`
- Created string `json:"created"`
- DockerVersion string `json:"dockerVersion"`
- Author string `json:"author"`
- Config struct {
- ExposedPorts map[string]struct{} `json:"exposedPorts,omitempty"`
- Env []string `json:"env,omitempty"`
- Cmd []string `json:"cmd,omitempty"`
- Volumes map[string]struct{} `json:"volumes,omitempty"`
- WorkingDir string `json:"workingDir,omitempty"`
- ArgsEscaped bool `json:"argsEscaped,omitempty"`
- } `json:"config"`
- Architecture string `json:"architecture"`
- Os string `json:"os"`
- Size int64 `json:"size"`
- GraphDriver struct {
- Data any `json:"data"`
- Name string `json:"name"`
- } `json:"graphDriver"`
- RootFs struct {
- Type string `json:"type"`
- Layers []string `json:"layers"`
- } `json:"rootFs"`
- Metadata struct {
- LastTagTime string `json:"lastTagTime"`
- } `json:"metadata"`
- Descriptor struct {
- MediaType string `json:"mediaType"`
- Digest string `json:"digest"`
- Size int64 `json:"size"`
- } `json:"descriptor"`
-}
-
-func NewImageDetailSummaryDto(src *image.InspectResponse) ImageDetailSummaryDto {
- var out ImageDetailSummaryDto
-
- out.Id = src.ID
- out.RepoTags = append(out.RepoTags, src.RepoTags...)
- out.RepoDigests = append(out.RepoDigests, src.RepoDigests...)
- out.Comment = src.Comment
- out.Author = src.Author
-
- if src.Config != nil {
- if len(src.Config.ExposedPorts) > 0 {
- out.Config.ExposedPorts = make(map[string]struct{}, len(src.Config.ExposedPorts))
- for p := range src.Config.ExposedPorts {
- out.Config.ExposedPorts[string(p)] = struct{}{}
- }
- }
- if len(src.Config.Env) > 0 {
- out.Config.Env = append(out.Config.Env, src.Config.Env...)
- }
- if len(src.Config.Cmd) > 0 {
- out.Config.Cmd = append(out.Config.Cmd, src.Config.Cmd...)
- }
- if len(src.Config.Volumes) > 0 {
- out.Config.Volumes = make(map[string]struct{}, len(src.Config.Volumes))
- for v := range src.Config.Volumes {
- out.Config.Volumes[v] = struct{}{}
- }
- }
- out.Config.WorkingDir = src.Config.WorkingDir
- }
-
- out.Architecture = src.Architecture
- out.Os = src.Os
- out.Size = src.Size
-
- out.GraphDriver.Name = src.GraphDriver.Name
- if src.GraphDriver.Data != nil {
- out.GraphDriver.Data = src.GraphDriver.Data
- }
-
- out.RootFs.Type = src.RootFS.Type
- if len(src.RootFS.Layers) > 0 {
- out.RootFs.Layers = append(out.RootFs.Layers, src.RootFS.Layers...)
- }
-
- if !src.Metadata.LastTagTime.IsZero() {
- out.Metadata.LastTagTime = src.Metadata.LastTagTime.Format(time.RFC3339Nano)
- }
-
- // Best-effort descriptor from first digest
- out.Descriptor.MediaType = "application/vnd.oci.image.index.v1+json"
- if len(src.RepoDigests) > 0 {
- parts := strings.SplitN(src.RepoDigests[0], "@", 2)
- if len(parts) == 2 {
- out.Descriptor.Digest = parts[1]
- }
- }
-
- return out
-}
-
-type ImageInspectDto struct {
- ID string `json:"id"`
- RepoTags []string `json:"repoTags"`
- RepoDigests []string `json:"repoDigests"`
- Size int64 `json:"size"`
- Created string `json:"created"`
- OS string `json:"os"`
- Architecture string `json:"architecture"`
- Author string `json:"author"`
- Comment string `json:"comment"`
-}
-
-type ImageHistoryItemDto struct {
- ID string `json:"id"`
- Created int64 `json:"created"`
- CreatedBy string `json:"createdBy"`
- Tags []string `json:"tags"`
- Size int64 `json:"size"`
- Comment string `json:"comment"`
-}
-
-type ImagePruneReportDto struct {
- ImagesDeleted []string `json:"imagesDeleted"`
- SpaceReclaimed uint64 `json:"spaceReclaimed"`
-}
-
-func NewImagePruneReportDto(src image.PruneReport) ImagePruneReportDto {
- out := ImagePruneReportDto{
- ImagesDeleted: make([]string, 0, len(src.ImagesDeleted)),
- SpaceReclaimed: src.SpaceReclaimed,
- }
- for _, d := range src.ImagesDeleted {
- if d.Deleted != "" {
- out.ImagesDeleted = append(out.ImagesDeleted, d.Deleted)
- } else if d.Untagged != "" {
- out.ImagesDeleted = append(out.ImagesDeleted, d.Untagged)
- }
- }
- return out
-}
-
-type MessageDto struct {
- Message string `json:"message"`
-}
-
-type ImageLoadResultDto struct {
- Stream string `json:"stream,omitempty"`
-}
diff --git a/backend/internal/dto/image_update_dto.go b/backend/internal/dto/image_update_dto.go
deleted file mode 100644
index df3c76995..000000000
--- a/backend/internal/dto/image_update_dto.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package dto
-
-import "time"
-
-type ImageUpdateResponse struct {
- HasUpdate bool `json:"hasUpdate"`
- UpdateType string `json:"updateType"`
- CurrentVersion string `json:"currentVersion"`
- LatestVersion string `json:"latestVersion,omitempty"`
- CurrentDigest string `json:"currentDigest,omitempty"`
- LatestDigest string `json:"latestDigest,omitempty"`
- CheckTime time.Time `json:"checkTime"`
- ResponseTimeMs int `json:"responseTimeMs"`
- Error string `json:"error,omitempty"`
-
- AuthMethod string `json:"authMethod,omitempty"` // "none" | "anonymous" | "credential" | "unknown"
- AuthUsername string `json:"authUsername,omitempty"` // for credential method
- AuthRegistry string `json:"authRegistry,omitempty"` // registry host
- UsedCredential bool `json:"usedCredential,omitempty"` // convenience flag
-}
-
-type ImageUpdateSummaryResponse struct {
- TotalImages int `json:"totalImages"`
- ImagesWithUpdates int `json:"imagesWithUpdates"`
- DigestUpdates int `json:"digestUpdates"`
- ErrorsCount int `json:"errorsCount"`
-}
-
-type BatchImageUpdateRequest struct {
- ImageRefs []string `json:"imageRefs" binding:"required"`
- Credentials []ContainerRegistryCredential `json:"credentials,omitempty"`
-}
-
-type BatchImageUpdateResponse map[string]*ImageUpdateResponse
diff --git a/backend/internal/dto/network_dto.go b/backend/internal/dto/network_dto.go
deleted file mode 100644
index 9e516254a..000000000
--- a/backend/internal/dto/network_dto.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package dto
-
-import (
- "time"
-
- "github.com/docker/docker/api/types/network"
-)
-
-type NetworkSummaryDto struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Driver string `json:"driver"`
- Scope string `json:"scope"`
- Created time.Time `json:"created"`
- Options map[string]string `json:"options"`
- Labels map[string]string `json:"labels"`
- InUse bool `json:"inUse"`
- IsDefault bool `json:"isDefault"`
-}
-
-type NetworkUsageCounts struct {
- Inuse int `json:"networksInuse"`
- Unused int `json:"networksUnused"`
- Total int `json:"totalNetworks"`
-}
-
-type NetworkInspectDto struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Driver string `json:"driver"`
- Scope string `json:"scope"`
- Created time.Time `json:"created"`
- Options map[string]string `json:"options"`
- Labels map[string]string `json:"labels"`
- Containers map[string]network.EndpointResource `json:"containers"`
- IPAM network.IPAM `json:"ipam"`
- Internal bool `json:"internal"`
- Attachable bool `json:"attachable"`
- Ingress bool `json:"ingress"`
-}
-
-type NetworkCreateResponseDto struct {
- ID string `json:"id"`
- Warning string `json:"warning,omitempty"`
-}
-
-type NetworkPruneReportDto struct {
- NetworksDeleted []string `json:"networksDeleted"`
- SpaceReclaimed uint64 `json:"spaceReclaimed"`
-}
-
-func NewNetworkSummaryDto(s network.Summary) NetworkSummaryDto {
- iu := len(s.Containers) > 0
-
- return NetworkSummaryDto{
- ID: s.ID,
- Name: s.Name,
- Driver: s.Driver,
- Scope: s.Scope,
- Created: s.Created,
- Options: s.Options,
- Labels: s.Labels,
- InUse: iu,
- }
-}
diff --git a/backend/internal/dto/notification_dto.go b/backend/internal/dto/notification_dto.go
deleted file mode 100644
index 12e50131d..000000000
--- a/backend/internal/dto/notification_dto.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package dto
-
-import "github.com/getarcaneapp/arcane/backend/internal/models"
-
-type NotificationSettingsRequest struct {
- Provider models.NotificationProvider `json:"provider" binding:"required"`
- Enabled bool `json:"enabled"`
- Config models.JSON `json:"config" binding:"required"`
-}
-
-type NotificationSettingsResponse struct {
- ID uint `json:"id"`
- Provider models.NotificationProvider `json:"provider"`
- Enabled bool `json:"enabled"`
- Config models.JSON `json:"config"`
-}
-
-type AppriseSettingsRequest struct {
- APIURL string `json:"apiUrl"`
- Enabled bool `json:"enabled"`
- ImageUpdateTag string `json:"imageUpdateTag"`
- ContainerUpdateTag string `json:"containerUpdateTag"`
-}
-
-type AppriseSettingsResponse struct {
- ID uint `json:"id"`
- APIURL string `json:"apiUrl"`
- Enabled bool `json:"enabled"`
- ImageUpdateTag string `json:"imageUpdateTag"`
- ContainerUpdateTag string `json:"containerUpdateTag"`
-}
diff --git a/backend/internal/dto/oidc_dto.go b/backend/internal/dto/oidc_dto.go
deleted file mode 100644
index aad20aae5..000000000
--- a/backend/internal/dto/oidc_dto.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package dto
-
-type OidcUserInfo struct {
- Subject string `json:"sub"`
- Name string `json:"name,omitempty"`
- Email string `json:"email,omitempty"`
- EmailVerified bool `json:"email_verified,omitempty"`
- PreferredUsername string `json:"preferred_username,omitempty"`
- GivenName string `json:"given_name,omitempty"`
- FamilyName string `json:"family_name,omitempty"`
- Admin bool `json:"admin,omitempty"`
- Roles []string `json:"roles,omitempty"`
- Groups []string `json:"groups,omitempty"`
-
- // Raw extra claims from userinfo (not serialized back out)
- Extra map[string]any `json:"-"`
-}
-
-type OidcDiscoveryDocument struct {
- Issuer string `json:"issuer"`
- AuthorizationEndpoint string `json:"authorization_endpoint"`
- TokenEndpoint string `json:"token_endpoint"`
- UserinfoEndpoint string `json:"userinfo_endpoint"`
- JwksURI string `json:"jwks_uri"`
- ScopesSupported []string `json:"scopes_supported"`
- ResponseTypesSupported []string `json:"response_types_supported"`
- CodeChallengeMethodsSupported []string `json:"code_challenge_methods_supported"`
-}
-
-type OidcTokenResponse struct {
- AccessToken string `json:"access_token"`
- TokenType string `json:"token_type"`
- RefreshToken string `json:"refresh_token,omitempty"`
- ExpiresIn int `json:"expires_in,omitempty"`
- IDToken string `json:"id_token,omitempty"`
-}
-
-type OidcStatusInfo struct {
- EnvForced bool `json:"envForced"`
- EnvConfigured bool `json:"envConfigured"`
- MergeAccounts bool `json:"mergeAccounts"`
-}
-
-type OidcAuthUrlRequest struct {
- RedirectUri string `json:"redirectUri"`
-}
diff --git a/backend/internal/dto/project_dto.go b/backend/internal/dto/project_dto.go
deleted file mode 100644
index eebb91a5b..000000000
--- a/backend/internal/dto/project_dto.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package dto
-
-type IncludeFileDto struct {
- Path string `json:"path"`
- RelativePath string `json:"relativePath"`
- Content string `json:"content"`
-}
-
-type CreateProjectDto struct {
- Name string `json:"name" binding:"required"`
- ComposeContent string `json:"composeContent" binding:"required"`
- EnvContent *string `json:"envContent,omitempty"`
-}
-
-type UpdateProjectDto struct {
- Name *string `json:"name,omitempty"`
- ComposeContent *string `json:"composeContent,omitempty"`
- EnvContent *string `json:"envContent,omitempty"`
-}
-
-type UpdateProjectIncludeDto struct {
- RelativePath string `json:"relativePath" binding:"required"`
- Content string `json:"content" binding:"required"`
-}
-
-type CreateProjectReponseDto struct {
- ID string `json:"id"`
- Name string `json:"name"`
- DirName string `json:"dirName,omitempty"`
- Path string `json:"path"`
- Status string `json:"status"`
- StatusReason *string `json:"statusReason,omitempty"`
- ServiceCount int `json:"serviceCount"`
- RunningCount int `json:"runningCount"`
- CreatedAt string `json:"createdAt"`
- UpdatedAt string `json:"updatedAt"`
-}
-
-type ProjectDetailsDto struct {
- ID string `json:"id"`
- Name string `json:"name"`
- DirName string `json:"dirName,omitempty"`
- Path string `json:"path"`
- ComposeContent string `json:"composeContent,omitempty"`
- EnvContent string `json:"envContent,omitempty"`
- IncludeFiles []IncludeFileDto `json:"includeFiles,omitempty"`
- Status string `json:"status"`
- StatusReason *string `json:"statusReason,omitempty"`
- ServiceCount int `json:"serviceCount"`
- RunningCount int `json:"runningCount"`
- CreatedAt string `json:"createdAt"`
- UpdatedAt string `json:"updatedAt"`
- Services []any `json:"services,omitempty"`
-}
-
-type DestroyProjectDto struct {
- RemoveFiles bool `json:"removeFiles,omitempty"`
- RemoveVolumes bool `json:"removeVolumes,omitempty"`
-}
-
-type ProjectStatusCounts struct {
- RunningProjects int `json:"runningProjects"`
- StoppedProjects int `json:"stoppedProjects"`
- TotalProjects int `json:"totalProjects"`
-}
-
-type ProjectImagePullDto struct {
- Credentials []ContainerRegistryCredential `json:"credentials,omitempty"`
-}
diff --git a/backend/internal/dto/prune_dto.go b/backend/internal/dto/prune_dto.go
deleted file mode 100644
index 8e915510d..000000000
--- a/backend/internal/dto/prune_dto.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package dto
-
-type PruneSystemDto struct {
- Containers bool `json:"containers"`
- Images bool `json:"images"`
- Volumes bool `json:"volumes"`
- Networks bool `json:"networks"`
- BuildCache bool `json:"buildCache"`
- Dangling bool `json:"dangling"`
-}
-
-type PruneAllResult struct {
- ContainersPruned []string `json:"containersPruned,omitempty"`
- ImagesDeleted []string `json:"imagesDeleted,omitempty"`
- VolumesDeleted []string `json:"volumesDeleted,omitempty"`
- NetworksDeleted []string `json:"networksDeleted,omitempty"`
- SpaceReclaimed uint64 `json:"spaceReclaimed"`
- Success bool `json:"success"`
- Errors []string `json:"errors,omitempty"`
-}
diff --git a/backend/internal/dto/settings_dto.go b/backend/internal/dto/settings_dto.go
deleted file mode 100644
index e6886a8bd..000000000
--- a/backend/internal/dto/settings_dto.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package dto
-
-type PublicSettingDto struct {
- Key string `json:"key"`
- Type string `json:"type"`
- Value string `json:"value"`
-}
-
-type SettingDto struct {
- PublicSettingDto
- IsPublic bool `json:"isPublic"`
-}
-
-type UpdateSettingsDto struct {
- ProjectsDirectory *string `json:"projectsDirectory,omitempty"`
- DiskUsagePath *string `json:"diskUsagePath,omitempty"`
- AutoUpdate *string `json:"autoUpdate,omitempty"`
- AutoUpdateInterval *string `json:"autoUpdateInterval,omitempty"`
- PollingEnabled *string `json:"pollingEnabled,omitempty"`
- PollingInterval *string `json:"pollingInterval,omitempty"`
- EnvironmentHealthInterval *string `json:"environmentHealthInterval,omitempty"`
- PruneMode *string `json:"dockerPruneMode,omitempty" binding:"omitempty,oneof=all dangling"`
- MaxImageUploadSize *string `json:"maxImageUploadSize,omitempty"`
- BaseServerURL *string `json:"baseServerUrl,omitempty"`
- EnableGravatar *string `json:"enableGravatar,omitempty"`
- DefaultShell *string `json:"defaultShell,omitempty"`
- DockerHost *string `json:"dockerHost,omitempty"`
- AccentColor *string `json:"accentColor,omitempty"`
- AuthLocalEnabled *string `json:"authLocalEnabled,omitempty"`
- OidcEnabled *string `json:"oidcEnabled,omitempty"`
- OidcMergeAccounts *string `json:"oidcMergeAccounts,omitempty"`
- AuthSessionTimeout *string `json:"authSessionTimeout,omitempty"`
- AuthPasswordPolicy *string `json:"authPasswordPolicy,omitempty"`
- // AuthOidcConfig DEPRECATED will be removed in a future release
- AuthOidcConfig *string `json:"authOidcConfig,omitempty"`
- OidcClientId *string `json:"oidcClientId,omitempty"`
- OidcClientSecret *string `json:"oidcClientSecret,omitempty"`
- OidcIssuerUrl *string `json:"oidcIssuerUrl,omitempty"`
- OidcScopes *string `json:"oidcScopes,omitempty"`
- OidcAdminClaim *string `json:"oidcAdminClaim,omitempty"`
- OidcAdminValue *string `json:"oidcAdminValue,omitempty"`
- OnboardingCompleted *string `json:"onboardingCompleted,omitempty"`
- OnboardingSteps *string `json:"onboardingSteps,omitempty"`
- MobileNavigationMode *string `json:"mobileNavigationMode,omitempty"`
- MobileNavigationShowLabels *string `json:"mobileNavigationShowLabels,omitempty"`
- SidebarHoverExpansion *string `json:"sidebarHoverExpansion,omitempty"`
- GlassEffectEnabled *string `json:"glassEffectEnabled,omitempty"`
-}
diff --git a/backend/internal/dto/settings_search_dto.go b/backend/internal/dto/settings_search_dto.go
deleted file mode 100644
index e25a02295..000000000
--- a/backend/internal/dto/settings_search_dto.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package dto
-
-type SettingMeta struct {
- Key string `json:"key"`
- Label string `json:"label"`
- Type string `json:"type"`
- Keywords []string `json:"keywords,omitempty"`
- Description string `json:"description,omitempty"`
-}
-
-type SettingsCategory struct {
- ID string `json:"id"`
- Title string `json:"title"`
- Description string `json:"description"`
- Icon string `json:"icon"`
- URL string `json:"url"`
- Keywords []string `json:"keywords"`
- Settings []SettingMeta `json:"settings"`
- MatchingSettings []SettingMeta `json:"matchingSettings,omitempty"`
- RelevanceScore int `json:"relevanceScore,omitempty"`
-}
-
-type SettingsSearchRequest struct {
- Query string `json:"query" binding:"required,min=1"`
-}
-
-type SettingsSearchResponse struct {
- Results []SettingsCategory `json:"results"`
- Query string `json:"query"`
- Count int `json:"count"`
-}
diff --git a/backend/internal/dto/template_dto.go b/backend/internal/dto/template_dto.go
deleted file mode 100644
index 42ea4a89d..000000000
--- a/backend/internal/dto/template_dto.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package dto
-
-type RemoteTemplate struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Description string `json:"description"`
- Version string `json:"version"`
- Author string `json:"author"`
- ComposeURL string `json:"compose_url"`
- EnvURL string `json:"env_url"`
- DocumentationURL string `json:"documentation_url"`
- Tags []string `json:"tags"`
-}
-
-type RemoteRegistry struct {
- Schema string `json:"$schema,omitempty"`
- Name string `json:"name"`
- Description string `json:"description"`
- Version string `json:"version"`
- Author string `json:"author"`
- URL string `json:"url"`
- Templates []RemoteTemplate `json:"templates"`
-}
-
-type TemplateRegistryDto struct {
- ID string `json:"id"`
- Name string `json:"name"`
- URL string `json:"url"`
- Enabled bool `json:"enabled"`
- Description string `json:"description"`
-}
-
-type ComposeTemplateMetadataDto struct {
- Version *string `json:"version,omitempty"`
- Author *string `json:"author,omitempty"`
- Tags []string `json:"tags,omitempty"`
- RemoteURL *string `json:"remoteUrl,omitempty"`
- EnvURL *string `json:"envUrl,omitempty"`
- DocumentationURL *string `json:"documentationUrl,omitempty"`
- UpdatedAt *string `json:"updatedAt,omitempty"`
-}
-
-type EnvVariable struct {
- Key string `json:"key"`
- Value string `json:"value"`
-}
-
-type ComposeTemplateContentDto struct {
- Template ComposeTemplateDto `json:"template"`
- Content string `json:"content"`
- EnvContent string `json:"envContent"`
- Services []string `json:"services"`
- EnvVariables []EnvVariable `json:"envVariables"`
-}
-
-type ComposeTemplateDto struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Description string `json:"description"`
- Content string `json:"content"`
- EnvContent *string `json:"envContent,omitempty"`
- IsCustom bool `json:"isCustom"`
- IsRemote bool `json:"isRemote"`
- RegistryID *string `json:"registryId,omitempty"`
- Registry *TemplateRegistryDto `json:"registry,omitempty"`
- Metadata *ComposeTemplateMetadataDto `json:"metadata,omitempty"`
-}
diff --git a/backend/internal/dto/updater_dto.go b/backend/internal/dto/updater_dto.go
deleted file mode 100644
index 4c99913d4..000000000
--- a/backend/internal/dto/updater_dto.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package dto
-
-type UpdaterRunRequest struct {
- DryRun bool `json:"dryRun"`
-}
-
-type UpdaterItem struct {
- ResourceID string `json:"resourceId"`
- ResourceType string `json:"resourceType"` // "image" | "container" | "project"
- ResourceName string `json:"resourceName,omitempty"`
- Status string `json:"status"` // "checked" | "updated" | "skipped" | "failed" | "up_to_date" | "update_available"
- Error string `json:"error,omitempty"`
- OldImages map[string]string `json:"oldImages,omitempty"`
- NewImages map[string]string `json:"newImages,omitempty"`
- UpdateApplied bool `json:"updateApplied,omitempty"`
-}
-
-type UpdaterRunResult struct {
- Checked int `json:"checked"`
- Updated int `json:"updated"`
- Skipped int `json:"skipped"`
- Failed int `json:"failed"`
- Items []UpdaterItem `json:"items"`
- Duration string `json:"duration"`
-}
-
-type AutoUpdateCheckDto struct {
- Type string `json:"type,omitempty"`
- ResourceIds []string `json:"resourceIds,omitempty"`
- ForceUpdate bool `json:"forceUpdate,omitempty"`
- DryRun bool `json:"dryRun,omitempty"`
-}
-
-type AutoUpdateResultDto struct {
- Success bool `json:"success"`
- Checked int `json:"checked"`
- Updated int `json:"updated"`
- Skipped int `json:"skipped"`
- Failed int `json:"failed"`
- StartTime string `json:"startTime"`
- EndTime string `json:"endTime"`
- Duration string `json:"duration"`
- Results []AutoUpdateResourceResult `json:"results"`
-}
-
-type AutoUpdateResourceResult struct {
- ResourceID string `json:"resourceId"`
- ResourceName string `json:"resourceName"`
- ResourceType string `json:"resourceType"`
- Status string `json:"status"`
- UpdateAvailable bool `json:"updateAvailable"`
- UpdateApplied bool `json:"updateApplied"`
- OldImages map[string]string `json:"oldImages,omitempty"`
- NewImages map[string]string `json:"newImages,omitempty"`
- Error string `json:"error,omitempty"`
- Details map[string]interface{} `json:"details,omitempty"`
-}
diff --git a/backend/internal/dto/user_dto.go b/backend/internal/dto/user_dto.go
deleted file mode 100644
index 54735cf57..000000000
--- a/backend/internal/dto/user_dto.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package dto
-
-type CreateUserDto struct {
- Username string `json:"username" binding:"required"`
- Password string `json:"password" binding:"required"`
- DisplayName *string `json:"displayName,omitempty"`
- Email *string `json:"email,omitempty"`
- Roles []string `json:"roles,omitempty"`
- Locale *string `json:"locale,omitempty"`
-}
-
-type UpdateUserDto struct {
- DisplayName *string `json:"displayName,omitempty"`
- Email *string `json:"email,omitempty"`
- Roles []string `json:"roles,omitempty"`
- Locale *string `json:"locale,omitempty"`
- Password *string `json:"password,omitempty"`
-}
-
-type UserResponseDto struct {
- ID string `json:"id"`
- Username string `json:"username"`
- DisplayName *string `json:"displayName,omitempty"`
- Email *string `json:"email,omitempty"`
- Roles []string `json:"roles"`
- OidcSubjectId *string `json:"oidcSubjectId,omitempty"`
- Locale *string `json:"locale,omitempty"`
- CreatedAt string `json:"createdAt,omitempty"`
- UpdatedAt string `json:"updatedAt,omitempty"`
- RequiresPasswordChange bool `json:"requiresPasswordChange"`
-}
diff --git a/backend/internal/dto/variable_dto.go b/backend/internal/dto/variable_dto.go
deleted file mode 100644
index f86e2db28..000000000
--- a/backend/internal/dto/variable_dto.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package dto
-
-type VariableDto struct {
- Key string `json:"key"`
- Value string `json:"value"`
-}
-
-type GetVariablesResponse struct {
- Variables []VariableDto `json:"variables"`
-}
-
-type UpdateVariablesRequest struct {
- Variables []VariableDto `json:"variables"`
-}
diff --git a/backend/internal/dto/version_dto.go b/backend/internal/dto/version_dto.go
deleted file mode 100644
index 41bab2fd8..000000000
--- a/backend/internal/dto/version_dto.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package dto
-
-type VersionInfoDto struct {
- CurrentVersion string `json:"currentVersion"`
- CurrentTag string `json:"currentTag,omitempty"`
- CurrentDigest string `json:"currentDigest,omitempty"`
- Revision string `json:"revision"`
- DisplayVersion string `json:"displayVersion"`
- IsSemverVersion bool `json:"isSemverVersion"`
- NewestVersion string `json:"newestVersion,omitempty"`
- NewestDigest string `json:"newestDigest,omitempty"`
- UpdateAvailable bool `json:"updateAvailable"`
- ReleaseURL string `json:"releaseUrl,omitempty"`
-}
diff --git a/backend/internal/dto/volume_dto.go b/backend/internal/dto/volume_dto.go
deleted file mode 100644
index c9c1cb9fe..000000000
--- a/backend/internal/dto/volume_dto.go
+++ /dev/null
@@ -1,71 +0,0 @@
-package dto
-
-import "github.com/docker/docker/api/types/volume"
-
-type VolumeUsageData struct {
- Size int64 `json:"size"`
- RefCount int64 `json:"refCount"`
-}
-
-type VolumeDto struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Driver string `json:"driver"`
- Mountpoint string `json:"mountpoint"`
- Scope string `json:"scope"`
- Options map[string]string `json:"options"`
- Labels map[string]string `json:"labels"`
- CreatedAt string `json:"createdAt"`
- InUse bool `json:"inUse"`
- UsageData *VolumeUsageData `json:"usageData,omitempty"`
- Size int64 `json:"size"`
- Containers []string `json:"containers"`
-}
-
-func NewVolumeDto(v volume.Volume) VolumeDto {
- dto := VolumeDto{
- ID: v.Name,
- Name: v.Name,
- Driver: v.Driver,
- Mountpoint: v.Mountpoint,
- Scope: v.Scope,
- Options: v.Options,
- Labels: v.Labels,
- CreatedAt: v.CreatedAt,
- Containers: make([]string, 0),
- }
-
- if v.UsageData != nil {
- dto.UsageData = &VolumeUsageData{
- Size: v.UsageData.Size,
- RefCount: v.UsageData.RefCount,
- }
- dto.Size = v.UsageData.Size
- if v.UsageData.RefCount >= 1 {
- dto.InUse = true
- } else {
- dto.InUse = false
- }
-
- }
-
- return dto
-}
-
-type VolumeUsageCounts struct {
- Inuse int `json:"volumesInuse"`
- Unused int `json:"volumesUnused"`
- Total int `json:"totalVolumes"`
-}
-
-type VolumePruneReportDto struct {
- VolumesDeleted []string `json:"volumesDeleted"`
- SpaceReclaimed uint64 `json:"spaceReclaimed"`
-}
-
-type CreateVolumeDto struct {
- Name string `json:"name" binding:"required"`
- Driver string `json:"driver"`
- Labels map[string]string `json:"labels"`
- Options map[string]string `json:"options"`
-}
diff --git a/backend/internal/job/image_polling_job.go b/backend/internal/job/image_polling_job.go
index 87cd994ce..c93f11eb5 100644
--- a/backend/internal/job/image_polling_job.go
+++ b/backend/internal/job/image_polling_job.go
@@ -5,9 +5,9 @@ import (
"log/slog"
"time"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/services"
"github.com/go-co-op/gocron/v2"
+ "go.getarcane.app/types/containerregistry"
)
type ImagePollingJob struct {
@@ -97,7 +97,7 @@ func (j *ImagePollingJob) Execute(ctx context.Context) error {
return nil
}
-func (j *ImagePollingJob) loadRegistryCredentials(ctx context.Context) ([]dto.ContainerRegistryCredential, error) {
+func (j *ImagePollingJob) loadRegistryCredentials(ctx context.Context) ([]containerregistry.Credential, error) {
return j.environmentService.GetEnabledRegistryCredentials(ctx)
}
diff --git a/backend/internal/services/apprise_service.go b/backend/internal/services/apprise_service.go
index 061e31c83..1684f0168 100644
--- a/backend/internal/services/apprise_service.go
+++ b/backend/internal/services/apprise_service.go
@@ -12,8 +12,8 @@ import (
"github.com/getarcaneapp/arcane/backend/internal/config"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
+ "go.getarcane.app/types/imageupdate"
)
type AppriseService struct {
@@ -148,7 +148,7 @@ func (s *AppriseService) SendNotification(ctx context.Context, title, body, form
return nil
}
-func (s *AppriseService) SendImageUpdateNotification(ctx context.Context, imageRef string, updateInfo *dto.ImageUpdateResponse) error {
+func (s *AppriseService) SendImageUpdateNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response) error {
title := fmt.Sprintf("Container Image Update Available: %s", imageRef)
body := fmt.Sprintf(
"Image: %s\nUpdate Type: %s\nCurrent Digest: %s\nLatest Digest: %s",
@@ -172,12 +172,12 @@ func (s *AppriseService) SendContainerUpdateNotification(ctx context.Context, co
return s.SendNotification(ctx, title, body, "text", models.NotificationEventContainerUpdate)
}
-func (s *AppriseService) SendBatchImageUpdateNotification(ctx context.Context, updates map[string]*dto.ImageUpdateResponse) error {
+func (s *AppriseService) SendBatchImageUpdateNotification(ctx context.Context, updates map[string]*imageupdate.Response) error {
if len(updates) == 0 {
return nil
}
- updatesWithChanges := make(map[string]*dto.ImageUpdateResponse)
+ updatesWithChanges := make(map[string]*imageupdate.Response)
for imageRef, update := range updates {
if update != nil && update.HasUpdate {
updatesWithChanges[imageRef] = update
diff --git a/backend/internal/services/auth_service.go b/backend/internal/services/auth_service.go
index ec9eee5de..a6ef13f16 100644
--- a/backend/internal/services/auth_service.go
+++ b/backend/internal/services/auth_service.go
@@ -9,11 +9,11 @@ import (
"time"
"github.com/getarcaneapp/arcane/backend/internal/config"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/utils"
"github.com/golang-jwt/jwt/v5"
"github.com/google/uuid"
+ "go.getarcane.app/types/auth"
)
var (
@@ -101,7 +101,7 @@ func (s *AuthService) getAuthSettings(ctx context.Context) (*AuthSettings, error
return authSettings, nil
}
-func (s *AuthService) GetOidcConfigurationStatus(ctx context.Context) (*dto.OidcStatusInfo, error) {
+func (s *AuthService) GetOidcConfigurationStatus(ctx context.Context) (*auth.OidcStatusInfo, error) {
mergeAccounts := false
if s.settingsService != nil {
func() {
@@ -115,7 +115,7 @@ func (s *AuthService) GetOidcConfigurationStatus(ctx context.Context) (*dto.Oidc
}()
}
- status := &dto.OidcStatusInfo{
+ status := &auth.OidcStatusInfo{
EnvForced: s.config.OidcEnabled,
MergeAccounts: mergeAccounts,
}
@@ -239,7 +239,7 @@ func (s *AuthService) Login(ctx context.Context, username, password string) (*mo
return user, tokenPair, nil
}
-func (s *AuthService) OidcLogin(ctx context.Context, userInfo dto.OidcUserInfo, tokenResp *dto.OidcTokenResponse) (*models.User, *TokenPair, error) {
+func (s *AuthService) OidcLogin(ctx context.Context, userInfo auth.OidcUserInfo, tokenResp *auth.OidcTokenResponse) (*models.User, *TokenPair, error) {
if userInfo.Subject == "" {
return nil, nil, errors.New("missing OIDC subject identifier")
}
@@ -271,7 +271,7 @@ func (s *AuthService) OidcLogin(ctx context.Context, userInfo dto.OidcUserInfo,
return user, tokenPair, nil
}
-func (s *AuthService) findOrCreateOidcUser(ctx context.Context, userInfo dto.OidcUserInfo, tokenResp *dto.OidcTokenResponse) (*models.User, bool, error) {
+func (s *AuthService) findOrCreateOidcUser(ctx context.Context, userInfo auth.OidcUserInfo, tokenResp *auth.OidcTokenResponse) (*models.User, bool, error) {
user, err := s.userService.GetUserByOidcSubjectId(ctx, userInfo.Subject)
if err != nil && !errors.Is(err, ErrUserNotFound) {
return nil, false, err
@@ -315,7 +315,7 @@ func (s *AuthService) findOrCreateOidcUser(ctx context.Context, userInfo dto.Oid
return user, false, nil
}
-func (s *AuthService) createOidcUser(ctx context.Context, userInfo dto.OidcUserInfo, tokenResp *dto.OidcTokenResponse) (*models.User, error) {
+func (s *AuthService) createOidcUser(ctx context.Context, userInfo auth.OidcUserInfo, tokenResp *auth.OidcTokenResponse) (*models.User, error) {
now := time.Now()
var username string
@@ -360,7 +360,7 @@ func (s *AuthService) createOidcUser(ctx context.Context, userInfo dto.OidcUserI
return user, nil
}
-func (s *AuthService) updateOidcUser(ctx context.Context, user *models.User, userInfo dto.OidcUserInfo, tokenResp *dto.OidcTokenResponse) error {
+func (s *AuthService) updateOidcUser(ctx context.Context, user *models.User, userInfo auth.OidcUserInfo, tokenResp *auth.OidcTokenResponse) error {
if userInfo.Name != "" && user.DisplayName == nil {
user.DisplayName = &userInfo.Name
}
@@ -385,7 +385,7 @@ func (s *AuthService) updateOidcUser(ctx context.Context, user *models.User, use
return err
}
-func (s *AuthService) mergeOidcWithExistingUser(ctx context.Context, user *models.User, userInfo dto.OidcUserInfo, tokenResp *dto.OidcTokenResponse) error {
+func (s *AuthService) mergeOidcWithExistingUser(ctx context.Context, user *models.User, userInfo auth.OidcUserInfo, tokenResp *auth.OidcTokenResponse) error {
// Perform the merge atomically to avoid races when multiple OIDC subjects share the same email
_, err := s.userService.AttachOidcSubjectTransactional(ctx, user.ID, userInfo.Subject, func(u *models.User) {
// Update display name if not set
@@ -438,7 +438,7 @@ func removeRole(roles models.StringSlice, role string) models.StringSlice {
return out
}
-func (s *AuthService) isAdminFromOidc(ctx context.Context, userInfo dto.OidcUserInfo, tokenResp *dto.OidcTokenResponse) bool {
+func (s *AuthService) isAdminFromOidc(ctx context.Context, userInfo auth.OidcUserInfo, tokenResp *auth.OidcTokenResponse) bool {
claimKey, values := s.getAdminClaimConfig(ctx)
if claimKey == "" {
return false
@@ -482,7 +482,7 @@ func (s *AuthService) getAdminClaimConfig(ctx context.Context) (claim string, va
return claim, values
}
-func (s *AuthService) persistOidcTokens(user *models.User, tokenResp *dto.OidcTokenResponse) {
+func (s *AuthService) persistOidcTokens(user *models.User, tokenResp *auth.OidcTokenResponse) {
if tokenResp == nil {
return
}
diff --git a/backend/internal/services/auth_service_test.go b/backend/internal/services/auth_service_test.go
index 47ec917f4..e48054fda 100644
--- a/backend/internal/services/auth_service_test.go
+++ b/backend/internal/services/auth_service_test.go
@@ -8,9 +8,9 @@ import (
"time"
"github.com/getarcaneapp/arcane/backend/internal/config"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/golang-jwt/jwt/v5"
+ "go.getarcane.app/types/auth"
)
func newTestAuthService(secret string) *AuthService {
@@ -149,7 +149,7 @@ func TestPersistOidcTokens_SetsFields(t *testing.T) {
s := newTestAuthService("")
user := &models.User{}
start := time.Now()
- resp := &dto.OidcTokenResponse{
+ resp := &auth.OidcTokenResponse{
AccessToken: "at-123",
RefreshToken: "rt-456",
ExpiresIn: 7,
diff --git a/backend/internal/services/container_registry_service.go b/backend/internal/services/container_registry_service.go
index da017c41c..fc58d4b06 100644
--- a/backend/internal/services/container_registry_service.go
+++ b/backend/internal/services/container_registry_service.go
@@ -12,12 +12,13 @@ import (
"time"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/utils"
"github.com/getarcaneapp/arcane/backend/internal/utils/cache"
+ "github.com/getarcaneapp/arcane/backend/internal/utils/mapper"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
"github.com/getarcaneapp/arcane/backend/internal/utils/registry"
+ "go.getarcane.app/types/containerregistry"
ref "go.podman.io/image/v5/docker/reference"
)
@@ -60,7 +61,7 @@ func (s *ContainerRegistryService) GetAllRegistries(ctx context.Context) ([]mode
return registries, nil
}
-func (s *ContainerRegistryService) GetRegistriesPaginated(ctx context.Context, params pagination.QueryParams) ([]dto.ContainerRegistryDto, pagination.Response, error) {
+func (s *ContainerRegistryService) GetRegistriesPaginated(ctx context.Context, params pagination.QueryParams) ([]containerregistry.Response, pagination.Response, error) {
var registries []models.ContainerRegistry
q := s.db.WithContext(ctx).Model(&models.ContainerRegistry{})
@@ -95,7 +96,7 @@ func (s *ContainerRegistryService) GetRegistriesPaginated(ctx context.Context, p
return nil, pagination.Response{}, fmt.Errorf("failed to paginate container registries: %w", err)
}
- out, mapErr := dto.MapSlice[models.ContainerRegistry, dto.ContainerRegistryDto](registries)
+ out, mapErr := mapper.MapSlice[models.ContainerRegistry, containerregistry.Response](registries)
if mapErr != nil {
return nil, pagination.Response{}, fmt.Errorf("failed to map registries: %w", mapErr)
}
@@ -398,7 +399,7 @@ func (s *ContainerRegistryService) fetchWithTokenAuth(ctx context.Context, repos
// SyncRegistries syncs registries from a manager to this agent instance
// It creates, updates, or deletes registries to match the provided list
-func (s *ContainerRegistryService) SyncRegistries(ctx context.Context, syncItems []dto.ContainerRegistrySyncDto) error {
+func (s *ContainerRegistryService) SyncRegistries(ctx context.Context, syncItems []containerregistry.Sync) error {
existingMap, err := s.getExistingRegistriesMapInternal(ctx)
if err != nil {
return err
@@ -433,7 +434,7 @@ func (s *ContainerRegistryService) getExistingRegistriesMapInternal(ctx context.
return existingMap, nil
}
-func (s *ContainerRegistryService) processSyncItemInternal(ctx context.Context, item dto.ContainerRegistrySyncDto, existingMap map[string]*models.ContainerRegistry) error {
+func (s *ContainerRegistryService) processSyncItemInternal(ctx context.Context, item containerregistry.Sync, existingMap map[string]*models.ContainerRegistry) error {
existing, exists := existingMap[item.ID]
if exists {
return s.updateExistingRegistryInternal(ctx, item, existing)
@@ -441,7 +442,7 @@ func (s *ContainerRegistryService) processSyncItemInternal(ctx context.Context,
return s.createNewRegistryInternal(ctx, item)
}
-func (s *ContainerRegistryService) updateExistingRegistryInternal(ctx context.Context, item dto.ContainerRegistrySyncDto, existing *models.ContainerRegistry) error {
+func (s *ContainerRegistryService) updateExistingRegistryInternal(ctx context.Context, item containerregistry.Sync, existing *models.ContainerRegistry) error {
needsUpdate := s.checkRegistryNeedsUpdateInternal(item, existing)
if needsUpdate {
@@ -454,7 +455,7 @@ func (s *ContainerRegistryService) updateExistingRegistryInternal(ctx context.Co
return nil
}
-func (s *ContainerRegistryService) checkRegistryNeedsUpdateInternal(item dto.ContainerRegistrySyncDto, existing *models.ContainerRegistry) bool {
+func (s *ContainerRegistryService) checkRegistryNeedsUpdateInternal(item containerregistry.Sync, existing *models.ContainerRegistry) bool {
needsUpdate := utils.UpdateIfChanged(&existing.URL, item.URL)
needsUpdate = utils.UpdateIfChanged(&existing.Username, item.Username) || needsUpdate
@@ -471,7 +472,7 @@ func (s *ContainerRegistryService) checkRegistryNeedsUpdateInternal(item dto.Con
return needsUpdate
}
-func (s *ContainerRegistryService) createNewRegistryInternal(ctx context.Context, item dto.ContainerRegistrySyncDto) error {
+func (s *ContainerRegistryService) createNewRegistryInternal(ctx context.Context, item containerregistry.Sync) error {
encryptedToken, err := utils.Encrypt(item.Token)
if err != nil {
return fmt.Errorf("failed to encrypt token for new registry %s: %w", item.ID, err)
diff --git a/backend/internal/services/container_service.go b/backend/internal/services/container_service.go
index 5488ab639..969118e4c 100644
--- a/backend/internal/services/container_service.go
+++ b/backend/internal/services/container_service.go
@@ -15,9 +15,10 @@ import (
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/pkg/stdcopy"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
+ containertypes "go.getarcane.app/types/container"
+ "go.getarcane.app/types/containerregistry"
)
type ContainerService struct {
@@ -173,7 +174,7 @@ func (s *ContainerService) DeleteContainer(ctx context.Context, containerID stri
return nil
}
-func (s *ContainerService) CreateContainer(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string, user models.User, credentials []dto.ContainerRegistryCredential) (*container.InspectResponse, error) {
+func (s *ContainerService) CreateContainer(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string, user models.User, credentials []containerregistry.Credential) (*container.InspectResponse, error) {
dockerClient, err := s.dockerService.GetClient()
if err != nil {
s.eventService.LogErrorEvent(ctx, models.EventTypeContainerError, "container", "", containerName, user.ID, user.Username, "0", err, models.JSON{"action": "create", "image": config.Image})
@@ -406,7 +407,7 @@ func (s *ContainerService) readAllLogs(logs io.ReadCloser, logsChan chan<- strin
return nil
}
-func (s *ContainerService) ListContainersPaginated(ctx context.Context, params pagination.QueryParams, includeAll bool) ([]dto.ContainerSummaryDto, pagination.Response, error) {
+func (s *ContainerService) ListContainersPaginated(ctx context.Context, params pagination.QueryParams, includeAll bool) ([]containertypes.Summary, pagination.Response, error) {
dockerClient, err := s.dockerService.GetClient()
if err != nil {
return nil, pagination.Response{}, fmt.Errorf("failed to connect to Docker: %w", err)
@@ -417,27 +418,27 @@ func (s *ContainerService) ListContainersPaginated(ctx context.Context, params p
return nil, pagination.Response{}, fmt.Errorf("failed to list Docker containers: %w", err)
}
- items := make([]dto.ContainerSummaryDto, 0, len(dockerContainers))
+ items := make([]containertypes.Summary, 0, len(dockerContainers))
for _, dc := range dockerContainers {
- items = append(items, dto.NewContainerSummaryDto(dc))
+ items = append(items, containertypes.NewSummary(dc))
}
- config := pagination.Config[dto.ContainerSummaryDto]{
- SearchAccessors: []pagination.SearchAccessor[dto.ContainerSummaryDto]{
- func(c dto.ContainerSummaryDto) (string, error) {
+ config := pagination.Config[containertypes.Summary]{
+ SearchAccessors: []pagination.SearchAccessor[containertypes.Summary]{
+ func(c containertypes.Summary) (string, error) {
if len(c.Names) > 0 {
return c.Names[0], nil
}
return "", nil
},
- func(c dto.ContainerSummaryDto) (string, error) { return c.Image, nil },
- func(c dto.ContainerSummaryDto) (string, error) { return c.State, nil },
- func(c dto.ContainerSummaryDto) (string, error) { return c.Status, nil },
+ func(c containertypes.Summary) (string, error) { return c.Image, nil },
+ func(c containertypes.Summary) (string, error) { return c.State, nil },
+ func(c containertypes.Summary) (string, error) { return c.Status, nil },
},
- SortBindings: []pagination.SortBinding[dto.ContainerSummaryDto]{
+ SortBindings: []pagination.SortBinding[containertypes.Summary]{
{
Key: "name",
- Fn: func(a, b dto.ContainerSummaryDto) int {
+ Fn: func(a, b containertypes.Summary) int {
nameA := ""
if len(a.Names) > 0 {
nameA = a.Names[0]
@@ -451,25 +452,25 @@ func (s *ContainerService) ListContainersPaginated(ctx context.Context, params p
},
{
Key: "image",
- Fn: func(a, b dto.ContainerSummaryDto) int {
+ Fn: func(a, b containertypes.Summary) int {
return strings.Compare(a.Image, b.Image)
},
},
{
Key: "state",
- Fn: func(a, b dto.ContainerSummaryDto) int {
+ Fn: func(a, b containertypes.Summary) int {
return strings.Compare(a.State, b.State)
},
},
{
Key: "status",
- Fn: func(a, b dto.ContainerSummaryDto) int {
+ Fn: func(a, b containertypes.Summary) int {
return strings.Compare(a.Status, b.Status)
},
},
{
Key: "created",
- Fn: func(a, b dto.ContainerSummaryDto) int {
+ Fn: func(a, b containertypes.Summary) int {
if a.Created < b.Created {
return -1
}
diff --git a/backend/internal/services/customize_search_service.go b/backend/internal/services/customize_search_service.go
index f47f14d52..5fdd1f774 100644
--- a/backend/internal/services/customize_search_service.go
+++ b/backend/internal/services/customize_search_service.go
@@ -6,13 +6,15 @@ import (
"strings"
"sync"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/utils"
+ "go.getarcane.app/types/category"
+ "go.getarcane.app/types/meta"
+ "go.getarcane.app/types/search"
)
type CustomizeSearchService struct {
- categories []dto.CustomizeCategory
+ categories []category.Category
once sync.Once
}
@@ -29,16 +31,16 @@ func (s *CustomizeSearchService) initCategories() {
}
// GetCustomizeCategories returns all available customization categories with their metadata
-func (s *CustomizeSearchService) GetCustomizeCategories() []dto.CustomizeCategory {
+func (s *CustomizeSearchService) GetCustomizeCategories() []category.Category {
return s.categories
}
-func (s *CustomizeSearchService) buildCategoriesFromModel() []dto.CustomizeCategory {
+func (s *CustomizeSearchService) buildCategoriesFromModel() []category.Category {
// Extract category metadata from struct tags (catmeta)
catMetaMap := utils.ExtractCategoryMetadata(models.CustomizeItem{}, nil)
// map category id -> list of customizations
- categories := map[string][]dto.CustomizationMeta{}
+ categories := map[string][]meta.Metadata{}
categoryOrder := []string{} // Track order from first appearance in struct
rt := reflect.TypeOf(models.CustomizeItem{})
@@ -50,18 +52,18 @@ func (s *CustomizeSearchService) buildCategoriesFromModel() []dto.CustomizeCateg
continue
}
- meta := utils.ParseMetaTag(field.Tag.Get("meta"))
- label := meta["label"]
+ metaTag := utils.ParseMetaTag(field.Tag.Get("meta"))
+ label := metaTag["label"]
if label == "" {
label = key
}
- typ := meta["type"]
+ typ := metaTag["type"]
if typ == "" {
typ = "text"
}
- desc := meta["description"]
- keywords := utils.ParseKeywords(meta["keywords"])
- categoryID := meta["category"]
+ desc := metaTag["description"]
+ keywords := utils.ParseKeywords(metaTag["keywords"])
+ categoryID := metaTag["category"]
if categoryID == "" {
categoryID = "defaults"
}
@@ -71,7 +73,7 @@ func (s *CustomizeSearchService) buildCategoriesFromModel() []dto.CustomizeCateg
categoryOrder = append(categoryOrder, categoryID)
}
- cm := dto.CustomizationMeta{
+ cm := meta.Metadata{
Key: key,
Label: label,
Type: typ,
@@ -83,7 +85,7 @@ func (s *CustomizeSearchService) buildCategoriesFromModel() []dto.CustomizeCateg
}
// Build final category list in struct order
- result := []dto.CustomizeCategory{}
+ result := []category.Category{}
for _, catID := range categoryOrder {
catMeta := catMetaMap[catID]
if catMeta == nil {
@@ -96,14 +98,14 @@ func (s *CustomizeSearchService) buildCategoriesFromModel() []dto.CustomizeCateg
keywords = []string{}
}
- result = append(result, dto.CustomizeCategory{
- ID: catMeta["id"],
- Title: catMeta["title"],
- Description: catMeta["description"],
- Icon: catMeta["icon"],
- URL: catMeta["url"],
- Keywords: keywords,
- Customizations: categories[catID],
+ result = append(result, category.Category{
+ ID: catMeta["id"],
+ Title: catMeta["title"],
+ Description: catMeta["description"],
+ Icon: catMeta["icon"],
+ URL: catMeta["url"],
+ Keywords: keywords,
+ Settings: categories[catID],
})
}
@@ -111,39 +113,39 @@ func (s *CustomizeSearchService) buildCategoriesFromModel() []dto.CustomizeCateg
}
// Search performs a relevance-scored search across all customization categories and items
-func (s *CustomizeSearchService) Search(query string) dto.CustomizeSearchResponse {
+func (s *CustomizeSearchService) Search(query string) search.Response {
query = strings.ToLower(strings.TrimSpace(query))
if query == "" {
- return dto.CustomizeSearchResponse{
- Results: []dto.CustomizeCategory{},
+ return search.Response{
+ Results: []category.Category{},
Query: query,
Count: 0,
}
}
categories := s.GetCustomizeCategories()
- results := []dto.CustomizeCategory{}
+ results := []category.Category{}
- for _, category := range categories {
+ for _, cat := range categories {
// Check if category matches
- categoryMatch := strings.Contains(strings.ToLower(category.Title), query) ||
- strings.Contains(strings.ToLower(category.Description), query) ||
- containsKeyword(category.Keywords, query)
-
- // Check individual customizations
- matchingCustomizations := []dto.CustomizationMeta{}
- for _, customization := range category.Customizations {
- if matchesCustomization(customization, query) {
- matchingCustomizations = append(matchingCustomizations, customization)
+ categoryMatch := strings.Contains(strings.ToLower(cat.Title), query) ||
+ strings.Contains(strings.ToLower(cat.Description), query) ||
+ containsKeyword(cat.Keywords, query)
+
+ // Check individual settings
+ matchingSettings := []meta.Metadata{}
+ for _, setting := range cat.Settings {
+ if matchesSetting(setting, query) {
+ matchingSettings = append(matchingSettings, setting)
}
}
- if categoryMatch || len(matchingCustomizations) > 0 {
- relevanceScore := calculateCustomizeRelevance(category, matchingCustomizations, query)
+ if categoryMatch || len(matchingSettings) > 0 {
+ relevanceScore := calculateCustomizeRelevance(cat, matchingSettings, query)
- resultCategory := category
- if len(matchingCustomizations) > 0 {
- resultCategory.MatchingCustomizations = matchingCustomizations
+ resultCategory := cat
+ if len(matchingSettings) > 0 {
+ resultCategory.MatchingSettings = matchingSettings
}
resultCategory.RelevanceScore = relevanceScore
@@ -156,36 +158,36 @@ func (s *CustomizeSearchService) Search(query string) dto.CustomizeSearchRespons
return results[i].RelevanceScore > results[j].RelevanceScore
})
- return dto.CustomizeSearchResponse{
+ return search.Response{
Results: results,
Query: query,
Count: len(results),
}
}
-func matchesCustomization(customization dto.CustomizationMeta, query string) bool {
- return strings.Contains(strings.ToLower(customization.Key), query) ||
- strings.Contains(strings.ToLower(customization.Label), query) ||
- strings.Contains(strings.ToLower(customization.Description), query) ||
- containsKeyword(customization.Keywords, query)
+func matchesSetting(setting meta.Metadata, query string) bool {
+ return strings.Contains(strings.ToLower(setting.Key), query) ||
+ strings.Contains(strings.ToLower(setting.Label), query) ||
+ strings.Contains(strings.ToLower(setting.Description), query) ||
+ containsKeyword(setting.Keywords, query)
}
-func calculateCustomizeRelevance(category dto.CustomizeCategory, matchingCustomizations []dto.CustomizationMeta, query string) int {
+func calculateCustomizeRelevance(cat category.Category, matchingSettings []meta.Metadata, query string) int {
score := 0
// Category-level scoring
- if strings.ToLower(category.Title) == query {
+ if strings.ToLower(cat.Title) == query {
score += 30
- } else if strings.Contains(strings.ToLower(category.Title), query) {
+ } else if strings.Contains(strings.ToLower(cat.Title), query) {
score += 20
}
- if strings.Contains(strings.ToLower(category.Description), query) {
+ if strings.Contains(strings.ToLower(cat.Description), query) {
score += 15
}
// Exact keyword match
- for _, keyword := range category.Keywords {
+ for _, keyword := range cat.Keywords {
if strings.ToLower(keyword) == query {
score += 25
break
@@ -195,24 +197,24 @@ func calculateCustomizeRelevance(category dto.CustomizeCategory, matchingCustomi
}
}
- // Customization-level scoring
- for _, customization := range matchingCustomizations {
- if strings.ToLower(customization.Key) == query {
+ // Setting-level scoring
+ for _, setting := range matchingSettings {
+ if strings.ToLower(setting.Key) == query {
score += 30
- } else if strings.Contains(strings.ToLower(customization.Key), query) {
+ } else if strings.Contains(strings.ToLower(setting.Key), query) {
score += 15
}
- if strings.Contains(strings.ToLower(customization.Label), query) {
+ if strings.Contains(strings.ToLower(setting.Label), query) {
score += 12
}
- if strings.Contains(strings.ToLower(customization.Description), query) {
+ if strings.Contains(strings.ToLower(setting.Description), query) {
score += 8
}
// Exact keyword match
- for _, keyword := range customization.Keywords {
+ for _, keyword := range setting.Keywords {
if strings.ToLower(keyword) == query {
score += 20
break
diff --git a/backend/internal/services/environment_service.go b/backend/internal/services/environment_service.go
index 86884fbbc..6d018e832 100644
--- a/backend/internal/services/environment_service.go
+++ b/backend/internal/services/environment_service.go
@@ -12,11 +12,13 @@ import (
"time"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/utils"
+ "github.com/getarcaneapp/arcane/backend/internal/utils/mapper"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
"github.com/google/uuid"
+ "go.getarcane.app/types/containerregistry"
+ "go.getarcane.app/types/environment"
"gorm.io/gorm"
)
@@ -95,7 +97,7 @@ func (s *EnvironmentService) GetEnvironmentByID(ctx context.Context, id string)
return &environment, nil
}
-func (s *EnvironmentService) ListEnvironmentsPaginated(ctx context.Context, params pagination.QueryParams) ([]dto.EnvironmentDto, pagination.Response, error) {
+func (s *EnvironmentService) ListEnvironmentsPaginated(ctx context.Context, params pagination.QueryParams) ([]environment.Response, pagination.Response, error) {
var envs []models.Environment
q := s.db.WithContext(ctx).Model(&models.Environment{})
@@ -124,7 +126,7 @@ func (s *EnvironmentService) ListEnvironmentsPaginated(ctx context.Context, para
return nil, pagination.Response{}, fmt.Errorf("failed to paginate environments: %w", err)
}
- out, mapErr := dto.MapSlice[models.Environment, dto.EnvironmentDto](envs)
+ out, mapErr := mapper.MapSlice[models.Environment, environment.Response](envs)
if mapErr != nil {
return nil, pagination.Response{}, fmt.Errorf("failed to map environments: %w", mapErr)
}
@@ -299,13 +301,13 @@ func (s *EnvironmentService) GetDB() *database.DB {
return s.db
}
-func (s *EnvironmentService) GetEnabledRegistryCredentials(ctx context.Context) ([]dto.ContainerRegistryCredential, error) {
+func (s *EnvironmentService) GetEnabledRegistryCredentials(ctx context.Context) ([]containerregistry.Credential, error) {
var registries []models.ContainerRegistry
if err := s.db.WithContext(ctx).Where("enabled = ?", true).Find(&registries).Error; err != nil {
return nil, fmt.Errorf("failed to get enabled container registries: %w", err)
}
- var creds []dto.ContainerRegistryCredential
+ var creds []containerregistry.Credential
for _, reg := range registries {
if !reg.Enabled || reg.Username == "" || reg.Token == "" {
continue
@@ -319,7 +321,7 @@ func (s *EnvironmentService) GetEnabledRegistryCredentials(ctx context.Context)
continue
}
- creds = append(creds, dto.ContainerRegistryCredential{
+ creds = append(creds, containerregistry.Credential{
URL: reg.URL,
Username: reg.Username,
Token: decryptedToken,
@@ -358,7 +360,7 @@ func (s *EnvironmentService) SyncRegistriesToEnvironment(ctx context.Context, en
slog.Int("count", len(registries)))
// Prepare sync items with decrypted tokens
- syncItems := make([]dto.ContainerRegistrySyncDto, 0, len(registries))
+ syncItems := make([]containerregistry.Sync, 0, len(registries))
for _, reg := range registries {
decryptedToken, err := utils.Decrypt(reg.Token)
if err != nil {
@@ -369,7 +371,7 @@ func (s *EnvironmentService) SyncRegistriesToEnvironment(ctx context.Context, en
continue
}
- syncItems = append(syncItems, dto.ContainerRegistrySyncDto{
+ syncItems = append(syncItems, containerregistry.Sync{
ID: reg.ID,
URL: reg.URL,
Username: reg.Username,
@@ -383,7 +385,7 @@ func (s *EnvironmentService) SyncRegistriesToEnvironment(ctx context.Context, en
}
// Prepare the sync request
- syncReq := dto.SyncRegistriesRequest{
+ syncReq := containerregistry.SyncRequest{
Registries: syncItems,
}
diff --git a/backend/internal/services/event_service.go b/backend/internal/services/event_service.go
index b1925b9f2..36c2cd382 100644
--- a/backend/internal/services/event_service.go
+++ b/backend/internal/services/event_service.go
@@ -8,9 +8,10 @@ import (
"time"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
+ "github.com/getarcaneapp/arcane/backend/internal/utils/mapper"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
+ "go.getarcane.app/types/event"
"golang.org/x/text/cases"
"golang.org/x/text/language"
"gorm.io/gorm"
@@ -76,7 +77,7 @@ func (s *EventService) CreateEvent(ctx context.Context, req CreateEventRequest)
return event, nil
}
-func (s *EventService) CreateEventFromDto(ctx context.Context, req dto.CreateEventDto) (*dto.EventDto, error) {
+func (s *EventService) CreateEventFromDto(ctx context.Context, req event.Create) (*event.Response, error) {
severity := models.EventSeverity(req.Severity)
if severity == "" {
severity = models.EventSeverityInfo
@@ -109,7 +110,7 @@ func (s *EventService) CreateEventFromDto(ctx context.Context, req dto.CreateEve
return s.toEventDto(event), nil
}
-func (s *EventService) ListEventsPaginated(ctx context.Context, params pagination.QueryParams) ([]dto.EventDto, pagination.Response, error) {
+func (s *EventService) ListEventsPaginated(ctx context.Context, params pagination.QueryParams) ([]event.Response, pagination.Response, error) {
var events []models.Event
q := s.db.WithContext(ctx).Model(&models.Event{})
@@ -142,7 +143,7 @@ func (s *EventService) ListEventsPaginated(ctx context.Context, params paginatio
return nil, pagination.Response{}, fmt.Errorf("failed to paginate events: %w", err)
}
- eventDtos, mapErr := dto.MapSlice[models.Event, dto.EventDto](events)
+ eventDtos, mapErr := mapper.MapSlice[models.Event, event.Response](events)
if mapErr != nil {
return nil, pagination.Response{}, fmt.Errorf("failed to map events: %w", mapErr)
}
@@ -150,7 +151,7 @@ func (s *EventService) ListEventsPaginated(ctx context.Context, params paginatio
return eventDtos, paginationResp, nil
}
-func (s *EventService) GetEventsByEnvironmentPaginated(ctx context.Context, environmentID string, params pagination.QueryParams) ([]dto.EventDto, pagination.Response, error) {
+func (s *EventService) GetEventsByEnvironmentPaginated(ctx context.Context, environmentID string, params pagination.QueryParams) ([]event.Response, pagination.Response, error) {
var events []models.Event
q := s.db.WithContext(ctx).Model(&models.Event{}).Where("environment_id = ?", environmentID)
@@ -180,7 +181,7 @@ func (s *EventService) GetEventsByEnvironmentPaginated(ctx context.Context, envi
return nil, pagination.Response{}, fmt.Errorf("failed to paginate events: %w", err)
}
- eventDtos, mapErr := dto.MapSlice[models.Event, dto.EventDto](events)
+ eventDtos, mapErr := mapper.MapSlice[models.Event, event.Response](events)
if mapErr != nil {
return nil, pagination.Response{}, fmt.Errorf("failed to map events: %w", mapErr)
}
@@ -428,28 +429,28 @@ var eventDefinitions = map[models.EventType]struct {
models.EventTypeUserLogout: {"User logged out: %s", "User '%s' has logged out", models.EventSeverityInfo},
}
-func (s *EventService) toEventDto(event *models.Event) *dto.EventDto {
+func (s *EventService) toEventDto(e *models.Event) *event.Response {
var metadata map[string]interface{}
- if event.Metadata != nil {
- metadata = map[string]interface{}(event.Metadata)
+ if e.Metadata != nil {
+ metadata = map[string]interface{}(e.Metadata)
}
- return &dto.EventDto{
- ID: event.ID,
- Type: string(event.Type),
- Severity: string(event.Severity),
- Title: event.Title,
- Description: event.Description,
- ResourceType: event.ResourceType,
- ResourceID: event.ResourceID,
- ResourceName: event.ResourceName,
- UserID: event.UserID,
- Username: event.Username,
- EnvironmentID: event.EnvironmentID,
+ return &event.Response{
+ ID: e.ID,
+ Type: string(e.Type),
+ Severity: string(e.Severity),
+ Title: e.Title,
+ Description: e.Description,
+ ResourceType: e.ResourceType,
+ ResourceID: e.ResourceID,
+ ResourceName: e.ResourceName,
+ UserID: e.UserID,
+ Username: e.Username,
+ EnvironmentID: e.EnvironmentID,
Metadata: metadata,
- Timestamp: event.Timestamp,
- CreatedAt: event.CreatedAt,
- UpdatedAt: event.UpdatedAt,
+ Timestamp: e.Timestamp,
+ CreatedAt: e.CreatedAt,
+ UpdatedAt: e.UpdatedAt,
}
}
diff --git a/backend/internal/services/image_service.go b/backend/internal/services/image_service.go
index 69e80bbd5..766406483 100644
--- a/backend/internal/services/image_service.go
+++ b/backend/internal/services/image_service.go
@@ -18,9 +18,10 @@ import (
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/registry"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
+ "go.getarcane.app/types/containerregistry"
+ imagetypes "go.getarcane.app/types/image"
ref "go.podman.io/image/v5/docker/reference"
"golang.org/x/sync/errgroup"
"gorm.io/gorm"
@@ -104,7 +105,7 @@ func (s *ImageService) RemoveImage(ctx context.Context, id string, force bool, u
return nil
}
-func (s *ImageService) PullImage(ctx context.Context, imageName string, progressWriter io.Writer, user models.User, externalCreds []dto.ContainerRegistryCredential) error {
+func (s *ImageService) PullImage(ctx context.Context, imageName string, progressWriter io.Writer, user models.User, externalCreds []containerregistry.Credential) error {
dockerClient, err := s.dockerService.GetClient()
if err != nil {
s.eventService.LogErrorEvent(ctx, models.EventTypeImageError, "image", "", imageName, user.ID, user.Username, "0", err, models.JSON{"action": "pull"})
@@ -168,7 +169,7 @@ func (s *ImageService) PullImage(ctx context.Context, imageName string, progress
return nil
}
-func (s *ImageService) LoadImageFromReader(ctx context.Context, reader io.Reader, fileName string, user models.User, maxSizeBytes int64) (*dto.ImageLoadResultDto, error) {
+func (s *ImageService) LoadImageFromReader(ctx context.Context, reader io.Reader, fileName string, user models.User, maxSizeBytes int64) (*imagetypes.LoadResult, error) {
// Wrap reader with size limit enforcement
limitedReader := io.LimitReader(reader, maxSizeBytes+1)
@@ -190,7 +191,7 @@ func (s *ImageService) LoadImageFromReader(ctx context.Context, reader io.Reader
}
defer loadResp.Body.Close()
- var result dto.ImageLoadResultDto
+ var result imagetypes.LoadResult
responseBytes, err := io.ReadAll(loadResp.Body)
if err != nil {
s.eventService.LogErrorEvent(ctx, models.EventTypeImageError, "image", "", fileName, user.ID, user.Username, "0", err, models.JSON{"action": "load", "file": fileName, "step": "read_response"})
@@ -229,7 +230,7 @@ func (s *ImageService) ImageExistsLocally(ctx context.Context, imageName string)
return false, fmt.Errorf("failed to inspect image %s: %w", imageName, err)
}
-func (s *ImageService) getPullOptionsWithAuth(ctx context.Context, imageRef string, externalCreds []dto.ContainerRegistryCredential) (image.PullOptions, error) {
+func (s *ImageService) getPullOptionsWithAuth(ctx context.Context, imageRef string, externalCreds []containerregistry.Credential) (image.PullOptions, error) {
pullOptions := image.PullOptions{}
registryHost := s.extractRegistryHost(imageRef)
@@ -400,7 +401,7 @@ func (s *ImageService) PruneImages(ctx context.Context, dangling bool) (*image.P
return &report, nil
}
-func (s *ImageService) ListImagesPaginated(ctx context.Context, params pagination.QueryParams) ([]dto.ImageSummaryDto, pagination.Response, error) {
+func (s *ImageService) ListImagesPaginated(ctx context.Context, params pagination.QueryParams) ([]imagetypes.Summary, pagination.Response, error) {
dockerClient, err := s.dockerService.GetClient()
if err != nil {
return nil, pagination.Response{}, fmt.Errorf("failed to connect to Docker: %w", err)
@@ -575,8 +576,8 @@ func stringPtrValue(p *string) string {
return *p
}
-func buildUpdateInfo(updateRecord *models.ImageUpdateRecord) *dto.ImageUpdateInfoDto {
- return &dto.ImageUpdateInfoDto{
+func buildUpdateInfo(updateRecord *models.ImageUpdateRecord) *imagetypes.UpdateInfo {
+ return &imagetypes.UpdateInfo{
HasUpdate: updateRecord.HasUpdate,
UpdateType: updateRecord.UpdateType,
CurrentVersion: updateRecord.CurrentVersion,
@@ -593,12 +594,12 @@ func buildUpdateInfo(updateRecord *models.ImageUpdateRecord) *dto.ImageUpdateInf
}
}
-func mapDockerImagesToDTOs(dockerImages []image.Summary, inUseMap map[string]bool, updateMap map[string]*models.ImageUpdateRecord) []dto.ImageSummaryDto {
- items := make([]dto.ImageSummaryDto, 0, len(dockerImages))
+func mapDockerImagesToDTOs(dockerImages []image.Summary, inUseMap map[string]bool, updateMap map[string]*models.ImageUpdateRecord) []imagetypes.Summary {
+ items := make([]imagetypes.Summary, 0, len(dockerImages))
for _, di := range dockerImages {
repo, tag := determineRepoAndTag(di)
- imageDto := dto.ImageSummaryDto{
+ imageDto := imagetypes.Summary{
ID: di.ID,
Repo: repo,
Tag: tag,
@@ -620,35 +621,35 @@ func mapDockerImagesToDTOs(dockerImages []image.Summary, inUseMap map[string]boo
return items
}
-func (s *ImageService) getImagePaginationConfig() pagination.Config[dto.ImageSummaryDto] {
- return pagination.Config[dto.ImageSummaryDto]{
- SearchAccessors: []pagination.SearchAccessor[dto.ImageSummaryDto]{
- func(i dto.ImageSummaryDto) (string, error) { return i.Repo, nil },
- func(i dto.ImageSummaryDto) (string, error) { return i.Tag, nil },
- func(i dto.ImageSummaryDto) (string, error) { return i.ID, nil },
- func(i dto.ImageSummaryDto) (string, error) {
+func (s *ImageService) getImagePaginationConfig() pagination.Config[imagetypes.Summary] {
+ return pagination.Config[imagetypes.Summary]{
+ SearchAccessors: []pagination.SearchAccessor[imagetypes.Summary]{
+ func(i imagetypes.Summary) (string, error) { return i.Repo, nil },
+ func(i imagetypes.Summary) (string, error) { return i.Tag, nil },
+ func(i imagetypes.Summary) (string, error) { return i.ID, nil },
+ func(i imagetypes.Summary) (string, error) {
if len(i.RepoTags) > 0 {
return i.RepoTags[0], nil
}
return "", nil
},
},
- SortBindings: []pagination.SortBinding[dto.ImageSummaryDto]{
+ SortBindings: []pagination.SortBinding[imagetypes.Summary]{
{
Key: "repo",
- Fn: func(a, b dto.ImageSummaryDto) int {
+ Fn: func(a, b imagetypes.Summary) int {
return strings.Compare(a.Repo, b.Repo)
},
},
{
Key: "tag",
- Fn: func(a, b dto.ImageSummaryDto) int {
+ Fn: func(a, b imagetypes.Summary) int {
return strings.Compare(a.Tag, b.Tag)
},
},
{
Key: "size",
- Fn: func(a, b dto.ImageSummaryDto) int {
+ Fn: func(a, b imagetypes.Summary) int {
if a.Size < b.Size {
return -1
}
@@ -660,7 +661,7 @@ func (s *ImageService) getImagePaginationConfig() pagination.Config[dto.ImageSum
},
{
Key: "created",
- Fn: func(a, b dto.ImageSummaryDto) int {
+ Fn: func(a, b imagetypes.Summary) int {
if a.Created < b.Created {
return -1
}
@@ -672,7 +673,7 @@ func (s *ImageService) getImagePaginationConfig() pagination.Config[dto.ImageSum
},
{
Key: "inUse",
- Fn: func(a, b dto.ImageSummaryDto) int {
+ Fn: func(a, b imagetypes.Summary) int {
if a.InUse == b.InUse {
return 0
}
@@ -683,10 +684,10 @@ func (s *ImageService) getImagePaginationConfig() pagination.Config[dto.ImageSum
},
},
},
- FilterAccessors: []pagination.FilterAccessor[dto.ImageSummaryDto]{
+ FilterAccessors: []pagination.FilterAccessor[imagetypes.Summary]{
{
Key: "inUse",
- Fn: func(i dto.ImageSummaryDto, filterValue string) bool {
+ Fn: func(i imagetypes.Summary, filterValue string) bool {
if filterValue == "true" {
return i.InUse
}
@@ -698,7 +699,7 @@ func (s *ImageService) getImagePaginationConfig() pagination.Config[dto.ImageSum
},
{
Key: "updates",
- Fn: func(i dto.ImageSummaryDto, filterValue string) bool {
+ Fn: func(i imagetypes.Summary, filterValue string) bool {
hasUpdate := i.UpdateInfo != nil && i.UpdateInfo.HasUpdate
if filterValue == "true" {
return hasUpdate
diff --git a/backend/internal/services/image_update_service.go b/backend/internal/services/image_update_service.go
index dcf889ea6..dc58754d1 100644
--- a/backend/internal/services/image_update_service.go
+++ b/backend/internal/services/image_update_service.go
@@ -10,10 +10,11 @@ import (
"github.com/docker/docker/api/types/image"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/utils"
registry "github.com/getarcaneapp/arcane/backend/internal/utils/registry"
+ "go.getarcane.app/types/containerregistry"
+ "go.getarcane.app/types/imageupdate"
ref "go.podman.io/image/v5/docker/reference"
"golang.org/x/sync/errgroup"
"gorm.io/gorm"
@@ -45,12 +46,12 @@ func NewImageUpdateService(db *database.DB, settingsService *SettingsService, re
}
}
-func (s *ImageUpdateService) CheckImageUpdate(ctx context.Context, imageRef string) (*dto.ImageUpdateResponse, error) {
+func (s *ImageUpdateService) CheckImageUpdate(ctx context.Context, imageRef string) (*imageupdate.Response, error) {
startTime := time.Now()
parts := s.parseImageReference(imageRef)
if parts == nil {
- return &dto.ImageUpdateResponse{
+ return &imageupdate.Response{
Error: "Invalid image reference format",
CheckTime: time.Now(),
ResponseTimeMs: int(time.Since(startTime).Milliseconds()),
@@ -61,7 +62,7 @@ func (s *ImageUpdateService) CheckImageUpdate(ctx context.Context, imageRef stri
digestResult, err := s.checkDigestUpdate(ctx, parts, registries)
if err != nil {
- result := &dto.ImageUpdateResponse{
+ result := &imageupdate.Response{
Error: err.Error(),
CheckTime: time.Now(),
ResponseTimeMs: int(time.Since(startTime).Milliseconds()),
@@ -167,7 +168,7 @@ func (s *ImageUpdateService) getRegistryToken(ctx context.Context, regHost, repo
return "", nil, fmt.Errorf("failed to get registry token")
}
-func (s *ImageUpdateService) checkDigestUpdate(ctx context.Context, parts *ImageParts, registries []models.ContainerRegistry) (*dto.ImageUpdateResponse, error) {
+func (s *ImageUpdateService) checkDigestUpdate(ctx context.Context, parts *ImageParts, registries []models.ContainerRegistry) (*imageupdate.Response, error) {
rc := registry.NewClient()
token, auth, err := s.getRegistryToken(ctx, parts.Registry, parts.Repository, registries)
@@ -214,7 +215,7 @@ func (s *ImageUpdateService) checkDigestUpdate(ctx context.Context, parts *Image
"remoteDigest", remoteDigest,
"hasUpdate", hasUpdate)
- return &dto.ImageUpdateResponse{
+ return &imageupdate.Response{
HasUpdate: hasUpdate,
UpdateType: "digest",
CurrentDigest: localDigest,
@@ -473,7 +474,7 @@ func (s *ImageUpdateService) normalizeRepository(regHost, repo string) string {
return repo
}
-func (s *ImageUpdateService) CheckImageUpdateByID(ctx context.Context, imageID string) (*dto.ImageUpdateResponse, error) {
+func (s *ImageUpdateService) CheckImageUpdateByID(ctx context.Context, imageID string) (*imageupdate.Response, error) {
imageRef, err := s.getImageRefByID(ctx, imageID)
if err != nil {
metadata := models.JSON{
@@ -496,7 +497,7 @@ func (s *ImageUpdateService) CheckImageUpdateByID(ctx context.Context, imageID s
return result, nil
}
-func (s *ImageUpdateService) saveUpdateResult(ctx context.Context, imageRef string, result *dto.ImageUpdateResponse) error {
+func (s *ImageUpdateService) saveUpdateResult(ctx context.Context, imageRef string, result *imageupdate.Response) error {
parts := s.parseImageReference(imageRef)
if parts == nil {
return fmt.Errorf("invalid image reference")
@@ -554,7 +555,7 @@ func stringToPtr(s string) *string {
return &s
}
-func buildImageUpdateRecord(imageID, repo, tag string, result *dto.ImageUpdateResponse) *models.ImageUpdateRecord {
+func buildImageUpdateRecord(imageID, repo, tag string, result *imageupdate.Response) *models.ImageUpdateRecord {
currentVersion := result.CurrentVersion
if currentVersion == "" {
currentVersion = tag
@@ -580,7 +581,7 @@ func buildImageUpdateRecord(imageID, repo, tag string, result *dto.ImageUpdateRe
}
}
-func (s *ImageUpdateService) saveUpdateResultByID(ctx context.Context, imageID string, result *dto.ImageUpdateResponse) error {
+func (s *ImageUpdateService) saveUpdateResultByID(ctx context.Context, imageID string, result *imageupdate.Response) error {
return s.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
dockerClient, err := s.dockerService.GetClient()
if err != nil {
@@ -627,15 +628,15 @@ type batchImage struct {
parts *ImageParts
}
-func (s *ImageUpdateService) parseAndGroupImages(imageRefs []string) (map[string]map[string]struct{}, map[string]*dto.ImageUpdateResponse, []batchImage) {
+func (s *ImageUpdateService) parseAndGroupImages(imageRefs []string) (map[string]map[string]struct{}, map[string]*imageupdate.Response, []batchImage) {
regRepos := make(map[string]map[string]struct{})
- results := make(map[string]*dto.ImageUpdateResponse)
+ results := make(map[string]*imageupdate.Response)
var images []batchImage
for _, ref := range imageRefs {
parts := s.parseImageReference(ref)
if parts == nil {
- results[ref] = &dto.ImageUpdateResponse{
+ results[ref] = &imageupdate.Response{
Error: "Invalid image reference format",
CheckTime: time.Now(),
ResponseTimeMs: 0,
@@ -651,7 +652,7 @@ func (s *ImageUpdateService) parseAndGroupImages(imageRefs []string) (map[string
return regRepos, results, images
}
-func (s *ImageUpdateService) buildCredentialMap(ctx context.Context, externalCreds []dto.ContainerRegistryCredential) (map[string]batchCred, []models.ContainerRegistry) {
+func (s *ImageUpdateService) buildCredentialMap(ctx context.Context, externalCreds []containerregistry.Credential) (map[string]batchCred, []models.ContainerRegistry) {
var enabledRegs []models.ContainerRegistry
credMap := make(map[string]batchCred)
@@ -808,7 +809,7 @@ func (s *ImageUpdateService) checkSingleImageInBatch(
authMap map[string]regAuth,
enabledRegs []models.ContainerRegistry,
parts *ImageParts,
-) *dto.ImageUpdateResponse {
+) *imageupdate.Response {
start := time.Now()
authInfo := authMap[parts.Registry]
@@ -827,7 +828,7 @@ func (s *ImageUpdateService) checkSingleImageInBatch(
}
}
if digestErr != nil {
- return &dto.ImageUpdateResponse{
+ return &imageupdate.Response{
Error: digestErr.Error(),
CheckTime: time.Now(),
ResponseTimeMs: int(time.Since(start).Milliseconds()),
@@ -840,7 +841,7 @@ func (s *ImageUpdateService) checkSingleImageInBatch(
localDigest, allLocalDigests, ldErr := s.getLocalImageDigestWithAll(ctx, fmt.Sprintf("%s/%s:%s", parts.Registry, parts.Repository, parts.Tag))
if ldErr != nil {
- return &dto.ImageUpdateResponse{
+ return &imageupdate.Response{
Error: ldErr.Error(),
CheckTime: time.Now(),
ResponseTimeMs: int(time.Since(start).Milliseconds()),
@@ -860,7 +861,7 @@ func (s *ImageUpdateService) checkSingleImageInBatch(
}
}
- return &dto.ImageUpdateResponse{
+ return &imageupdate.Response{
HasUpdate: hasDigestUpdate,
UpdateType: "digest",
CurrentDigest: localDigest,
@@ -874,9 +875,9 @@ func (s *ImageUpdateService) checkSingleImageInBatch(
}
}
-func (s *ImageUpdateService) CheckMultipleImages(ctx context.Context, imageRefs []string, externalCreds []dto.ContainerRegistryCredential) (map[string]*dto.ImageUpdateResponse, error) {
+func (s *ImageUpdateService) CheckMultipleImages(ctx context.Context, imageRefs []string, externalCreds []containerregistry.Credential) (map[string]*imageupdate.Response, error) {
startBatch := time.Now()
- results := make(map[string]*dto.ImageUpdateResponse, len(imageRefs))
+ results := make(map[string]*imageupdate.Response, len(imageRefs))
if len(imageRefs) == 0 {
return results, nil
}
@@ -933,14 +934,14 @@ func (s *ImageUpdateService) CheckMultipleImages(ctx context.Context, imageRefs
return results, nil
}
-func (s *ImageUpdateService) CheckAllImages(ctx context.Context, limit int, externalCreds []dto.ContainerRegistryCredential) (map[string]*dto.ImageUpdateResponse, error) {
+func (s *ImageUpdateService) CheckAllImages(ctx context.Context, limit int, externalCreds []containerregistry.Credential) (map[string]*imageupdate.Response, error) {
imageRefs, err := s.getAllImageRefs(ctx, limit)
if err != nil {
return nil, fmt.Errorf("failed to get image references: %w", err)
}
if len(imageRefs) == 0 {
- return make(map[string]*dto.ImageUpdateResponse), nil
+ return make(map[string]*imageupdate.Response), nil
}
return s.CheckMultipleImages(ctx, imageRefs, externalCreds)
@@ -988,7 +989,7 @@ func (s *ImageUpdateService) CleanupOrphanedRecords(ctx context.Context) error {
})
}
-func (s *ImageUpdateService) GetUpdateSummary(ctx context.Context) (*dto.ImageUpdateSummaryResponse, error) {
+func (s *ImageUpdateService) GetUpdateSummary(ctx context.Context) (*imageupdate.Summary, error) {
var (
totalImages int64
imagesWithUpdates int64
@@ -1019,7 +1020,7 @@ func (s *ImageUpdateService) GetUpdateSummary(ctx context.Context) (*dto.ImageUp
return nil, err
}
- return &dto.ImageUpdateSummaryResponse{
+ return &imageupdate.Summary{
TotalImages: int(totalImages),
ImagesWithUpdates: int(imagesWithUpdates),
DigestUpdates: int(digestUpdates),
diff --git a/backend/internal/services/network_service.go b/backend/internal/services/network_service.go
index d5905a869..222db9921 100644
--- a/backend/internal/services/network_service.go
+++ b/backend/internal/services/network_service.go
@@ -9,10 +9,10 @@ import (
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/network"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
dockerutil "github.com/getarcaneapp/arcane/backend/internal/utils/docker"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
+ networktypes "go.getarcane.app/types/network"
)
type NetworkService struct {
@@ -123,7 +123,7 @@ func (s *NetworkService) PruneNetworks(ctx context.Context) (*network.PruneRepor
return &report, nil
}
-func (s *NetworkService) ListNetworksPaginated(ctx context.Context, params pagination.QueryParams) ([]dto.NetworkSummaryDto, pagination.Response, error) {
+func (s *NetworkService) ListNetworksPaginated(ctx context.Context, params pagination.QueryParams) ([]networktypes.Summary, pagination.Response, error) {
dockerClient, err := s.dockerService.GetClient()
if err != nil {
return nil, pagination.Response{}, fmt.Errorf("failed to connect to Docker: %w", err)
@@ -153,43 +153,43 @@ func (s *NetworkService) ListNetworksPaginated(ctx context.Context, params pagin
return nil, pagination.Response{}, fmt.Errorf("failed to list Docker networks: %w", err)
}
- items := make([]dto.NetworkSummaryDto, 0, len(rawNets))
+ items := make([]networktypes.Summary, 0, len(rawNets))
for _, n := range rawNets {
- netDto := dto.NewNetworkSummaryDto(n)
+ netDto := networktypes.NewSummary(n)
netDto.InUse = inUseByID[netDto.ID] || inUseByName[netDto.Name]
netDto.IsDefault = dockerutil.IsDefaultNetwork(netDto.Name)
items = append(items, netDto)
}
- config := pagination.Config[dto.NetworkSummaryDto]{
- SearchAccessors: []pagination.SearchAccessor[dto.NetworkSummaryDto]{
- func(n dto.NetworkSummaryDto) (string, error) { return n.Name, nil },
- func(n dto.NetworkSummaryDto) (string, error) { return n.Driver, nil },
- func(n dto.NetworkSummaryDto) (string, error) { return n.Scope, nil },
- func(n dto.NetworkSummaryDto) (string, error) { return n.ID, nil },
+ config := pagination.Config[networktypes.Summary]{
+ SearchAccessors: []pagination.SearchAccessor[networktypes.Summary]{
+ func(n networktypes.Summary) (string, error) { return n.Name, nil },
+ func(n networktypes.Summary) (string, error) { return n.Driver, nil },
+ func(n networktypes.Summary) (string, error) { return n.Scope, nil },
+ func(n networktypes.Summary) (string, error) { return n.ID, nil },
},
- SortBindings: []pagination.SortBinding[dto.NetworkSummaryDto]{
+ SortBindings: []pagination.SortBinding[networktypes.Summary]{
{
Key: "name",
- Fn: func(a, b dto.NetworkSummaryDto) int {
+ Fn: func(a, b networktypes.Summary) int {
return strings.Compare(a.Name, b.Name)
},
},
{
Key: "driver",
- Fn: func(a, b dto.NetworkSummaryDto) int {
+ Fn: func(a, b networktypes.Summary) int {
return strings.Compare(a.Driver, b.Driver)
},
},
{
Key: "scope",
- Fn: func(a, b dto.NetworkSummaryDto) int {
+ Fn: func(a, b networktypes.Summary) int {
return strings.Compare(a.Scope, b.Scope)
},
},
{
Key: "created",
- Fn: func(a, b dto.NetworkSummaryDto) int {
+ Fn: func(a, b networktypes.Summary) int {
if a.Created.Before(b.Created) {
return -1
}
@@ -201,7 +201,7 @@ func (s *NetworkService) ListNetworksPaginated(ctx context.Context, params pagin
},
{
Key: "inUse",
- Fn: func(a, b dto.NetworkSummaryDto) int {
+ Fn: func(a, b networktypes.Summary) int {
if a.InUse == b.InUse {
return 0
}
@@ -212,10 +212,10 @@ func (s *NetworkService) ListNetworksPaginated(ctx context.Context, params pagin
},
},
},
- FilterAccessors: []pagination.FilterAccessor[dto.NetworkSummaryDto]{
+ FilterAccessors: []pagination.FilterAccessor[networktypes.Summary]{
{
Key: "inUse",
- Fn: func(n dto.NetworkSummaryDto, filterValue string) bool {
+ Fn: func(n networktypes.Summary, filterValue string) bool {
if filterValue == "true" {
return n.InUse
}
diff --git a/backend/internal/services/notification_service.go b/backend/internal/services/notification_service.go
index 678aa7a4f..0c94aa097 100644
--- a/backend/internal/services/notification_service.go
+++ b/backend/internal/services/notification_service.go
@@ -16,11 +16,11 @@ import (
"github.com/getarcaneapp/arcane/backend/internal/config"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/utils"
"github.com/getarcaneapp/arcane/backend/internal/utils/notifications"
"github.com/getarcaneapp/arcane/backend/resources"
+ "go.getarcane.app/types/imageupdate"
)
type NotificationService struct {
@@ -89,7 +89,7 @@ func (s *NotificationService) DeleteSettings(ctx context.Context, provider model
return nil
}
-func (s *NotificationService) SendImageUpdateNotification(ctx context.Context, imageRef string, updateInfo *dto.ImageUpdateResponse, eventType models.NotificationEventType) error {
+func (s *NotificationService) SendImageUpdateNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, eventType models.NotificationEventType) error {
// Send to Apprise if enabled (don't block on error)
if appriseErr := s.appriseService.SendImageUpdateNotification(ctx, imageRef, updateInfo); appriseErr != nil {
slog.WarnContext(ctx, "Failed to send Apprise notification", "error", appriseErr)
@@ -229,7 +229,7 @@ func (s *NotificationService) SendContainerUpdateNotification(ctx context.Contex
return nil
}
-func (s *NotificationService) sendDiscordNotification(ctx context.Context, imageRef string, updateInfo *dto.ImageUpdateResponse, config models.JSON) error {
+func (s *NotificationService) sendDiscordNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {
var discordConfig models.DiscordConfig
configBytes, err := json.Marshal(config)
if err != nil {
@@ -339,7 +339,7 @@ func (s *NotificationService) sendDiscordNotification(ctx context.Context, image
return nil
}
-func (s *NotificationService) sendEmailNotification(ctx context.Context, imageRef string, updateInfo *dto.ImageUpdateResponse, config models.JSON) error {
+func (s *NotificationService) sendEmailNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {
var emailConfig models.EmailConfig
configBytes, err := json.Marshal(config)
if err != nil {
@@ -392,7 +392,7 @@ func (s *NotificationService) sendEmailNotification(ctx context.Context, imageRe
return nil
}
-func (s *NotificationService) renderEmailTemplate(imageRef string, updateInfo *dto.ImageUpdateResponse) (string, string, error) {
+func (s *NotificationService) renderEmailTemplate(imageRef string, updateInfo *imageupdate.Response) (string, string, error) {
data := map[string]interface{}{
"LogoURL": "https://raw.githubusercontent.com/getarcaneapp/arcane/main/backend/resources/images/logo-full.svg",
"AppURL": s.config.AppUrl,
@@ -644,7 +644,7 @@ func (s *NotificationService) TestNotification(ctx context.Context, provider mod
return fmt.Errorf("please save your %s settings before testing", provider)
}
- testUpdate := &dto.ImageUpdateResponse{
+ testUpdate := &imageupdate.Response{
HasUpdate: true,
UpdateType: "digest",
CurrentDigest: "sha256:abc123def456789012345678901234567890",
@@ -775,12 +775,12 @@ func (s *NotificationService) logNotification(ctx context.Context, provider mode
}
}
-func (s *NotificationService) SendBatchImageUpdateNotification(ctx context.Context, updates map[string]*dto.ImageUpdateResponse) error {
+func (s *NotificationService) SendBatchImageUpdateNotification(ctx context.Context, updates map[string]*imageupdate.Response) error {
if len(updates) == 0 {
return nil
}
- updatesWithChanges := make(map[string]*dto.ImageUpdateResponse)
+ updatesWithChanges := make(map[string]*imageupdate.Response)
for imageRef, update := range updates {
if update != nil && update.HasUpdate {
updatesWithChanges[imageRef] = update
@@ -850,7 +850,7 @@ func (s *NotificationService) SendBatchImageUpdateNotification(ctx context.Conte
return nil
}
-func (s *NotificationService) sendBatchDiscordNotification(ctx context.Context, updates map[string]*dto.ImageUpdateResponse, config models.JSON) error {
+func (s *NotificationService) sendBatchDiscordNotification(ctx context.Context, updates map[string]*imageupdate.Response, config models.JSON) error {
var discordConfig models.DiscordConfig
configBytes, err := json.Marshal(config)
if err != nil {
@@ -929,7 +929,7 @@ func (s *NotificationService) sendBatchDiscordNotification(ctx context.Context,
return nil
}
-func (s *NotificationService) sendBatchEmailNotification(ctx context.Context, updates map[string]*dto.ImageUpdateResponse, config models.JSON) error {
+func (s *NotificationService) sendBatchEmailNotification(ctx context.Context, updates map[string]*imageupdate.Response, config models.JSON) error {
var emailConfig models.EmailConfig
configBytes, err := json.Marshal(config)
if err != nil {
@@ -988,7 +988,7 @@ func (s *NotificationService) sendBatchEmailNotification(ctx context.Context, up
return nil
}
-func (s *NotificationService) renderBatchEmailTemplate(updates map[string]*dto.ImageUpdateResponse) (string, string, error) {
+func (s *NotificationService) renderBatchEmailTemplate(updates map[string]*imageupdate.Response) (string, string, error) {
data := map[string]interface{}{
"LogoURL": "https://raw.githubusercontent.com/getarcaneapp/arcane/main/backend/resources/images/logo-full.svg",
"AppURL": s.config.AppUrl,
diff --git a/backend/internal/services/oidc_service.go b/backend/internal/services/oidc_service.go
index 612bcf9be..6ca19eef8 100644
--- a/backend/internal/services/oidc_service.go
+++ b/backend/internal/services/oidc_service.go
@@ -18,9 +18,9 @@ import (
"golang.org/x/sync/singleflight"
"github.com/getarcaneapp/arcane/backend/internal/config"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/utils"
+ "go.getarcane.app/types/auth"
)
type OidcService struct {
@@ -256,7 +256,7 @@ func (s *OidcService) fetchClaims(ctx context.Context, provider *oidc.Provider,
return claims, nil
}
-func (s *OidcService) HandleCallback(ctx context.Context, code, state, storedState string) (*dto.OidcUserInfo, *dto.OidcTokenResponse, error) {
+func (s *OidcService) HandleCallback(ctx context.Context, code, state, storedState string) (*auth.OidcUserInfo, *auth.OidcTokenResponse, error) {
slog.Debug("HandleCallback: processing callback", "code_present", code != "", "state_present", state != "")
stateData, err := s.validateState(state, storedState)
@@ -355,7 +355,7 @@ func (s *OidcService) verifyIDToken(ctx context.Context, provider *oidc.Provider
return idToken, rawIDToken, nil
}
-func (s *OidcService) buildUserInfo(ctx context.Context, provider *oidc.Provider, token *oauth2.Token, idToken *oidc.IDToken, rawIDToken string) (*dto.OidcUserInfo, *dto.OidcTokenResponse, error) {
+func (s *OidcService) buildUserInfo(ctx context.Context, provider *oidc.Provider, token *oauth2.Token, idToken *oidc.IDToken, rawIDToken string) (*auth.OidcUserInfo, *auth.OidcTokenResponse, error) {
claims, err := s.fetchClaims(ctx, provider, token, idToken)
if err != nil {
slog.Error("HandleCallback: failed to fetch claims", "error", err)
@@ -368,7 +368,7 @@ func (s *OidcService) buildUserInfo(ctx context.Context, provider *oidc.Provider
return nil, nil, errors.New("missing required 'sub' claim in user info")
}
- userInfoDto := dto.OidcUserInfo{
+ userInfoDto := auth.OidcUserInfo{
Subject: subject,
Name: utils.GetStringClaim(claims, "name"),
Email: utils.GetStringClaim(claims, "email"),
@@ -387,7 +387,7 @@ func (s *OidcService) buildUserInfo(ctx context.Context, provider *oidc.Provider
tokenType = "Bearer"
}
- tokenResp := &dto.OidcTokenResponse{
+ tokenResp := &auth.OidcTokenResponse{
AccessToken: token.AccessToken,
TokenType: tokenType,
RefreshToken: token.RefreshToken,
diff --git a/backend/internal/services/project_service.go b/backend/internal/services/project_service.go
index 1e03744b5..4a0eded22 100644
--- a/backend/internal/services/project_service.go
+++ b/backend/internal/services/project_service.go
@@ -13,15 +13,18 @@ import (
"time"
"github.com/compose-spec/compose-go/v2/loader"
+ composetypes "github.com/compose-spec/compose-go/v2/types"
"github.com/docker/compose/v5/pkg/api"
"github.com/docker/docker/api/types/container"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/utils"
"github.com/getarcaneapp/arcane/backend/internal/utils/fs"
+ "github.com/getarcaneapp/arcane/backend/internal/utils/mapper"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
"github.com/getarcaneapp/arcane/backend/internal/utils/projects"
+ "go.getarcane.app/types/containerregistry"
+ "go.getarcane.app/types/project"
"gorm.io/gorm"
)
@@ -197,23 +200,23 @@ func (s *ProjectService) GetProjectContent(ctx context.Context, projectID string
return fs.ReadProjectFiles(proj.Path)
}
-func (s *ProjectService) GetProjectDetails(ctx context.Context, projectID string) (dto.ProjectDetailsDto, error) {
+func (s *ProjectService) GetProjectDetails(ctx context.Context, projectID string) (project.Details, error) {
proj, err := s.GetProjectFromDatabaseByID(ctx, projectID)
if err != nil {
- return dto.ProjectDetailsDto{}, err
+ return project.Details{}, err
}
composeContent, envContent, _ := s.GetProjectContent(ctx, projectID)
// Parse include files from the compose file
- var includeFiles []dto.IncludeFileDto
+ var includeFiles []project.IncludeFile
composeFile, detectErr := projects.DetectComposeFile(proj.Path)
if detectErr == nil {
includes, parseErr := projects.ParseIncludes(composeFile)
if parseErr == nil {
slog.InfoContext(ctx, "Parsed includes", "count", len(includes), "projectID", projectID)
for _, inc := range includes {
- includeFiles = append(includeFiles, dto.IncludeFileDto{
+ includeFiles = append(includeFiles, project.IncludeFile{
Path: inc.Path,
RelativePath: inc.RelativePath,
Content: inc.Content,
@@ -241,9 +244,9 @@ func (s *ProjectService) GetProjectDetails(ctx context.Context, projectID string
liveStatus = proj.Status
}
- var resp dto.ProjectDetailsDto
- if err := dto.MapStruct(proj, &resp); err != nil {
- return dto.ProjectDetailsDto{}, fmt.Errorf("failed to map project: %w", err)
+ var resp project.Details
+ if err := mapper.MapStruct(proj, &resp); err != nil {
+ return project.Details{}, fmt.Errorf("failed to map project: %w", err)
}
resp.Status = string(liveStatus)
resp.CreatedAt = proj.CreatedAt.Format(time.RFC3339)
@@ -254,12 +257,37 @@ func (s *ProjectService) GetProjectDetails(ctx context.Context, projectID string
resp.ServiceCount = serviceCount
resp.RunningCount = runningCount
resp.DirName = utils.DerefString(proj.DirName)
+
+ // Load compose services from the compose file
+ projectsDirSetting := s.settingsService.GetStringSetting(ctx, "projectsDirectory", "data/projects")
+ projectsDirectory, _ := fs.GetProjectsDirectory(ctx, strings.TrimSpace(projectsDirSetting))
+ if composeFile != "" {
+ composeProj, loadErr := projects.LoadComposeProject(ctx, composeFile, normalizeComposeProjectName(proj.Name), projectsDirectory)
+ if loadErr == nil && composeProj != nil {
+ // Convert map to slice
+ svcList := make([]composetypes.ServiceConfig, 0, len(composeProj.Services))
+ for _, svc := range composeProj.Services {
+ svcList = append(svcList, svc)
+ }
+ resp.Services = svcList
+ }
+ }
+
+ // Convert ProjectServiceInfo to project.RuntimeService
if serr == nil && services != nil {
- raw := make([]any, len(services))
- for i := range services {
- raw[i] = services[i]
+ runtimeServices := make([]project.RuntimeService, len(services))
+ for i, svc := range services {
+ runtimeServices[i] = project.RuntimeService{
+ Name: svc.Name,
+ Image: svc.Image,
+ Status: svc.Status,
+ ContainerID: svc.ContainerID,
+ ContainerName: svc.ContainerName,
+ Ports: svc.Ports,
+ Health: svc.Health,
+ }
}
- resp.Services = raw
+ resp.RuntimeServices = runtimeServices
}
return resp, nil
@@ -757,7 +785,7 @@ func (s *ProjectService) RedeployProject(ctx context.Context, projectID string,
return s.DeployProject(ctx, projectID, systemUser)
}
-func (s *ProjectService) PullProjectImages(ctx context.Context, projectID string, progressWriter io.Writer, credentials []dto.ContainerRegistryCredential) error {
+func (s *ProjectService) PullProjectImages(ctx context.Context, projectID string, progressWriter io.Writer, credentials []containerregistry.Credential) error {
proj, err := s.GetProjectFromDatabaseByID(ctx, projectID)
if err != nil {
return err
@@ -795,7 +823,7 @@ func (s *ProjectService) PullProjectImages(ctx context.Context, projectID string
// EnsureProjectImagesPresent checks all compose service images for the project and
// only pulls images that are not already available locally.
-func (s *ProjectService) EnsureProjectImagesPresent(ctx context.Context, projectID string, progressWriter io.Writer, credentials []dto.ContainerRegistryCredential) error {
+func (s *ProjectService) EnsureProjectImagesPresent(ctx context.Context, projectID string, progressWriter io.Writer, credentials []containerregistry.Credential) error {
proj, err := s.GetProjectFromDatabaseByID(ctx, projectID)
if err != nil {
return err
@@ -992,7 +1020,7 @@ func (s *ProjectService) StreamProjectLogs(ctx context.Context, projectID string
// Table Functions
-func (s *ProjectService) ListProjects(ctx context.Context, params pagination.QueryParams) ([]dto.ProjectDetailsDto, pagination.Response, error) {
+func (s *ProjectService) ListProjects(ctx context.Context, params pagination.QueryParams) ([]project.Details, pagination.Response, error) {
var projectsArray []models.Project
query := s.db.WithContext(ctx).Model(&models.Project{})
@@ -1023,15 +1051,15 @@ func (s *ProjectService) ListProjects(ctx context.Context, params pagination.Que
// fetchProjectStatusConcurrently fetches live Docker status for multiple projects in parallel
// Optimized to use a single Docker API call instead of N calls + N file reads
-func (s *ProjectService) fetchProjectStatusConcurrently(ctx context.Context, projectsList []models.Project) []dto.ProjectDetailsDto {
+func (s *ProjectService) fetchProjectStatusConcurrently(ctx context.Context, projectsList []models.Project) []project.Details {
// 1. Fetch all compose containers in one go
containers, err := projects.ListGlobalComposeContainers(ctx)
if err != nil {
slog.ErrorContext(ctx, "Failed to list global compose containers", "error", err)
// Fallback: return basic info with unknown status
- results := make([]dto.ProjectDetailsDto, len(projectsList))
+ results := make([]project.Details, len(projectsList))
for i, p := range projectsList {
- _ = dto.MapStruct(p, &results[i])
+ _ = mapper.MapStruct(p, &results[i])
results[i].Status = string(models.ProjectStatusUnknown)
}
return results
@@ -1047,7 +1075,7 @@ func (s *ProjectService) fetchProjectStatusConcurrently(ctx context.Context, pro
}
// 3. Map to DTOs
- results := make([]dto.ProjectDetailsDto, len(projectsList))
+ results := make([]project.Details, len(projectsList))
for i, p := range projectsList {
results[i] = s.mapProjectToDto(ctx, p, containersByProject)
}
@@ -1055,9 +1083,9 @@ func (s *ProjectService) fetchProjectStatusConcurrently(ctx context.Context, pro
return results
}
-func (s *ProjectService) mapProjectToDto(ctx context.Context, p models.Project, containersByProject map[string][]container.Summary) dto.ProjectDetailsDto {
- var resp dto.ProjectDetailsDto
- _ = dto.MapStruct(p, &resp)
+func (s *ProjectService) mapProjectToDto(ctx context.Context, p models.Project, containersByProject map[string][]container.Summary) project.Details {
+ var resp project.Details
+ _ = mapper.MapStruct(p, &resp)
resp.CreatedAt = p.CreatedAt.Format(time.RFC3339)
resp.UpdatedAt = p.UpdatedAt.Format(time.RFC3339)
@@ -1109,10 +1137,20 @@ func (s *ProjectService) mapProjectToDto(ctx context.Context, p models.Project,
}
}
- resp.Services = make([]any, len(services))
+ // Convert to RuntimeServices
+ runtimeServices := make([]project.RuntimeService, len(services))
for k, s := range services {
- resp.Services[k] = s
+ runtimeServices[k] = project.RuntimeService{
+ Name: s.Name,
+ Image: s.Image,
+ Status: s.Status,
+ ContainerID: s.ContainerID,
+ ContainerName: s.ContainerName,
+ Ports: s.Ports,
+ Health: s.Health,
+ }
}
+ resp.RuntimeServices = runtimeServices
// Use DB service count as the source of truth for "Total Services"
// since we are not parsing the YAML here.
diff --git a/backend/internal/services/settings_search_service.go b/backend/internal/services/settings_search_service.go
index b9affb29f..e602caf6c 100644
--- a/backend/internal/services/settings_search_service.go
+++ b/backend/internal/services/settings_search_service.go
@@ -6,13 +6,15 @@ import (
"strings"
"sync"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/utils"
+ "go.getarcane.app/types/category"
+ "go.getarcane.app/types/meta"
+ "go.getarcane.app/types/search"
)
type SettingsSearchService struct {
- categories []dto.SettingsCategory
+ categories []category.Category
once sync.Once
}
@@ -29,16 +31,16 @@ func (s *SettingsSearchService) initCategories() {
}
// GetSettingsCategories returns all available settings categories with their metadata
-func (s *SettingsSearchService) GetSettingsCategories() []dto.SettingsCategory {
+func (s *SettingsSearchService) GetSettingsCategories() []category.Category {
return s.categories
}
-func (s *SettingsSearchService) buildCategoriesFromModel() []dto.SettingsCategory {
+func (s *SettingsSearchService) buildCategoriesFromModel() []category.Category {
// Extract category metadata from struct tags (catmeta)
catMetaMap := utils.ExtractCategoryMetadata(models.Settings{}, nil)
// map category id -> list of settings
- categories := map[string][]dto.SettingMeta{}
+ categories := map[string][]meta.Metadata{}
categoryOrder := []string{} // Track order from first appearance in struct
rt := reflect.TypeOf(models.Settings{})
@@ -50,18 +52,18 @@ func (s *SettingsSearchService) buildCategoriesFromModel() []dto.SettingsCategor
continue
}
- meta := utils.ParseMetaTag(field.Tag.Get("meta"))
- label := meta["label"]
+ metaTag := utils.ParseMetaTag(field.Tag.Get("meta"))
+ label := metaTag["label"]
if label == "" {
label = key
}
- typ := meta["type"]
+ typ := metaTag["type"]
if typ == "" {
typ = "text"
}
- desc := meta["description"]
- keywords := utils.ParseKeywords(meta["keywords"])
- categoryID := meta["category"]
+ desc := metaTag["description"]
+ keywords := utils.ParseKeywords(metaTag["keywords"])
+ categoryID := metaTag["category"]
if categoryID == "" {
categoryID = "general"
}
@@ -76,7 +78,7 @@ func (s *SettingsSearchService) buildCategoriesFromModel() []dto.SettingsCategor
categoryOrder = append(categoryOrder, categoryID)
}
- sm := dto.SettingMeta{
+ sm := meta.Metadata{
Key: key,
Label: label,
Type: typ,
@@ -88,7 +90,7 @@ func (s *SettingsSearchService) buildCategoriesFromModel() []dto.SettingsCategor
}
// Build final category list in struct order
- results := []dto.SettingsCategory{}
+ results := []category.Category{}
for _, catID := range categoryOrder {
catMeta := catMetaMap[catID]
if catMeta == nil {
@@ -101,7 +103,7 @@ func (s *SettingsSearchService) buildCategoriesFromModel() []dto.SettingsCategor
keywords = []string{}
}
- results = append(results, dto.SettingsCategory{
+ results = append(results, category.Category{
ID: catMeta["id"],
Title: catMeta["title"],
Description: catMeta["description"],
@@ -116,38 +118,38 @@ func (s *SettingsSearchService) buildCategoriesFromModel() []dto.SettingsCategor
}
// Search performs a relevance-scored search across settings categories and individual settings
-func (s *SettingsSearchService) Search(query string) dto.SettingsSearchResponse {
+func (s *SettingsSearchService) Search(query string) search.Response {
query = strings.ToLower(strings.TrimSpace(query))
if query == "" {
- return dto.SettingsSearchResponse{
- Results: []dto.SettingsCategory{},
+ return search.Response{
+ Results: []category.Category{},
Query: query,
Count: 0,
}
}
categories := s.GetSettingsCategories()
- var results []dto.SettingsCategory
+ var results []category.Category
- for _, category := range categories {
+ for _, cat := range categories {
// Check if category matches
- categoryMatch := s.categoryMatches(category, query)
+ categoryMatch := s.categoryMatches(cat, query)
// Check individual settings with enhanced matching
- matchingSettings := s.findMatchingSettings(category.Settings, query)
+ matchingSettings := s.findMatchingSettings(cat.Settings, query)
if categoryMatch || len(matchingSettings) > 0 {
// Calculate relevance score based on match quality
- relevanceScore := s.calculateRelevance(category, matchingSettings, query)
-
- categoryResult := dto.SettingsCategory{
- ID: category.ID,
- Title: category.Title,
- Description: category.Description,
- Icon: category.Icon,
- URL: category.URL,
- Keywords: category.Keywords,
- Settings: category.Settings,
+ relevanceScore := s.calculateRelevance(cat, matchingSettings, query)
+
+ categoryResult := category.Category{
+ ID: cat.ID,
+ Title: cat.Title,
+ Description: cat.Description,
+ Icon: cat.Icon,
+ URL: cat.URL,
+ Keywords: cat.Keywords,
+ Settings: cat.Settings,
RelevanceScore: relevanceScore,
}
@@ -162,21 +164,21 @@ func (s *SettingsSearchService) Search(query string) dto.SettingsSearchResponse
// Sort by relevance (highest first)
s.sortByRelevance(results)
- return dto.SettingsSearchResponse{
+ return search.Response{
Results: results,
Query: query,
Count: len(results),
}
}
-func (s *SettingsSearchService) categoryMatches(category dto.SettingsCategory, query string) bool {
- if strings.Contains(strings.ToLower(category.Title), query) {
+func (s *SettingsSearchService) categoryMatches(cat category.Category, query string) bool {
+ if strings.Contains(strings.ToLower(cat.Title), query) {
return true
}
- if strings.Contains(strings.ToLower(category.Description), query) {
+ if strings.Contains(strings.ToLower(cat.Description), query) {
return true
}
- for _, keyword := range category.Keywords {
+ for _, keyword := range cat.Keywords {
if strings.Contains(strings.ToLower(keyword), query) {
return true
}
@@ -184,8 +186,8 @@ func (s *SettingsSearchService) categoryMatches(category dto.SettingsCategory, q
return false
}
-func (s *SettingsSearchService) findMatchingSettings(settings []dto.SettingMeta, query string) []dto.SettingMeta {
- var matching []dto.SettingMeta
+func (s *SettingsSearchService) findMatchingSettings(settings []meta.Metadata, query string) []meta.Metadata {
+ var matching []meta.Metadata
for _, setting := range settings {
if s.settingMatches(setting, query) {
matching = append(matching, setting)
@@ -194,7 +196,7 @@ func (s *SettingsSearchService) findMatchingSettings(settings []dto.SettingMeta,
return matching
}
-func (s *SettingsSearchService) settingMatches(setting dto.SettingMeta, query string) bool {
+func (s *SettingsSearchService) settingMatches(setting meta.Metadata, query string) bool {
if strings.Contains(strings.ToLower(setting.Key), query) {
return true
}
@@ -212,19 +214,19 @@ func (s *SettingsSearchService) settingMatches(setting dto.SettingMeta, query st
return false
}
-func (s *SettingsSearchService) calculateRelevance(category dto.SettingsCategory, matchingSettings []dto.SettingMeta, query string) int {
+func (s *SettingsSearchService) calculateRelevance(cat category.Category, matchingSettings []meta.Metadata, query string) int {
score := 0
// Category title/description match gets high score
- if strings.Contains(strings.ToLower(category.Title), query) {
+ if strings.Contains(strings.ToLower(cat.Title), query) {
score += 20
}
- if strings.Contains(strings.ToLower(category.Description), query) {
+ if strings.Contains(strings.ToLower(cat.Description), query) {
score += 15
}
// Exact keyword match
- for _, keyword := range category.Keywords {
+ for _, keyword := range cat.Keywords {
if strings.ToLower(keyword) == query {
score += 25
} else if strings.Contains(strings.ToLower(keyword), query) {
@@ -259,7 +261,7 @@ func (s *SettingsSearchService) calculateRelevance(category dto.SettingsCategory
return score
}
-func (s *SettingsSearchService) sortByRelevance(results []dto.SettingsCategory) {
+func (s *SettingsSearchService) sortByRelevance(results []category.Category) {
sort.Slice(results, func(i, j int) bool {
return results[i].RelevanceScore > results[j].RelevanceScore
})
diff --git a/backend/internal/services/settings_service.go b/backend/internal/services/settings_service.go
index 9380222fb..214a9935c 100644
--- a/backend/internal/services/settings_service.go
+++ b/backend/internal/services/settings_service.go
@@ -20,9 +20,9 @@ import (
"github.com/getarcaneapp/arcane/backend/internal/config"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/utils"
+ "go.getarcane.app/types/settings"
)
type SettingsService struct {
@@ -279,7 +279,7 @@ func (s *SettingsService) SyncOidcEnvToDatabase(ctx context.Context) ([]models.S
scopes = "openid email profile"
}
- return s.UpdateSettings(ctx, dto.UpdateSettingsDto{
+ return s.UpdateSettings(ctx, settings.Update{
OidcEnabled: &trueStr,
OidcClientId: &cfg.OidcClientID,
OidcClientSecret: &cfg.OidcClientSecret,
@@ -294,7 +294,7 @@ func (s *SettingsService) SyncOidcEnvToDatabase(ctx context.Context) ([]models.S
// and renames legacy auth* keys to their new oidc* names.
// This should be called during bootstrap to ensure existing configurations are preserved.
func (s *SettingsService) MigrateOidcConfigToFields(ctx context.Context) error {
- settings, err := s.GetSettings(ctx)
+ currentSettings, err := s.GetSettings(ctx)
if err != nil {
return fmt.Errorf("failed to get settings for OIDC migration: %w", err)
}
@@ -306,19 +306,19 @@ func (s *SettingsService) MigrateOidcConfigToFields(ctx context.Context) error {
}
// Check if migration is needed: if we have authOidcConfig but no oidcClientId
- if settings.AuthOidcConfig.Value == "" || settings.AuthOidcConfig.Value == "{}" {
+ if currentSettings.AuthOidcConfig.Value == "" || currentSettings.AuthOidcConfig.Value == "{}" {
slog.DebugContext(ctx, "No OIDC config to migrate")
return nil
}
// If individual fields are already populated, skip migration
- if settings.OidcClientId.Value != "" {
+ if currentSettings.OidcClientId.Value != "" {
slog.DebugContext(ctx, "OIDC fields already populated, skipping migration")
return nil
}
var oidcConfig models.OidcConfig
- if err := json.Unmarshal([]byte(settings.AuthOidcConfig.Value), &oidcConfig); err != nil {
+ if err := json.Unmarshal([]byte(currentSettings.AuthOidcConfig.Value), &oidcConfig); err != nil {
slog.WarnContext(ctx, "Failed to parse legacy OIDC config for migration", "error", err)
return nil
}
@@ -336,7 +336,7 @@ func (s *SettingsService) MigrateOidcConfigToFields(ctx context.Context) error {
scopes = "openid email profile"
}
- _, err = s.UpdateSettings(ctx, dto.UpdateSettingsDto{
+ _, err = s.UpdateSettings(ctx, settings.Update{
OidcClientId: &oidcConfig.ClientID,
OidcClientSecret: &oidcConfig.ClientSecret,
OidcIssuerUrl: &oidcConfig.IssuerURL,
@@ -407,7 +407,7 @@ func (s *SettingsService) UpdateSetting(ctx context.Context, key, value string)
})
}
-func (s *SettingsService) UpdateSettings(ctx context.Context, updates dto.UpdateSettingsDto) ([]models.SettingVariable, error) {
+func (s *SettingsService) UpdateSettings(ctx context.Context, updates settings.Update) ([]models.SettingVariable, error) {
defaultCfg := s.getDefaultSettings()
cfg, err := s.GetSettings(ctx)
if err != nil {
@@ -444,7 +444,7 @@ func (s *SettingsService) UpdateSettings(ctx context.Context, updates dto.Update
return settings.ToSettingVariableSlice(false, false), nil
}
-func (s *SettingsService) prepareUpdateValues(updates dto.UpdateSettingsDto, cfg, defaultCfg *models.Settings) ([]models.SettingVariable, bool, bool, error) {
+func (s *SettingsService) prepareUpdateValues(updates settings.Update, cfg, defaultCfg *models.Settings) ([]models.SettingVariable, bool, bool, error) {
rt := reflect.TypeOf(updates)
rv := reflect.ValueOf(updates)
valuesToUpdate := make([]models.SettingVariable, 0)
@@ -511,7 +511,7 @@ func (s *SettingsService) persistSettings(ctx context.Context, values []models.S
})
}
-func (s *SettingsService) handleOidcConfigUpdate(ctx context.Context, updates dto.UpdateSettingsDto) error {
+func (s *SettingsService) handleOidcConfigUpdate(ctx context.Context, updates settings.Update) error {
// Handle legacy JSON config format (for backward compatibility during migration)
if updates.AuthOidcConfig != nil {
newCfgStr := *updates.AuthOidcConfig
diff --git a/backend/internal/services/settings_service_test.go b/backend/internal/services/settings_service_test.go
index 8d56d0a40..52a8536e7 100644
--- a/backend/internal/services/settings_service_test.go
+++ b/backend/internal/services/settings_service_test.go
@@ -11,8 +11,8 @@ import (
"github.com/getarcaneapp/arcane/backend/internal/config"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
+ "go.getarcane.app/types/settings"
)
func setupSettingsTestDB(t *testing.T) *database.DB {
@@ -192,7 +192,7 @@ func TestSettingsService_UpdateSettings_MergeOidcSecret(t *testing.T) {
require.NoError(t, err)
s := string(nb)
- updates := dto.UpdateSettingsDto{
+ updates := settings.Update{
AuthOidcConfig: &s,
}
_, err = svc.UpdateSettings(ctx, updates)
@@ -256,7 +256,7 @@ func TestSettingsService_UpdateSettings_RefreshesCache(t *testing.T) {
require.NoError(t, svc.EnsureDefaultSettings(ctx))
newDir := "custom/projects2"
- req := dto.UpdateSettingsDto{
+ req := settings.Update{
ProjectsDirectory: &newDir,
}
diff --git a/backend/internal/services/system_service.go b/backend/internal/services/system_service.go
index 63f416a4d..385bb714c 100644
--- a/backend/internal/services/system_service.go
+++ b/backend/internal/services/system_service.go
@@ -12,10 +12,11 @@ import (
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/utils/converter"
"github.com/goccy/go-yaml"
+ containertypes "go.getarcane.app/types/container"
+ "go.getarcane.app/types/system"
"golang.org/x/sync/errgroup"
)
@@ -53,7 +54,7 @@ var systemUser = models.User{
Username: "System",
}
-func (s *SystemService) PruneAll(ctx context.Context, req dto.PruneSystemDto) (*dto.PruneAllResult, error) {
+func (s *SystemService) PruneAll(ctx context.Context, req system.PruneAllRequest) (*system.PruneAllResult, error) {
slog.InfoContext(ctx, "Starting selective prune operation",
slog.Bool("containers", req.Containers),
slog.Bool("images", req.Images),
@@ -62,7 +63,7 @@ func (s *SystemService) PruneAll(ctx context.Context, req dto.PruneSystemDto) (*
slog.Bool("build_cache", req.BuildCache),
slog.Bool("dangling", req.Dangling))
- result := &dto.PruneAllResult{Success: true}
+ result := &system.PruneAllResult{Success: true}
var mu sync.Mutex
// 1. Prune Containers first (sequential) as it may free up other resources
@@ -87,7 +88,7 @@ func (s *SystemService) PruneAll(ctx context.Context, req dto.PruneSystemDto) (*
}
slog.InfoContext(ctx, "Pruning images...", slog.Bool("dangling_only", danglingOnly))
- localResult := &dto.PruneAllResult{}
+ localResult := &system.PruneAllResult{}
if err := s.pruneImages(ctx, danglingOnly, localResult); err != nil {
mu.Lock()
result.Errors = append(result.Errors, fmt.Sprintf("Image pruning failed: %v", err))
@@ -106,7 +107,7 @@ func (s *SystemService) PruneAll(ctx context.Context, req dto.PruneSystemDto) (*
if req.BuildCache {
g.Go(func() error {
slog.InfoContext(ctx, "Pruning build cache...")
- localResult := &dto.PruneAllResult{}
+ localResult := &system.PruneAllResult{}
if err := s.pruneBuildCache(ctx, localResult, !req.Dangling); err != nil {
slog.WarnContext(ctx, "Build cache pruning encountered an error", slog.String("error", err.Error()))
// Build cache errors are often non-critical, but we log them
@@ -122,7 +123,7 @@ func (s *SystemService) PruneAll(ctx context.Context, req dto.PruneSystemDto) (*
if req.Volumes {
g.Go(func() error {
slog.InfoContext(ctx, "Pruning unused volumes...")
- localResult := &dto.PruneAllResult{}
+ localResult := &system.PruneAllResult{}
if err := s.pruneVolumes(ctx, localResult); err != nil {
mu.Lock()
result.Errors = append(result.Errors, fmt.Sprintf("Volume pruning failed: %v", err))
@@ -141,7 +142,7 @@ func (s *SystemService) PruneAll(ctx context.Context, req dto.PruneSystemDto) (*
if req.Networks {
g.Go(func() error {
slog.InfoContext(ctx, "Pruning unused networks...")
- localResult := &dto.PruneAllResult{}
+ localResult := &system.PruneAllResult{}
if err := s.pruneNetworks(ctx, localResult); err != nil {
mu.Lock()
result.Errors = append(result.Errors, fmt.Sprintf("Network pruning failed: %v", err))
@@ -185,8 +186,8 @@ func (s *SystemService) getDanglingModeFromSettings(ctx context.Context) (bool,
}
}
-func (s *SystemService) performBatchContainerAction(ctx context.Context, containers []container.Summary, actionName string, shouldProcess func(container.Summary) bool, action func(context.Context, string) error) *dto.ContainerActionResult {
- result := &dto.ContainerActionResult{Success: true}
+func (s *SystemService) performBatchContainerAction(ctx context.Context, containers []container.Summary, actionName string, shouldProcess func(container.Summary) bool, action func(context.Context, string) error) *containertypes.ActionResult {
+ result := &containertypes.ActionResult{Success: true}
var mu sync.Mutex
g, ctx := errgroup.WithContext(ctx)
@@ -224,10 +225,10 @@ func (s *SystemService) performBatchContainerAction(ctx context.Context, contain
return result
}
-func (s *SystemService) StartAllContainers(ctx context.Context) (*dto.ContainerActionResult, error) {
+func (s *SystemService) StartAllContainers(ctx context.Context) (*containertypes.ActionResult, error) {
containers, _, _, _, err := s.dockerService.GetAllContainers(ctx)
if err != nil {
- return &dto.ContainerActionResult{
+ return &containertypes.ActionResult{
Success: false,
Errors: []string{fmt.Sprintf("Failed to list containers: %v", err)},
}, err
@@ -240,10 +241,10 @@ func (s *SystemService) StartAllContainers(ctx context.Context) (*dto.ContainerA
}), nil
}
-func (s *SystemService) StartAllStoppedContainers(ctx context.Context) (*dto.ContainerActionResult, error) {
+func (s *SystemService) StartAllStoppedContainers(ctx context.Context) (*containertypes.ActionResult, error) {
containers, _, _, _, err := s.dockerService.GetAllContainers(ctx)
if err != nil {
- return &dto.ContainerActionResult{
+ return &containertypes.ActionResult{
Success: false,
Errors: []string{fmt.Sprintf("Failed to list containers: %v", err)},
}, err
@@ -256,10 +257,10 @@ func (s *SystemService) StartAllStoppedContainers(ctx context.Context) (*dto.Con
}), nil
}
-func (s *SystemService) StopAllContainers(ctx context.Context) (*dto.ContainerActionResult, error) {
+func (s *SystemService) StopAllContainers(ctx context.Context) (*containertypes.ActionResult, error) {
containers, _, _, _, err := s.dockerService.GetAllContainers(ctx)
if err != nil {
- return &dto.ContainerActionResult{
+ return &containertypes.ActionResult{
Success: false,
Errors: []string{fmt.Sprintf("Failed to list containers: %v", err)},
}, err
@@ -275,7 +276,7 @@ func (s *SystemService) StopAllContainers(ctx context.Context) (*dto.ContainerAc
}), nil
}
-func (s *SystemService) pruneContainers(ctx context.Context, result *dto.PruneAllResult) error {
+func (s *SystemService) pruneContainers(ctx context.Context, result *system.PruneAllResult) error {
dockerClient, err := s.dockerService.GetClient()
if err != nil {
return fmt.Errorf("failed to connect to Docker: %w", err)
@@ -293,7 +294,7 @@ func (s *SystemService) pruneContainers(ctx context.Context, result *dto.PruneAl
return nil
}
-func (s *SystemService) pruneImages(ctx context.Context, danglingOnly bool, result *dto.PruneAllResult) error {
+func (s *SystemService) pruneImages(ctx context.Context, danglingOnly bool, result *system.PruneAllResult) error {
slog.DebugContext(ctx, "Starting image pruning", slog.Bool("dangling_only", danglingOnly))
dockerClient, err := s.dockerService.GetClient()
@@ -344,7 +345,7 @@ func (s *SystemService) pruneImages(ctx context.Context, danglingOnly bool, resu
return nil
}
-func (s *SystemService) pruneBuildCache(ctx context.Context, result *dto.PruneAllResult, pruneAllCache bool) error {
+func (s *SystemService) pruneBuildCache(ctx context.Context, result *system.PruneAllResult, pruneAllCache bool) error {
dockerClient, err := s.dockerService.GetClient()
if err != nil {
result.Errors = append(result.Errors, fmt.Errorf("build cache pruning failed (connection): %w", err).Error())
@@ -373,7 +374,7 @@ func (s *SystemService) pruneBuildCache(ctx context.Context, result *dto.PruneAl
return nil
}
-func (s *SystemService) pruneVolumes(ctx context.Context, result *dto.PruneAllResult) error {
+func (s *SystemService) pruneVolumes(ctx context.Context, result *system.PruneAllResult) error {
// Prune ALL unused volumes (both named and anonymous)
// Note: Docker API only prunes volumes that are NOT in use by any containers (running or stopped)
// With all=true, it will remove both named and anonymous unused volumes
@@ -393,7 +394,7 @@ func (s *SystemService) pruneVolumes(ctx context.Context, result *dto.PruneAllRe
return nil
}
-func (s *SystemService) pruneNetworks(ctx context.Context, result *dto.PruneAllResult) error {
+func (s *SystemService) pruneNetworks(ctx context.Context, result *system.PruneAllResult) error {
// Note: Docker API only prunes networks that are NOT in use by any containers
report, err := s.networkService.PruneNetworks(ctx)
if err != nil {
diff --git a/backend/internal/services/template_service.go b/backend/internal/services/template_service.go
index 014c49157..cbdc82c0b 100644
--- a/backend/internal/services/template_service.go
+++ b/backend/internal/services/template_service.go
@@ -18,12 +18,14 @@ import (
composeloader "github.com/compose-spec/compose-go/v2/loader"
composetypes "github.com/compose-spec/compose-go/v2/types"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
appfs "github.com/getarcaneapp/arcane/backend/internal/utils/fs"
+ "github.com/getarcaneapp/arcane/backend/internal/utils/mapper"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
- "github.com/getarcaneapp/arcane/backend/internal/utils/template"
+ templateutil "github.com/getarcaneapp/arcane/backend/internal/utils/template"
"github.com/google/uuid"
+ "go.getarcane.app/types/env"
+ tmpl "go.getarcane.app/types/template"
"golang.org/x/sync/errgroup"
"gorm.io/gorm"
)
@@ -36,7 +38,7 @@ type remoteCache struct {
type registryFetchMeta struct {
LastModified string
- Templates []dto.RemoteTemplate
+ Templates []tmpl.RemoteTemplate
}
type TemplateService struct {
@@ -145,49 +147,49 @@ func (s *TemplateService) GetAllTemplates(ctx context.Context) ([]models.Compose
return s.getMergedTemplates(ctx)
}
-func (s *TemplateService) GetAllTemplatesPaginated(ctx context.Context, params pagination.QueryParams) ([]dto.ComposeTemplateDto, pagination.Response, error) {
+func (s *TemplateService) GetAllTemplatesPaginated(ctx context.Context, params pagination.QueryParams) ([]tmpl.Template, pagination.Response, error) {
templates, err := s.getMergedTemplates(ctx)
if err != nil {
return nil, pagination.Response{}, err
}
- items := make([]dto.ComposeTemplateDto, 0, len(templates))
+ items := make([]tmpl.Template, 0, len(templates))
for _, t := range templates {
- var dtoItem dto.ComposeTemplateDto
- if err := dto.MapStruct(&t, &dtoItem); err != nil {
+ var dtoItem tmpl.Template
+ if err := mapper.MapStruct(&t, &dtoItem); err != nil {
slog.WarnContext(ctx, "failed to map template to DTO", "error", err, "templateID", t.ID)
continue
}
items = append(items, dtoItem)
}
- config := pagination.Config[dto.ComposeTemplateDto]{
- SearchAccessors: []pagination.SearchAccessor[dto.ComposeTemplateDto]{
- func(t dto.ComposeTemplateDto) (string, error) { return t.Name, nil },
- func(t dto.ComposeTemplateDto) (string, error) { return t.Description, nil },
- func(t dto.ComposeTemplateDto) (string, error) {
+ config := pagination.Config[tmpl.Template]{
+ SearchAccessors: []pagination.SearchAccessor[tmpl.Template]{
+ func(t tmpl.Template) (string, error) { return t.Name, nil },
+ func(t tmpl.Template) (string, error) { return t.Description, nil },
+ func(t tmpl.Template) (string, error) {
if t.Metadata != nil && len(t.Metadata.Tags) > 0 {
return strings.Join(t.Metadata.Tags, " "), nil
}
return "", nil
},
},
- SortBindings: []pagination.SortBinding[dto.ComposeTemplateDto]{
+ SortBindings: []pagination.SortBinding[tmpl.Template]{
{
Key: "name",
- Fn: func(a, b dto.ComposeTemplateDto) int {
+ Fn: func(a, b tmpl.Template) int {
return strings.Compare(strings.ToLower(a.Name), strings.ToLower(b.Name))
},
},
{
Key: "description",
- Fn: func(a, b dto.ComposeTemplateDto) int {
+ Fn: func(a, b tmpl.Template) int {
return strings.Compare(strings.ToLower(a.Description), strings.ToLower(b.Description))
},
},
{
Key: "isRemote",
- Fn: func(a, b dto.ComposeTemplateDto) int {
+ Fn: func(a, b tmpl.Template) int {
if a.IsRemote == b.IsRemote {
return 0
}
@@ -198,10 +200,10 @@ func (s *TemplateService) GetAllTemplatesPaginated(ctx context.Context, params p
},
},
},
- FilterAccessors: []pagination.FilterAccessor[dto.ComposeTemplateDto]{
+ FilterAccessors: []pagination.FilterAccessor[tmpl.Template]{
{
Key: "type",
- Fn: func(item dto.ComposeTemplateDto, filterValue string) bool {
+ Fn: func(item tmpl.Template, filterValue string) bool {
switch filterValue {
case "true":
return item.IsRemote
@@ -566,17 +568,17 @@ func (s *TemplateService) doGET(ctx context.Context, url string) ([]byte, error)
// fetchRegistryTemplates performs a conditional GET using If-Modified-Since.
// If the server replies 304 Not Modified, cached templates for the registry are reused.
-func (s *TemplateService) fetchRegistryTemplates(ctx context.Context, reg *models.TemplateRegistry) ([]dto.RemoteTemplate, error) {
+func (s *TemplateService) fetchRegistryTemplates(ctx context.Context, reg *models.TemplateRegistry) ([]tmpl.RemoteTemplate, error) {
s.registryMu.RLock()
- meta := s.registryFetchMeta[reg.ID]
+ fetchMeta := s.registryFetchMeta[reg.ID]
s.registryMu.RUnlock()
req, err := http.NewRequestWithContext(ctx, http.MethodGet, reg.URL, nil)
if err != nil {
return nil, fmt.Errorf("create request: %w", err)
}
- if meta != nil && meta.LastModified != "" {
- req.Header.Set("If-Modified-Since", meta.LastModified)
+ if fetchMeta != nil && fetchMeta.LastModified != "" {
+ req.Header.Set("If-Modified-Since", fetchMeta.LastModified)
}
resp, err := s.httpClient.Do(req)
@@ -586,8 +588,8 @@ func (s *TemplateService) fetchRegistryTemplates(ctx context.Context, reg *model
defer resp.Body.Close()
if resp.StatusCode == http.StatusNotModified {
- if meta != nil {
- return meta.Templates, nil
+ if fetchMeta != nil {
+ return fetchMeta.Templates, nil
}
return nil, fmt.Errorf("received 304 without cached data")
}
@@ -600,7 +602,7 @@ func (s *TemplateService) fetchRegistryTemplates(ctx context.Context, reg *model
return nil, fmt.Errorf("read body: %w", err)
}
- var regDTO dto.RemoteRegistry
+ var regDTO tmpl.RemoteRegistry
if err := json.Unmarshal(body, &regDTO); err != nil {
return nil, fmt.Errorf("parse registry JSON: %w", err)
}
@@ -617,12 +619,12 @@ func (s *TemplateService) fetchRegistryTemplates(ctx context.Context, reg *model
return regDTO.Templates, nil
}
-func (s *TemplateService) fetchRegistryManifest(ctx context.Context, url string) (*dto.RemoteRegistry, error) {
+func (s *TemplateService) fetchRegistryManifest(ctx context.Context, url string) (*tmpl.RemoteRegistry, error) {
body, err := s.doGET(ctx, url)
if err != nil {
return nil, err
}
- var reg dto.RemoteRegistry
+ var reg tmpl.RemoteRegistry
if err := json.Unmarshal(body, &reg); err != nil {
return nil, fmt.Errorf("failed to parse registry JSON: %w", err)
}
@@ -632,7 +634,7 @@ func (s *TemplateService) fetchRegistryManifest(ctx context.Context, url string)
return &reg, nil
}
-func (s *TemplateService) convertRemoteToLocal(remote dto.RemoteTemplate, registry *models.TemplateRegistry) models.ComposeTemplate {
+func (s *TemplateService) convertRemoteToLocal(remote tmpl.RemoteTemplate, registry *models.TemplateRegistry) models.ComposeTemplate {
publicID := makeRemoteID(registry.ID, remote.ID)
return models.ComposeTemplate{
@@ -907,7 +909,7 @@ func (s *TemplateService) getGlobalVariablesPath(ctx context.Context) (string, e
return filepath.Join(projectsDirectory, ".env.global"), nil
}
-func (s *TemplateService) GetGlobalVariables(ctx context.Context) ([]dto.VariableDto, error) {
+func (s *TemplateService) GetGlobalVariables(ctx context.Context) ([]env.Variable, error) {
envPath, err := s.getGlobalVariablesPath(ctx)
if err != nil {
return nil, err
@@ -915,7 +917,7 @@ func (s *TemplateService) GetGlobalVariables(ctx context.Context) ([]dto.Variabl
if _, err := os.Stat(envPath); os.IsNotExist(err) {
slog.DebugContext(ctx, "Global variables file does not exist yet", "path", envPath)
- return []dto.VariableDto{}, nil
+ return []env.Variable{}, nil
}
file, err := os.Open(envPath)
@@ -924,7 +926,7 @@ func (s *TemplateService) GetGlobalVariables(ctx context.Context) ([]dto.Variabl
}
defer file.Close()
- vars := []dto.VariableDto{}
+ vars := []env.Variable{}
scanner := bufio.NewScanner(file)
lineNum := 0
@@ -954,7 +956,7 @@ func (s *TemplateService) GetGlobalVariables(ctx context.Context) ([]dto.Variabl
}
}
- vars = append(vars, dto.VariableDto{
+ vars = append(vars, env.Variable{
Key: key,
Value: value,
})
@@ -967,7 +969,7 @@ func (s *TemplateService) GetGlobalVariables(ctx context.Context) ([]dto.Variabl
return vars, nil
}
-func (s *TemplateService) UpdateGlobalVariables(ctx context.Context, vars []dto.VariableDto) error {
+func (s *TemplateService) UpdateGlobalVariables(ctx context.Context, vars []env.Variable) error {
envPath, err := s.getGlobalVariablesPath(ctx)
if err != nil {
return err
@@ -1055,27 +1057,27 @@ func (s *TemplateService) ParseComposeServices(ctx context.Context, composeConte
}
// GetTemplateContentWithParsedData returns template content along with parsed metadata
-func (s *TemplateService) GetTemplateContentWithParsedData(ctx context.Context, id string) (*dto.ComposeTemplateContentDto, error) {
- tmpl, err := s.GetTemplate(ctx, id)
+func (s *TemplateService) GetTemplateContentWithParsedData(ctx context.Context, id string) (*tmpl.TemplateContent, error) {
+ composeTemplate, err := s.GetTemplate(ctx, id)
if err != nil {
return nil, err
}
- var outTemplate dto.ComposeTemplateDto
- if mapErr := dto.MapStruct(tmpl, &outTemplate); mapErr != nil {
+ var outTemplate tmpl.Template
+ if mapErr := mapper.MapStruct(composeTemplate, &outTemplate); mapErr != nil {
return nil, fmt.Errorf("failed to map template: %w", mapErr)
}
var composeContent, envContent string
- if tmpl.IsRemote {
- composeContent, envContent, err = s.FetchTemplateContent(ctx, tmpl)
+ if composeTemplate.IsRemote {
+ composeContent, envContent, err = s.FetchTemplateContent(ctx, composeTemplate)
if err != nil {
return nil, fmt.Errorf("failed to fetch template content: %w", err)
}
} else {
- composeContent = tmpl.Content
- if tmpl.EnvContent != nil {
- envContent = *tmpl.EnvContent
+ composeContent = composeTemplate.Content
+ if composeTemplate.EnvContent != nil {
+ envContent = *composeTemplate.EnvContent
}
}
@@ -1083,9 +1085,13 @@ func (s *TemplateService) GetTemplateContentWithParsedData(ctx context.Context,
services := s.ParseComposeServices(ctx, composeContent)
// Parse environment variables
- envVars := template.ParseEnvContent(envContent)
+ parsedEnvVars := templateutil.ParseEnvContent(envContent)
+ envVars := make([]env.Variable, len(parsedEnvVars))
+ for i, v := range parsedEnvVars {
+ envVars[i] = env.Variable{Key: v.Key, Value: v.Value}
+ }
- return &dto.ComposeTemplateContentDto{
+ return &tmpl.TemplateContent{
Template: outTemplate,
Content: composeContent,
EnvContent: envContent,
diff --git a/backend/internal/services/updater_service.go b/backend/internal/services/updater_service.go
index 138130acf..6ae7a7f44 100644
--- a/backend/internal/services/updater_service.go
+++ b/backend/internal/services/updater_service.go
@@ -16,7 +16,7 @@ import (
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
+ "go.getarcane.app/types/updater"
)
type UpdaterService struct {
@@ -61,9 +61,9 @@ func NewUpdaterService(
}
//nolint:gocognit
-func (s *UpdaterService) ApplyPending(ctx context.Context, dryRun bool) (*dto.UpdaterRunResult, error) {
+func (s *UpdaterService) ApplyPending(ctx context.Context, dryRun bool) (*updater.Result, error) {
start := time.Now()
- out := &dto.UpdaterRunResult{Items: []dto.UpdaterItem{}}
+ out := &updater.Result{Items: []updater.ResourceResult{}}
var records []models.ImageUpdateRecord
if err := s.db.WithContext(ctx).Where("has_update = ?", true).Find(&records).Error; err != nil {
@@ -149,7 +149,7 @@ func (s *UpdaterService) ApplyPending(ctx context.Context, dryRun bool) (*dto.Up
newImageIDs := map[string][]string{} // newRef -> []imageIDs after pull
for _, p := range plans {
- item := dto.UpdaterItem{
+ item := updater.ResourceResult{
ResourceID: p.oldRef,
ResourceType: "image",
ResourceName: p.oldRef,
@@ -211,7 +211,7 @@ func (s *UpdaterService) ApplyPending(ctx context.Context, dryRun bool) (*dto.Up
slog.Warn("container restarts had errors", "err", err)
}
for _, r := range results {
- item := dto.UpdaterItem{
+ item := updater.ResourceResult{
ResourceID: r.ResourceID,
ResourceType: "container",
ResourceName: r.ResourceName,
@@ -636,7 +636,7 @@ func (s *UpdaterService) getContainerName(cnt container.Summary) string {
return cnt.ID[:12]
}
-func (s *UpdaterService) recordRun(ctx context.Context, item dto.UpdaterItem) error {
+func (s *UpdaterService) recordRun(ctx context.Context, item updater.ResourceResult) error {
rec := &models.AutoUpdateRecord{
ResourceID: item.ResourceID,
ResourceType: item.ResourceType,
@@ -690,7 +690,7 @@ func (s *UpdaterService) resolveLocalImageIDsForRef(ctx context.Context, ref str
return ids, nil
}
-func (s *UpdaterService) restartContainersUsingOldIDs(ctx context.Context, oldIDToNewRef map[string]string, oldRefToNewRef map[string]string) ([]dto.AutoUpdateResourceResult, error) {
+func (s *UpdaterService) restartContainersUsingOldIDs(ctx context.Context, oldIDToNewRef map[string]string, oldRefToNewRef map[string]string) ([]updater.ResourceResult, error) {
dcli, err := s.dockerService.GetClient()
if err != nil {
return nil, fmt.Errorf("docker connect: %w", err)
@@ -702,7 +702,7 @@ func (s *UpdaterService) restartContainersUsingOldIDs(ctx context.Context, oldID
}
slog.DebugContext(ctx, "restartContainersUsingOldIDs: scanning containers for matching images", "containers", len(list), "oldIDMatches", len(oldIDToNewRef), "oldRefMatches", len(oldRefToNewRef))
- var results []dto.AutoUpdateResourceResult
+ var results []updater.ResourceResult
for _, c := range list {
// Skip containers with opt-out label
if s.isUpdateDisabled(c.Labels) {
@@ -748,7 +748,7 @@ func (s *UpdaterService) restartContainersUsingOldIDs(ctx context.Context, oldID
slog.DebugContext(ctx, "restartContainersUsingOldIDs: matched container for update", "containerId", c.ID, "match", match, "newRef", newRef)
name := s.getContainerName(c)
- res := dto.AutoUpdateResourceResult{
+ res := updater.ResourceResult{
ResourceID: c.ID,
ResourceName: name,
ResourceType: "container",
diff --git a/backend/internal/services/user_service.go b/backend/internal/services/user_service.go
index d246367d9..2cfd3805e 100644
--- a/backend/internal/services/user_service.go
+++ b/backend/internal/services/user_service.go
@@ -17,9 +17,9 @@ import (
"crypto/subtle"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
+ "go.getarcane.app/types/user"
)
type Argon2Params struct {
@@ -269,7 +269,7 @@ func (s *UserService) CreateDefaultAdmin(ctx context.Context) error {
email := "admin@localhost"
displayName := "Arcane Admin"
- user := &models.User{
+ userModel := &models.User{
Username: "arcane",
Email: &email,
DisplayName: &displayName,
@@ -278,7 +278,7 @@ func (s *UserService) CreateDefaultAdmin(ctx context.Context) error {
RequiresPasswordChange: true,
}
- if err := tx.Create(user).Error; err != nil {
+ if err := tx.Create(userModel).Error; err != nil {
return fmt.Errorf("failed to create default admin user: %w", err)
}
@@ -324,7 +324,7 @@ func (s *UserService) UpgradePasswordHash(ctx context.Context, userID, password
})
}
-func (s *UserService) ListUsersPaginated(ctx context.Context, params pagination.QueryParams) ([]dto.UserResponseDto, pagination.Response, error) {
+func (s *UserService) ListUsersPaginated(ctx context.Context, params pagination.QueryParams) ([]user.Response, pagination.Response, error) {
var users []models.User
query := s.db.WithContext(ctx).Model(&models.User{})
@@ -341,25 +341,25 @@ func (s *UserService) ListUsersPaginated(ctx context.Context, params pagination.
return nil, pagination.Response{}, fmt.Errorf("failed to paginate users: %w", err)
}
- result := make([]dto.UserResponseDto, len(users))
- for i, user := range users {
- result[i] = toUserResponseDto(user)
+ result := make([]user.Response, len(users))
+ for i, u := range users {
+ result[i] = toUserResponseDto(u)
}
return result, paginationResp, nil
}
-func toUserResponseDto(user models.User) dto.UserResponseDto {
- return dto.UserResponseDto{
- ID: user.ID,
- Username: user.Username,
- DisplayName: user.DisplayName,
- Email: user.Email,
- Roles: user.Roles,
- OidcSubjectId: user.OidcSubjectId,
- Locale: user.Locale,
- CreatedAt: user.CreatedAt.Format("2006-01-02T15:04:05.999999Z"),
- UpdatedAt: user.UpdatedAt.Format("2006-01-02T15:04:05.999999Z"),
+func toUserResponseDto(u models.User) user.Response {
+ return user.Response{
+ ID: u.ID,
+ Username: u.Username,
+ DisplayName: u.DisplayName,
+ Email: u.Email,
+ Roles: u.Roles,
+ OidcSubjectId: u.OidcSubjectId,
+ Locale: u.Locale,
+ CreatedAt: u.CreatedAt.Format("2006-01-02T15:04:05.999999Z"),
+ UpdatedAt: u.UpdatedAt.Format("2006-01-02T15:04:05.999999Z"),
}
}
diff --git a/backend/internal/services/version_service.go b/backend/internal/services/version_service.go
index d0f2235b2..0326b7433 100644
--- a/backend/internal/services/version_service.go
+++ b/backend/internal/services/version_service.go
@@ -11,8 +11,8 @@ import (
"strings"
"time"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/utils/cache"
+ "go.getarcane.app/types/version"
ref "go.podman.io/image/v5/docker/reference"
)
@@ -204,10 +204,10 @@ func (s *VersionService) getDisplayVersion() string {
}
// GetAppVersionInfo returns application version information including display version
-func (s *VersionService) GetAppVersionInfo(ctx context.Context) *dto.VersionInfoDto {
- version := strings.TrimSpace(s.version)
- if s.isSemverVersion() && !strings.HasPrefix(version, "v") {
- version = "v" + version
+func (s *VersionService) GetAppVersionInfo(ctx context.Context) *version.Info {
+ ver := strings.TrimSpace(s.version)
+ if s.isSemverVersion() && !strings.HasPrefix(ver, "v") {
+ ver = "v" + ver
}
displayVersion := s.getDisplayVersion()
isSemver := s.isSemverVersion()
@@ -216,8 +216,8 @@ func (s *VersionService) GetAppVersionInfo(ctx context.Context) *dto.VersionInfo
currentTag, currentDigest, currentImageRef := s.detectCurrentImageInfo(ctx)
if s.disabled {
- return &dto.VersionInfoDto{
- CurrentVersion: version,
+ return &version.Info{
+ CurrentVersion: ver,
CurrentTag: currentTag,
CurrentDigest: currentDigest,
DisplayVersion: displayVersion,
@@ -233,8 +233,8 @@ func (s *VersionService) GetAppVersionInfo(ctx context.Context) *dto.VersionInfo
if err != nil {
var staleErr *cache.ErrStale
if !errors.As(err, &staleErr) {
- return &dto.VersionInfoDto{
- CurrentVersion: version,
+ return &version.Info{
+ CurrentVersion: ver,
CurrentTag: currentTag,
CurrentDigest: currentDigest,
DisplayVersion: displayVersion,
@@ -245,15 +245,15 @@ func (s *VersionService) GetAppVersionInfo(ctx context.Context) *dto.VersionInfo
slog.Warn("Failed to refresh latest version; using stale cache", "error", staleErr.Err)
}
- return &dto.VersionInfoDto{
- CurrentVersion: version,
+ return &version.Info{
+ CurrentVersion: ver,
CurrentTag: currentTag,
CurrentDigest: currentDigest,
DisplayVersion: displayVersion,
Revision: s.revision,
IsSemverVersion: isSemver,
NewestVersion: latest,
- UpdateAvailable: s.IsNewer(latest, version),
+ UpdateAvailable: s.IsNewer(latest, ver),
ReleaseURL: s.ReleaseURL(latest),
}
}
@@ -261,8 +261,8 @@ func (s *VersionService) GetAppVersionInfo(ctx context.Context) *dto.VersionInfo
// For non-semver versions (like "next"), check digest-based updates
if currentTag != "" && s.containerRegistryService != nil {
updateAvailable, latestDigest := s.checkDigestBasedUpdate(ctx, currentTag, currentDigest, currentImageRef)
- return &dto.VersionInfoDto{
- CurrentVersion: version,
+ return &version.Info{
+ CurrentVersion: ver,
CurrentTag: currentTag,
CurrentDigest: currentDigest,
DisplayVersion: displayVersion,
@@ -273,8 +273,8 @@ func (s *VersionService) GetAppVersionInfo(ctx context.Context) *dto.VersionInfo
}
}
- return &dto.VersionInfoDto{
- CurrentVersion: version,
+ return &version.Info{
+ CurrentVersion: ver,
CurrentTag: currentTag,
CurrentDigest: currentDigest,
DisplayVersion: displayVersion,
diff --git a/backend/internal/services/volume_service.go b/backend/internal/services/volume_service.go
index 11d629ea0..8bb36a868 100644
--- a/backend/internal/services/volume_service.go
+++ b/backend/internal/services/volume_service.go
@@ -12,10 +12,10 @@ import (
"github.com/docker/docker/api/types/volume"
"github.com/docker/docker/client"
"github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/utils/docker"
"github.com/getarcaneapp/arcane/backend/internal/utils/pagination"
+ volumetypes "go.getarcane.app/types/volume"
)
type VolumeService struct {
@@ -32,7 +32,7 @@ func NewVolumeService(db *database.DB, dockerService *DockerClientService, event
}
}
-func (s *VolumeService) GetVolumeByName(ctx context.Context, name string) (*dto.VolumeDto, error) {
+func (s *VolumeService) GetVolumeByName(ctx context.Context, name string) (*volumetypes.Volume, error) {
dockerClient, err := s.dockerService.GetClient()
if err != nil {
return nil, fmt.Errorf("failed to connect to Docker: %w", err)
@@ -60,7 +60,7 @@ func (s *VolumeService) GetVolumeByName(ctx context.Context, name string) (*dto.
slog.String("error", duErr.Error()))
}
- v := dto.NewVolumeDto(vol)
+ v := volumetypes.NewSummary(vol)
containerIDs, err := docker.GetContainersUsingVolume(ctx, dockerClient, name)
if err != nil {
@@ -77,7 +77,7 @@ func (s *VolumeService) GetVolumeByName(ctx context.Context, name string) (*dto.
return &v, nil
}
-func (s *VolumeService) CreateVolume(ctx context.Context, options volume.CreateOptions, user models.User) (*dto.VolumeDto, error) {
+func (s *VolumeService) CreateVolume(ctx context.Context, options volume.CreateOptions, user models.User) (*volumetypes.Volume, error) {
dockerClient, err := s.dockerService.GetClient()
if err != nil {
s.eventService.LogErrorEvent(ctx, models.EventTypeVolumeError, "volume", "", options.Name, user.ID, user.Username, "0", err, models.JSON{"action": "create", "driver": options.Driver})
@@ -109,7 +109,7 @@ func (s *VolumeService) CreateVolume(ctx context.Context, options volume.CreateO
docker.InvalidateVolumeUsageCache()
- dtoVol := dto.NewVolumeDto(vol)
+ dtoVol := volumetypes.NewSummary(vol)
return &dtoVol, nil
}
@@ -138,11 +138,11 @@ func (s *VolumeService) DeleteVolume(ctx context.Context, name string, force boo
return nil
}
-func (s *VolumeService) PruneVolumes(ctx context.Context) (*dto.VolumePruneReportDto, error) {
+func (s *VolumeService) PruneVolumes(ctx context.Context) (*volumetypes.PruneReport, error) {
return s.PruneVolumesWithOptions(ctx, false)
}
-func (s *VolumeService) PruneVolumesWithOptions(ctx context.Context, all bool) (*dto.VolumePruneReportDto, error) {
+func (s *VolumeService) PruneVolumesWithOptions(ctx context.Context, all bool) (*volumetypes.PruneReport, error) {
dockerClient, err := s.dockerService.GetClient()
if err != nil {
return nil, fmt.Errorf("failed to connect to Docker: %w", err)
@@ -180,7 +180,7 @@ func (s *VolumeService) PruneVolumesWithOptions(ctx context.Context, all bool) (
docker.InvalidateVolumeUsageCache()
- return &dto.VolumePruneReportDto{
+ return &volumetypes.PruneReport{
VolumesDeleted: report.VolumesDeleted,
SpaceReclaimed: report.SpaceReclaimed,
}, nil
@@ -241,44 +241,44 @@ func (s *VolumeService) buildVolumeContainerMap(ctx context.Context, dockerClien
return volumeContainerMap, nil
}
-func (s *VolumeService) buildVolumePaginationConfig() pagination.Config[dto.VolumeDto] {
- return pagination.Config[dto.VolumeDto]{
- SearchAccessors: []pagination.SearchAccessor[dto.VolumeDto]{
- func(v dto.VolumeDto) (string, error) { return v.Name, nil },
- func(v dto.VolumeDto) (string, error) { return v.Driver, nil },
- func(v dto.VolumeDto) (string, error) { return v.Mountpoint, nil },
- func(v dto.VolumeDto) (string, error) { return v.Scope, nil },
+func (s *VolumeService) buildVolumePaginationConfig() pagination.Config[volumetypes.Volume] {
+ return pagination.Config[volumetypes.Volume]{
+ SearchAccessors: []pagination.SearchAccessor[volumetypes.Volume]{
+ func(v volumetypes.Volume) (string, error) { return v.Name, nil },
+ func(v volumetypes.Volume) (string, error) { return v.Driver, nil },
+ func(v volumetypes.Volume) (string, error) { return v.Mountpoint, nil },
+ func(v volumetypes.Volume) (string, error) { return v.Scope, nil },
},
SortBindings: s.buildVolumeSortBindings(),
FilterAccessors: s.buildVolumeFilterAccessors(),
}
}
-func (s *VolumeService) buildVolumeSortBindings() []pagination.SortBinding[dto.VolumeDto] {
- return []pagination.SortBinding[dto.VolumeDto]{
+func (s *VolumeService) buildVolumeSortBindings() []pagination.SortBinding[volumetypes.Volume] {
+ return []pagination.SortBinding[volumetypes.Volume]{
{
Key: "name",
- Fn: func(a, b dto.VolumeDto) int { return strings.Compare(a.Name, b.Name) },
+ Fn: func(a, b volumetypes.Volume) int { return strings.Compare(a.Name, b.Name) },
},
{
Key: "driver",
- Fn: func(a, b dto.VolumeDto) int { return strings.Compare(a.Driver, b.Driver) },
+ Fn: func(a, b volumetypes.Volume) int { return strings.Compare(a.Driver, b.Driver) },
},
{
Key: "mountpoint",
- Fn: func(a, b dto.VolumeDto) int { return strings.Compare(a.Mountpoint, b.Mountpoint) },
+ Fn: func(a, b volumetypes.Volume) int { return strings.Compare(a.Mountpoint, b.Mountpoint) },
},
{
Key: "scope",
- Fn: func(a, b dto.VolumeDto) int { return strings.Compare(a.Scope, b.Scope) },
+ Fn: func(a, b volumetypes.Volume) int { return strings.Compare(a.Scope, b.Scope) },
},
{
Key: "created",
- Fn: func(a, b dto.VolumeDto) int { return strings.Compare(a.CreatedAt, b.CreatedAt) },
+ Fn: func(a, b volumetypes.Volume) int { return strings.Compare(a.CreatedAt, b.CreatedAt) },
},
{
Key: "inUse",
- Fn: func(a, b dto.VolumeDto) int {
+ Fn: func(a, b volumetypes.Volume) int {
if a.InUse == b.InUse {
return 0
}
@@ -295,7 +295,7 @@ func (s *VolumeService) buildVolumeSortBindings() []pagination.SortBinding[dto.V
}
}
-func (s *VolumeService) compareVolumeSizes(a, b dto.VolumeDto) int {
+func (s *VolumeService) compareVolumeSizes(a, b volumetypes.Volume) int {
aSize := int64(-1)
bSize := int64(-1)
if a.UsageData != nil {
@@ -313,11 +313,11 @@ func (s *VolumeService) compareVolumeSizes(a, b dto.VolumeDto) int {
return 1
}
-func (s *VolumeService) buildVolumeFilterAccessors() []pagination.FilterAccessor[dto.VolumeDto] {
- return []pagination.FilterAccessor[dto.VolumeDto]{
+func (s *VolumeService) buildVolumeFilterAccessors() []pagination.FilterAccessor[volumetypes.Volume] {
+ return []pagination.FilterAccessor[volumetypes.Volume]{
{
Key: "inUse",
- Fn: func(v dto.VolumeDto, filterValue string) bool {
+ Fn: func(v volumetypes.Volume, filterValue string) bool {
if filterValue == "true" {
return v.InUse
}
@@ -330,8 +330,8 @@ func (s *VolumeService) buildVolumeFilterAccessors() []pagination.FilterAccessor
}
}
-func (s *VolumeService) calculateVolumeUsageCounts(items []dto.VolumeDto) dto.VolumeUsageCounts {
- counts := dto.VolumeUsageCounts{
+func (s *VolumeService) calculateVolumeUsageCounts(items []volumetypes.Volume) volumetypes.UsageCounts {
+ counts := volumetypes.UsageCounts{
Total: len(items),
}
for _, v := range items {
@@ -344,7 +344,7 @@ func (s *VolumeService) calculateVolumeUsageCounts(items []dto.VolumeDto) dto.Vo
return counts
}
-func (s *VolumeService) buildPaginationResponse(result pagination.FilterResult[dto.VolumeDto], params pagination.QueryParams) pagination.Response {
+func (s *VolumeService) buildPaginationResponse(result pagination.FilterResult[volumetypes.Volume], params pagination.QueryParams) pagination.Response {
totalPages := int64(0)
if params.Limit > 0 {
totalPages = (int64(result.TotalCount) + int64(params.Limit) - 1) / int64(params.Limit)
@@ -364,15 +364,15 @@ func (s *VolumeService) buildPaginationResponse(result pagination.FilterResult[d
}
}
-func (s *VolumeService) ListVolumesPaginated(ctx context.Context, params pagination.QueryParams) ([]dto.VolumeDto, pagination.Response, dto.VolumeUsageCounts, error) {
+func (s *VolumeService) ListVolumesPaginated(ctx context.Context, params pagination.QueryParams) ([]volumetypes.Volume, pagination.Response, volumetypes.UsageCounts, error) {
dockerClient, err := s.dockerService.GetClient()
if err != nil {
- return nil, pagination.Response{}, dto.VolumeUsageCounts{}, fmt.Errorf("failed to connect to Docker: %w", err)
+ return nil, pagination.Response{}, volumetypes.UsageCounts{}, fmt.Errorf("failed to connect to Docker: %w", err)
}
volListBody, err := dockerClient.VolumeList(ctx, volume.ListOptions{})
if err != nil {
- return nil, pagination.Response{}, dto.VolumeUsageCounts{}, fmt.Errorf("failed to list Docker volumes: %w", err)
+ return nil, pagination.Response{}, volumetypes.UsageCounts{}, fmt.Errorf("failed to list Docker volumes: %w", err)
}
usageVolumes, duErr := docker.GetVolumeUsageData(ctx, dockerClient)
@@ -391,9 +391,9 @@ func (s *VolumeService) ListVolumesPaginated(ctx context.Context, params paginat
volumeContainerMap = make(map[string][]string)
}
- items := make([]dto.VolumeDto, 0, len(volumes))
+ items := make([]volumetypes.Volume, 0, len(volumes))
for _, v := range volumes {
- volDto := dto.NewVolumeDto(v)
+ volDto := volumetypes.NewSummary(v)
if containerIDs, ok := volumeContainerMap[v.Name]; ok {
volDto.Containers = containerIDs
if len(containerIDs) > 0 {
diff --git a/backend/internal/dto/dto_map.go b/backend/internal/utils/mapper/mapper.go
similarity index 98%
rename from backend/internal/dto/dto_map.go
rename to backend/internal/utils/mapper/mapper.go
index 37b94d5e0..99cd0636c 100644
--- a/backend/internal/dto/dto_map.go
+++ b/backend/internal/utils/mapper/mapper.go
@@ -1,4 +1,4 @@
-package dto
+package mapper
import (
"fmt"
diff --git a/backend/internal/utils/template/parser.go b/backend/internal/utils/template/parser.go
index 1e0d97578..95393a223 100644
--- a/backend/internal/utils/template/parser.go
+++ b/backend/internal/utils/template/parser.go
@@ -4,16 +4,16 @@ import (
"bufio"
"strings"
- "github.com/getarcaneapp/arcane/backend/internal/dto"
+ "go.getarcane.app/types/env"
)
// ParseEnvContent parses environment variables from .env file content
-func ParseEnvContent(content string) []dto.EnvVariable {
+func ParseEnvContent(content string) []env.Variable {
if content == "" {
- return []dto.EnvVariable{}
+ return []env.Variable{}
}
- var vars []dto.EnvVariable
+ var vars []env.Variable
scanner := bufio.NewScanner(strings.NewReader(content))
for scanner.Scan() {
@@ -48,7 +48,7 @@ func ParseEnvContent(content string) []dto.EnvVariable {
}
if key != "" {
- vars = append(vars, dto.EnvVariable{
+ vars = append(vars, env.Variable{
Key: key,
Value: value,
})
diff --git a/cli/README.md b/cli/README.md
new file mode 100644
index 000000000..5dd8eaf37
--- /dev/null
+++ b/cli/README.md
@@ -0,0 +1,12 @@
+<div align="center">
+
+ <img src=".github/assets/arcane-full.png" alt="Arcane Logo" width="500" />
+ <p>The Official Command Line Client</p>
+
+<a href="https://pkg.go.dev/go.getarcane.app/cli"><img src="https://pkg.go.dev/badge/go.getarcane.app/cli.svg" alt="Go Reference"></a>
+<a href="https://goreportcard.com/report/go.getarcane.app/cli"><img src="https://goreportcard.com/badge/go.getarcane.app/cli" alt="Go Report Card"></a>
+<a href="https://github.com/getarcaneapp/cli/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-BSD--3--Clause-blue.svg" alt="License"></a>
+
+<br />
+
+</div>
diff --git a/cli/cmd/main.go b/cli/cmd/main.go
new file mode 100644
index 000000000..478f6aacc
--- /dev/null
+++ b/cli/cmd/main.go
@@ -0,0 +1,7 @@
+package main
+
+import cli "go.getarcane.app/cli/pkg"
+
+func main() {
+ cli.Execute()
+}
diff --git a/cli/go.mod b/cli/go.mod
new file mode 100644
index 000000000..48a8f523d
--- /dev/null
+++ b/cli/go.mod
@@ -0,0 +1,37 @@
+module go.getarcane.app/cli
+
+go 1.25.4
+
+// TODO: Remove this replace directive after merging the types module
+replace go.getarcane.app/types => ../types
+
+require (
+ github.com/fatih/color v1.18.0
+ github.com/olekukonko/tablewriter v0.0.5
+ github.com/schollz/progressbar/v3 v3.18.0
+ github.com/sirupsen/logrus v1.9.3
+ github.com/spf13/cobra v1.10.1
+ go.getarcane.app/types v0.0.0
+ go.withmatt.com/size v0.0.0-20250220224316-11aee5773e67
+ gopkg.in/yaml.v3 v3.0.1
+)
+
+require (
+ github.com/clipperhouse/stringish v0.1.1 // indirect
+ github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
+ github.com/docker/docker v28.5.2+incompatible // indirect
+ github.com/docker/go-connections v0.6.0 // indirect
+ github.com/docker/go-units v0.5.0 // indirect
+ github.com/inconshreveable/mousetrap v1.1.0 // indirect
+ github.com/mattn/go-colorable v0.1.14 // indirect
+ github.com/mattn/go-isatty v0.0.20 // indirect
+ github.com/mattn/go-runewidth v0.0.19 // indirect
+ github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
+ github.com/moby/docker-image-spec v1.3.1 // indirect
+ github.com/opencontainers/go-digest v1.0.0 // indirect
+ github.com/opencontainers/image-spec v1.1.1 // indirect
+ github.com/rivo/uniseg v0.4.7 // indirect
+ github.com/spf13/pflag v1.0.10 // indirect
+ golang.org/x/sys v0.38.0 // indirect
+ golang.org/x/term v0.37.0 // indirect
+)
diff --git a/cli/go.sum b/cli/go.sum
new file mode 100644
index 000000000..b4a06a368
--- /dev/null
+++ b/cli/go.sum
@@ -0,0 +1,76 @@
+github.com/chengxilo/virtualterm v1.0.4 h1:Z6IpERbRVlfB8WkOmtbHiDbBANU7cimRIof7mk9/PwM=
+github.com/chengxilo/virtualterm v1.0.4/go.mod h1:DyxxBZz/x1iqJjFxTFcr6/x+jSpqN0iwWCOK1q10rlY=
+github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs=
+github.com/clipperhouse/stringish v0.1.1/go.mod h1:v/WhFtE1q0ovMta2+m+UbpZ+2/HEXNWYXQgCt4hdOzA=
+github.com/clipperhouse/uax29/v2 v2.3.0 h1:SNdx9DVUqMoBuBoW3iLOj4FQv3dN5mDtuqwuhIGpJy4=
+github.com/clipperhouse/uax29/v2 v2.3.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
+github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
+github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/docker/docker v28.5.2+incompatible h1:DBX0Y0zAjZbSrm1uzOkdr1onVghKaftjlSWt4AFexzM=
+github.com/docker/docker v28.5.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
+github.com/docker/go-connections v0.6.0 h1:LlMG9azAe1TqfR7sO+NJttz1gy6KO7VJBh+pMmjSD94=
+github.com/docker/go-connections v0.6.0/go.mod h1:AahvXYshr6JgfUJGdDCs2b5EZG/vmaMAntpSFH5BFKE=
+github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
+github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
+github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
+github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
+github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
+github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
+github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
+github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
+github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
+github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
+github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
+github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
+github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
+github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
+github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw=
+github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
+github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
+github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
+github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
+github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
+github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
+github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
+github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
+github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
+github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
+github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
+github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
+github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
+github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/schollz/progressbar/v3 v3.18.0 h1:uXdoHABRFmNIjUfte/Ex7WtuyVslrw2wVPQmCN62HpA=
+github.com/schollz/progressbar/v3 v3.18.0/go.mod h1:IsO3lpbaGuzh8zIMzgY3+J8l4C8GjO0Y9S69eFvNsec=
+github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
+github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
+github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
+github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
+github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
+github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
+github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
+github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
+go.withmatt.com/size v0.0.0-20250220224316-11aee5773e67 h1:nHPqmzoLZv+9OqER7S2oXnIBDAbIaIKKrVtNtDvJzjc=
+go.withmatt.com/size v0.0.0-20250220224316-11aee5773e67/go.mod h1:WFmSrzphcXaSV4LG3YfIw42bPHDK8A6WsAYZCxyys/c=
+golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
+golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
+golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
+golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
+gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
diff --git a/cli/internal/client/client.go b/cli/internal/client/client.go
new file mode 100644
index 000000000..b1584cad3
--- /dev/null
+++ b/cli/internal/client/client.go
@@ -0,0 +1,299 @@
+// Package client provides an HTTP client for communicating with the Arcane API.
+//
+// The client handles authentication, request construction, and response parsing
+// for all API calls. It supports JSON request/response bodies as well as raw
+// multipart uploads.
+//
+// # Creating a Client
+//
+// The recommended way to create a client is from the CLI configuration:
+//
+// c, err := client.NewFromConfig()
+// if err != nil {
+// return err
+// }
+//
+// # Making Requests
+//
+// The client provides convenience methods for common HTTP methods:
+//
+// resp, err := c.Get(ctx, "/api/images")
+// resp, err := c.Post(ctx, "/api/images/pull", body)
+// resp, err := c.Delete(ctx, "/api/images/abc123")
+package client
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "fmt"
+ "io"
+ "net/http"
+ "net/url"
+ "time"
+
+ "go.getarcane.app/cli/internal/config"
+ "go.getarcane.app/cli/internal/types"
+)
+
+const (
+ headerAPIToken = "X-API-TOKEN" //nolint:gosec
+ defaultTimeout = 30 * time.Second
+ defaultEnvID = "0"
+)
+
+// Client is an HTTP client for the Arcane API.
+// It handles authentication via API tokens and provides methods for making
+// HTTP requests to various API endpoints. The client automatically includes
+// authentication headers and handles JSON serialization.
+type Client struct {
+ baseURL string
+ apiKey string
+ envID string
+ httpClient *http.Client
+}
+
+// New creates a new API client from the provided configuration.
+// It validates the configuration and returns an error if required fields
+// (ServerURL, APIKey) are missing. The client is initialized with a default
+// 30-second timeout and the configured environment ID.
+func New(cfg *types.Config) (*Client, error) {
+ if err := cfg.Validate(); err != nil {
+ return nil, err
+ }
+
+ envID := cfg.DefaultEnvironment
+ if envID == "" {
+ envID = defaultEnvID
+ }
+
+ return &Client{
+ baseURL: cfg.ServerURL,
+ apiKey: cfg.APIKey,
+ envID: envID,
+ httpClient: &http.Client{
+ Timeout: defaultTimeout,
+ },
+ }, nil
+}
+
+// NewFromConfig loads the CLI configuration from disk and creates a new client.
+// This is the recommended way to create a client in CLI commands.
+// It returns an error if the configuration cannot be loaded or is invalid.
+func NewFromConfig() (*Client, error) {
+ cfg, err := config.Load()
+ if err != nil {
+ return nil, fmt.Errorf("failed to load config: %w", err)
+ }
+ return New(cfg)
+}
+
+// SetEnvironment changes the environment ID for subsequent requests.
+// This allows switching between different Arcane environments without
+// creating a new client instance.
+func (c *Client) SetEnvironment(envID string) {
+ c.envID = envID
+}
+
+// EnvID returns the current environment ID configured for this client.
+// The environment ID is used to scope API requests to a specific environment.
+func (c *Client) EnvID() string {
+ return c.envID
+}
+
+// APIResponse wraps the standard Arcane API response format.
+// All API responses include a Success field indicating whether the request
+// succeeded, a Data field containing the response payload, and an optional
+// Error field with error details on failure.
+type APIResponse[T any] struct {
+ Success bool `json:"success"`
+ Data T `json:"data"`
+ Error string `json:"error,omitempty"`
+}
+
+// PaginatedResponse wraps paginated API responses.
+// It includes the list of items for the current page along with pagination
+// metadata including current page, page size, total items, and total pages.
+type PaginatedResponse[T any] struct {
+ Items []T `json:"items"`
+ Pagination struct {
+ CurrentPage int `json:"currentPage"`
+ PageSize int `json:"pageSize"`
+ TotalItems int64 `json:"totalItems"`
+ TotalPages int `json:"totalPages"`
+ } `json:"pagination"`
+}
+
+// Request makes an HTTP request to the API with JSON body serialization.
+// It constructs the full URL from the base URL and path, serializes the body
+// as JSON (if provided), and includes authentication headers. The caller is
+// responsible for closing the response body.
+func (c *Client) Request(ctx context.Context, method, path string, body any) (*http.Response, error) {
+ u, err := url.Parse(c.baseURL)
+ if err != nil {
+ return nil, fmt.Errorf("invalid base URL: %w", err)
+ }
+
+ rel, err := url.Parse(path)
+ if err != nil {
+ return nil, fmt.Errorf("invalid path: %w", err)
+ }
+
+ fullURL := u.ResolveReference(rel).String()
+
+ var bodyReader io.Reader
+ if body != nil {
+ jsonBody, err := json.Marshal(body)
+ if err != nil {
+ return nil, fmt.Errorf("failed to marshal request body: %w", err)
+ }
+ bodyReader = bytes.NewReader(jsonBody)
+ }
+
+ req, err := http.NewRequestWithContext(ctx, method, fullURL, bodyReader)
+ if err != nil {
+ return nil, fmt.Errorf("failed to create request: %w", err)
+ }
+
+ req.Header.Set(headerAPIToken, c.apiKey)
+ req.Header.Set("Content-Type", "application/json")
+ req.Header.Set("Accept", "application/json")
+
+ resp, err := c.httpClient.Do(req)
+ if err != nil {
+ return nil, fmt.Errorf("request failed: %w", err)
+ }
+
+ return resp, nil
+}
+
+// RequestRaw makes an HTTP request with a raw body and custom headers.
+// Unlike Request, this method does not serialize the body as JSON, making it
+// suitable for multipart form uploads and other non-JSON content types.
+// Custom headers can be provided to set Content-Type and other headers.
+func (c *Client) RequestRaw(ctx context.Context, method, path string, body io.Reader, headers map[string]string) (*http.Response, error) {
+ u, err := url.Parse(c.baseURL)
+ if err != nil {
+ return nil, fmt.Errorf("invalid base URL: %w", err)
+ }
+
+ rel, err := url.Parse(path)
+ if err != nil {
+ return nil, fmt.Errorf("invalid path: %w", err)
+ }
+
+ fullURL := u.ResolveReference(rel).String()
+
+ req, err := http.NewRequestWithContext(ctx, method, fullURL, body)
+ if err != nil {
+ return nil, fmt.Errorf("failed to create request: %w", err)
+ }
+
+ req.Header.Set(headerAPIToken, c.apiKey)
+ req.Header.Set("Accept", "application/json")
+
+ for k, v := range headers {
+ req.Header.Set(k, v)
+ }
+
+ resp, err := c.httpClient.Do(req)
+ if err != nil {
+ return nil, fmt.Errorf("request failed: %w", err)
+ }
+
+ return resp, nil
+}
+
+// Get makes a GET request to the specified path.
+// It is a convenience wrapper around Request for retrieving resources.
+func (c *Client) Get(ctx context.Context, path string) (*http.Response, error) {
+ return c.Request(ctx, http.MethodGet, path, nil)
+}
+
+// Post makes a POST request to the specified path with a JSON body.
+// It is a convenience wrapper around Request for creating resources.
+func (c *Client) Post(ctx context.Context, path string, body any) (*http.Response, error) {
+ return c.Request(ctx, http.MethodPost, path, body)
+}
+
+// Put makes a PUT request to the specified path with a JSON body.
+// It is a convenience wrapper around Request for updating resources.
+func (c *Client) Put(ctx context.Context, path string, body any) (*http.Response, error) {
+ return c.Request(ctx, http.MethodPut, path, body)
+}
+
+// Delete makes a DELETE request to the specified path.
+// It is a convenience wrapper around Request for removing resources.
+func (c *Client) Delete(ctx context.Context, path string) (*http.Response, error) {
+ return c.Request(ctx, http.MethodDelete, path, nil)
+}
+
+// EnvPath returns a path prefixed with the environment.
+// It constructs an environment-scoped API path in the format:
+// /api/environments/{envID}{path}
+func (c *Client) EnvPath(path string) string {
+ return fmt.Sprintf("/api/environments/%s%s", c.envID, path)
+}
+
+// DecodeResponse decodes an API response into the given type.
+// It reads the response body, unmarshals it as JSON, and returns the typed
+// result. If the response indicates failure (Success=false) with a 4xx/5xx
+// status code, an error is returned with the error message from the API.
+// Note: This function closes the response body.
+func DecodeResponse[T any](resp *http.Response) (*APIResponse[T], error) {
+ defer func() { _ = resp.Body.Close() }()
+
+ body, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return nil, fmt.Errorf("failed to read response body: %w", err)
+ }
+
+ var result APIResponse[T]
+ if err := json.Unmarshal(body, &result); err != nil {
+ return nil, fmt.Errorf("failed to decode response: %w (body: %s)", err, string(body))
+ }
+
+ if !result.Success && resp.StatusCode >= 400 {
+ return &result, fmt.Errorf("API error: %s", result.Error)
+ }
+
+ return &result, nil
+}
+
+// DecodePaginatedResponse decodes a paginated API response.
+// It reads the response body and unmarshals it into a PaginatedResponse
+// containing the items array and pagination metadata.
+// Note: This function closes the response body.
+func DecodePaginatedResponse[T any](resp *http.Response) (*PaginatedResponse[T], error) {
+ defer func() { _ = resp.Body.Close() }()
+
+ body, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return nil, fmt.Errorf("failed to read response body: %w", err)
+ }
+
+ var result PaginatedResponse[T]
+ if err := json.Unmarshal(body, &result); err != nil {
+ return nil, fmt.Errorf("failed to decode response: %w (body: %s)", err, string(body))
+ }
+
+ return &result, nil
+}
+
+// TestConnection tests the API connection by making a request to the version endpoint.
+// It returns nil if the connection is successful, or an error describing the failure.
+// This is useful for verifying configuration before making other API calls.
+func (c *Client) TestConnection(ctx context.Context) error {
+ resp, err := c.Get(ctx, "/api/version")
+ if err != nil {
+ return err
+ }
+ defer func() { _ = resp.Body.Close() }()
+
+ if resp.StatusCode != http.StatusOK {
+ body, _ := io.ReadAll(resp.Body)
+ return fmt.Errorf("connection test failed with status %d: %s", resp.StatusCode, string(body))
+ }
+
+ return nil
+}
diff --git a/cli/internal/config/config.go b/cli/internal/config/config.go
new file mode 100644
index 000000000..8450accf5
--- /dev/null
+++ b/cli/internal/config/config.go
@@ -0,0 +1,117 @@
+// Package config handles CLI configuration loading and persistence.
+//
+// Configuration is stored in a YAML file at ~/.config/arcanecli.yml.
+// This package provides functions to load, save, and access configuration
+// values including the server URL, API key, and default environment.
+//
+// # Configuration File
+//
+// The configuration file uses the following format:
+//
+// server_url: https://your-server.com
+// api_key: your-api-key
+// default_environment: "0"
+// log_level: info
+//
+// # Version Information
+//
+// Version and Revision variables are set at build time via ldflags:
+//
+// go build -ldflags "-X go.getarcane.app/cli/internal/config.Version=1.0.0"
+package config
+
+import (
+ "fmt"
+ "os"
+ "path/filepath"
+
+ "go.getarcane.app/cli/internal/types"
+ "gopkg.in/yaml.v3"
+)
+
+// Version and build information - set via ldflags at build time
+var (
+ Version = "dev"
+ Revision = "unknown"
+)
+
+const (
+ configFileName = "arcanecli.yml"
+)
+
+// DefaultConfig returns a Config with sensible default values.
+// The defaults are:
+// - ServerURL: http://localhost:3552
+// - DefaultEnvironment: "0"
+// - LogLevel: "info"
+func DefaultConfig() *types.Config {
+ return &types.Config{
+ ServerURL: "http://localhost:3552",
+ DefaultEnvironment: "0",
+ LogLevel: "info",
+ }
+}
+
+// ConfigPath returns the absolute path to the configuration file.
+// The config file is located at ~/.config/arcanecli.yml.
+// Returns an error if the user's home directory cannot be determined.
+func ConfigPath() (string, error) {
+ home, err := os.UserHomeDir()
+ if err != nil {
+ return "", fmt.Errorf("failed to get home directory: %w", err)
+ }
+
+ return filepath.Join(home, ".config", configFileName), nil
+}
+
+// Load reads the configuration from disk and returns it.
+// If the config file does not exist, default values are returned.
+// Returns an error if the file exists but cannot be read or parsed.
+func Load() (*types.Config, error) {
+ path, err := ConfigPath()
+ if err != nil {
+ return nil, err
+ }
+
+ data, err := os.ReadFile(path)
+ if err != nil {
+ if os.IsNotExist(err) {
+ return DefaultConfig(), nil
+ }
+ return nil, fmt.Errorf("failed to read config file: %w", err)
+ }
+
+ var cfg types.Config
+ if err := yaml.Unmarshal(data, &cfg); err != nil {
+ return nil, fmt.Errorf("failed to parse config file: %w", err)
+ }
+
+ return &cfg, nil
+}
+
+// Save writes the configuration to disk.
+// The config directory is created if it does not exist.
+// The file is created with 0600 permissions for security.
+func Save(c *types.Config) error {
+ path, err := ConfigPath()
+ if err != nil {
+ return err
+ }
+
+ // Ensure the config directory exists
+ dir := filepath.Dir(path)
+ if err := os.MkdirAll(dir, 0700); err != nil {
+ return fmt.Errorf("failed to create config directory: %w", err)
+ }
+
+ data, err := yaml.Marshal(c)
+ if err != nil {
+ return fmt.Errorf("failed to serialize config: %w", err)
+ }
+
+ if err := os.WriteFile(path, data, 0600); err != nil {
+ return fmt.Errorf("failed to write config file: %w", err)
+ }
+
+ return nil
+}
diff --git a/cli/internal/logger/logger.go b/cli/internal/logger/logger.go
new file mode 100644
index 000000000..4823688c1
--- /dev/null
+++ b/cli/internal/logger/logger.go
@@ -0,0 +1,59 @@
+// Package logger provides logging configuration and access for the CLI.
+//
+// This package wraps logrus to provide consistent logging across the CLI.
+// It supports configurable log levels and JSON output format for machine
+// parsing.
+//
+// # Setup
+//
+// Call Setup early in the application lifecycle:
+//
+// logger.Setup("debug", false) // debug level, text format
+// logger.Setup("info", true) // info level, JSON format
+//
+// # Usage
+//
+// log := logger.GetLogger()
+// log.Debug("detailed information")
+// log.Info("general information")
+// log.Error("error occurred")
+package logger
+
+import (
+ "os"
+
+ "github.com/sirupsen/logrus"
+)
+
+// Setup configures the global logger with the specified level and format.
+// Valid log levels are: debug, info, warn, error, fatal, panic.
+// If an invalid level is provided, it defaults to info.
+// When jsonFormat is true, logs are output as JSON for machine parsing.
+func Setup(level string, jsonFormat bool) {
+ // Set the log level
+ lvl, err := logrus.ParseLevel(level)
+ if err != nil {
+ lvl = logrus.InfoLevel
+ }
+ logrus.SetLevel(lvl)
+
+ // Set the output to stdout
+ logrus.SetOutput(os.Stdout)
+
+ // Set the formatter
+ if jsonFormat {
+ logrus.SetFormatter(&logrus.JSONFormatter{})
+ } else {
+ logrus.SetFormatter(&logrus.TextFormatter{
+ FullTimestamp: true,
+ })
+ }
+}
+
+// GetLogger returns the global logger instance.
+// The logger should be configured via Setup before use.
+// This returns the logrus standard logger which can be used for
+// Debug, Info, Warn, Error, Fatal, and Panic level logging.
+func GetLogger() *logrus.Logger {
+ return logrus.StandardLogger()
+}
diff --git a/cli/internal/output/output.go b/cli/internal/output/output.go
new file mode 100644
index 000000000..e085a4542
--- /dev/null
+++ b/cli/internal/output/output.go
@@ -0,0 +1,107 @@
+// Package output provides formatted terminal output utilities for the CLI.
+//
+// This package offers consistent styling for success messages, errors, warnings,
+// informational text, headers, key-value pairs, and tables. All output includes
+// appropriate color coding for better readability in terminal environments.
+//
+// # Example Usage
+//
+// output.Success("Operation completed")
+// output.Error("Something went wrong: %v", err)
+// output.KeyValue("Status", "Running")
+// output.Table([]string{"ID", "Name"}, rows)
+package output
+
+import (
+ "fmt"
+ "os"
+
+ "github.com/fatih/color"
+ "github.com/olekukonko/tablewriter"
+)
+
+var (
+ successColor = color.New(color.FgGreen).SprintFunc()
+ errorColor = color.New(color.FgRed).SprintFunc()
+ warnColor = color.New(color.FgYellow).SprintFunc()
+ infoColor = color.New(color.FgCyan).SprintFunc()
+ headerColor = color.New(color.FgHiWhite, color.Bold).SprintFunc()
+)
+
+// Success prints a success message in green.
+// The message is prefixed with a newline for visual separation.
+// Format specifiers and arguments work like fmt.Printf.
+func Success(format string, a ...interface{}) {
+ fmt.Printf("\n%s\n", successColor(fmt.Sprintf(format, a...)))
+}
+
+// Error prints an error message in red.
+// The message is prefixed with a newline for visual separation.
+// Format specifiers and arguments work like fmt.Printf.
+func Error(format string, a ...interface{}) {
+ fmt.Printf("\n%s\n", errorColor(fmt.Sprintf(format, a...)))
+}
+
+// Warning prints a warning message in yellow.
+// The message is prefixed with a newline for visual separation.
+// Format specifiers and arguments work like fmt.Printf.
+func Warning(format string, a ...interface{}) {
+ fmt.Printf("\n%s\n", warnColor(fmt.Sprintf(format, a...)))
+}
+
+// Info prints an info message in cyan.
+// The message is prefixed with a newline for visual separation.
+// Format specifiers and arguments work like fmt.Printf.
+func Info(format string, a ...interface{}) {
+ fmt.Printf("\n%s\n", infoColor(fmt.Sprintf(format, a...)))
+}
+
+// Header prints a header message in bold white.
+// Use this to introduce sections of output. The message is prefixed
+// with a newline for visual separation.
+func Header(format string, a ...interface{}) {
+ fmt.Printf("\n%s\n", headerColor(fmt.Sprintf(format, a...)))
+}
+
+// Print prints a standard message without color formatting.
+// Use this for regular output that doesn't need status indication.
+func Print(format string, a ...interface{}) {
+ fmt.Printf(format+"\n", a...)
+}
+
+// KeyValue prints a key-value pair with the key in bold and value in blue.
+// This is useful for displaying structured information like image details
+// or configuration values.
+func KeyValue(key string, value interface{}) {
+ fmt.Printf("%s: %v\n", color.New(color.Bold).Sprint(key), color.New(color.FgBlue).Sprint(value))
+}
+
+// Table prints a formatted table with headers and rows.
+// Headers are displayed in bold cyan. The table is rendered without borders
+// for a clean terminal appearance. Columns are automatically aligned.
+func Table(headers []string, rows [][]string) {
+ fmt.Println()
+ table := tablewriter.NewWriter(os.Stdout)
+ table.SetHeader(headers)
+ table.SetAutoWrapText(false)
+ table.SetAutoFormatHeaders(true)
+ table.SetHeaderAlignment(tablewriter.ALIGN_LEFT)
+ table.SetAlignment(tablewriter.ALIGN_LEFT)
+ table.SetCenterSeparator("")
+ table.SetColumnSeparator("")
+ table.SetRowSeparator("")
+ table.SetHeaderLine(false)
+ table.SetBorder(false)
+ table.SetTablePadding(" ") // pad with spaces
+ table.SetNoWhiteSpace(false)
+
+ // Set header colors
+ headerColors := make([]tablewriter.Colors, len(headers))
+ for i := range headerColors {
+ headerColors[i] = tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiCyanColor}
+ }
+ table.SetHeaderColor(headerColors...)
+
+ table.AppendBulk(rows)
+ table.Render()
+}
diff --git a/cli/internal/types/config.go b/cli/internal/types/config.go
new file mode 100644
index 000000000..4fbe5dda6
--- /dev/null
+++ b/cli/internal/types/config.go
@@ -0,0 +1,36 @@
+package types
+
+import "fmt"
+
+// Config holds the CLI configuration for connecting to an Arcane server.
+// It is persisted to disk as YAML and loaded on each CLI invocation.
+type Config struct {
+ // ServerURL is the base URL of the Arcane server (e.g., http://localhost:3552)
+ ServerURL string `yaml:"server_url"`
+ // APIKey is the API key for authentication
+ APIKey string `yaml:"api_key"`
+ // DefaultEnvironment is the default environment ID to use
+ DefaultEnvironment string `yaml:"default_environment,omitempty"`
+ // LogLevel is the logging level (debug, info, warn, error, fatal, panic)
+ LogLevel string `yaml:"log_level,omitempty"`
+}
+
+// Validate checks if the configuration has all required fields set.
+// It returns an error with instructions if ServerURL or APIKey is missing.
+// This should be called before using the config to make API requests.
+func (c *Config) Validate() error {
+ if c.ServerURL == "" {
+ return fmt.Errorf("server_url is not configured. Run: arcane api config set --server-url <url>")
+ }
+ if c.APIKey == "" {
+ return fmt.Errorf("api_key is not configured. Run: arcane api config set --api-key <key>")
+ }
+ return nil
+}
+
+// IsConfigured returns true if both ServerURL and APIKey are set.
+// This is a quick check to determine if the CLI has been configured
+// without triggering validation errors.
+func (c *Config) IsConfigured() bool {
+ return c.ServerURL != "" && c.APIKey != ""
+}
diff --git a/cli/internal/types/endpoints.go b/cli/internal/types/endpoints.go
new file mode 100644
index 000000000..d7bae73f6
--- /dev/null
+++ b/cli/internal/types/endpoints.go
@@ -0,0 +1,70 @@
+package types
+
+import "fmt"
+
+// ImageEndpointAction represents the type of action to perform on the images API endpoint.
+// It is used to route requests to the appropriate API path.
+type ImageEndpointAction string
+
+// ImageEndpointAction constants define the available image API operations.
+const (
+ // ImageEndpointActionList lists all images.
+ ImageEndpointActionList ImageEndpointAction = "list"
+ // ImageEndpointActionGet retrieves details for a specific image.
+ ImageEndpointActionGet ImageEndpointAction = "get"
+ // ImageEndpointActionPull pulls an image from a registry.
+ ImageEndpointActionPull ImageEndpointAction = "pull"
+ // ImageEndpointActionDelete removes an image.
+ ImageEndpointActionDelete ImageEndpointAction = "delete"
+ // ImageEndpointActionPrune removes unused images.
+ ImageEndpointActionPrune ImageEndpointAction = "prune"
+ // ImageEndpointActionCounts retrieves image usage statistics.
+ ImageEndpointActionCounts ImageEndpointAction = "counts"
+ // ImageEndpointActionUpload uploads an image from a tar archive.
+ ImageEndpointActionUpload ImageEndpointAction = "upload"
+)
+
+// ArcaneApiEndpoints holds the API endpoint path templates for the Arcane API.
+// Endpoint paths may contain format specifiers (e.g., %s) for environment IDs.
+type ArcaneApiEndpoints struct {
+ VersionEndpoint string
+ ContainersEndpoint string
+ ImagesEndpoint string
+}
+
+// Endpoints contains the defined API endpoints
+var Endpoints = ArcaneApiEndpoints{
+ VersionEndpoint: "/api/app-version",
+ ContainersEndpoint: "/api/environments/%s/containers",
+ ImagesEndpoint: "/api/environments/%s/images",
+}
+
+// FormatContainers returns the containers endpoint path for the given environment ID.
+// The returned path is suitable for listing and managing containers.
+func (e ArcaneApiEndpoints) FormatContainers(envID string) string {
+ return fmt.Sprintf(e.ContainersEndpoint, envID)
+}
+
+// UseImageEndpoint returns the appropriate API endpoint path for the given
+// image action and environment ID. It handles routing to different image
+// API endpoints based on the requested action.
+func (e ArcaneApiEndpoints) UseImageEndpoint(action ImageEndpointAction, envID string) string {
+ switch action {
+ case ImageEndpointActionList:
+ return fmt.Sprintf(e.ImagesEndpoint, envID)
+ case ImageEndpointActionGet:
+ return fmt.Sprintf(e.ImagesEndpoint, envID)
+ case ImageEndpointActionPull:
+ return fmt.Sprintf(e.ImagesEndpoint+"/pull", envID)
+ case ImageEndpointActionDelete:
+ return fmt.Sprintf(e.ImagesEndpoint, envID)
+ case ImageEndpointActionPrune:
+ return fmt.Sprintf(e.ImagesEndpoint+"/prune", envID)
+ case ImageEndpointActionCounts:
+ return fmt.Sprintf(e.ImagesEndpoint+"/counts", envID)
+ case ImageEndpointActionUpload:
+ return fmt.Sprintf(e.ImagesEndpoint+"/upload", envID)
+ default:
+ return ""
+ }
+}
diff --git a/cli/pkg/config/cmd.go b/cli/pkg/config/cmd.go
new file mode 100644
index 000000000..d857bcd3a
--- /dev/null
+++ b/cli/pkg/config/cmd.go
@@ -0,0 +1,187 @@
+package config
+
+import (
+ "fmt"
+ "io"
+ "net/http"
+ "time"
+
+ "github.com/spf13/cobra"
+ "go.getarcane.app/cli/internal/config"
+)
+
+var (
+ setServerURL string
+ setAPIKey string
+ setEnvironment string
+ setLogLevel string
+)
+
+// ConfigCmd is the command for managing API configuration
+var ConfigCmd = &cobra.Command{
+ Use: "config",
+ Short: "Manage Arcane CLI's Configuration",
+}
+
+var configShowCmd = &cobra.Command{
+ Use: "show",
+ Short: "Show current configuration",
+ RunE: func(cmd *cobra.Command, args []string) error {
+ cfg, err := config.Load()
+ if err != nil {
+ return fmt.Errorf("failed to load config: %w", err)
+ }
+
+ path, _ := config.ConfigPath()
+ fmt.Printf("Config file: %s\n\n", path)
+ fmt.Printf("Server URL: %s\n", maskIfEmpty(cfg.ServerURL, "(not set)"))
+ fmt.Printf("API Key: %s\n", maskAPIKey(cfg.APIKey))
+ fmt.Printf("Default Environment: %s\n", maskIfEmpty(cfg.DefaultEnvironment, "0 (local)"))
+ fmt.Printf("Log Level: %s\n", maskIfEmpty(cfg.LogLevel, "info (default)"))
+
+ if cfg.IsConfigured() {
+ fmt.Println("\nβœ“ Configuration is complete")
+ } else {
+ fmt.Println("\nβœ— Configuration is incomplete. Run: arcane api config set --help")
+ }
+
+ return nil
+ },
+}
+
+var configSetCmd = &cobra.Command{
+ Use: "set",
+ Short: "Set configuration values",
+ Long: `Set configuration values for connecting to an Arcane server.
+
+Examples:
+ arcane api config set --server-url http://localhost:3553
+ arcane api config set --api-key arc_xxxxxxxxxxxxx
+ arcane api config set --server-url http://my-server:3553 --api-key arc_xxxxxxxxxxxxx`,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ cfg, err := config.Load()
+ if err != nil {
+ return fmt.Errorf("failed to load config: %w", err)
+ }
+
+ updated := false
+
+ if setServerURL != "" {
+ cfg.ServerURL = setServerURL
+ fmt.Printf("Set server_url = %s\n", setServerURL)
+ updated = true
+ }
+
+ if setAPIKey != "" {
+ cfg.APIKey = setAPIKey
+ fmt.Printf("Set api_key = %s\n", maskAPIKey(setAPIKey))
+ updated = true
+ }
+
+ if setEnvironment != "" {
+ cfg.DefaultEnvironment = setEnvironment
+ fmt.Printf("Set default_environment = %s\n", setEnvironment)
+ updated = true
+ }
+
+ if setLogLevel != "" {
+ cfg.LogLevel = setLogLevel
+ fmt.Printf("Set log_level = %s\n", setLogLevel)
+ updated = true
+ }
+
+ if !updated {
+ return fmt.Errorf("no configuration values provided. Use --server-url, --api-key, --environment, or --log-level")
+ }
+
+ if err := config.Save(cfg); err != nil {
+ return fmt.Errorf("failed to save config: %w", err)
+ }
+
+ path, _ := config.ConfigPath()
+ fmt.Printf("\nConfiguration saved to %s\n", path)
+
+ return nil
+ },
+}
+
+var configPathCmd = &cobra.Command{
+ Use: "path",
+ Short: "Print the config file path",
+ RunE: func(cmd *cobra.Command, args []string) error {
+ path, err := config.ConfigPath()
+ if err != nil {
+ return err
+ }
+ fmt.Println(path)
+ return nil
+ },
+}
+
+var configTestCmd = &cobra.Command{
+ Use: "test",
+ Short: "Test the API connection",
+ RunE: func(cmd *cobra.Command, args []string) error {
+ cfg, err := config.Load()
+ if err != nil {
+ return fmt.Errorf("failed to load config: %w", err)
+ }
+
+ if err := cfg.Validate(); err != nil {
+ return err
+ }
+
+ fmt.Printf("Testing connection to %s...\n", cfg.ServerURL)
+
+ // Test connection directly without importing client to avoid circular import
+ httpClient := &http.Client{Timeout: 10 * time.Second}
+ req, err := http.NewRequestWithContext(cmd.Context(), http.MethodGet, cfg.ServerURL+"/api/version", nil)
+ if err != nil {
+ return fmt.Errorf("failed to create request: %w", err)
+ }
+ req.Header.Set("X-API-TOKEN", cfg.APIKey)
+
+ resp, err := httpClient.Do(req)
+ if err != nil {
+ return fmt.Errorf("connection test failed: %w", err)
+ }
+ defer func() { _ = resp.Body.Close() }()
+
+ if resp.StatusCode != http.StatusOK {
+ body, _ := io.ReadAll(resp.Body)
+ return fmt.Errorf("connection test failed with status %d: %s", resp.StatusCode, string(body))
+ }
+
+ fmt.Println("βœ“ Connection successful!")
+ return nil
+ },
+}
+
+func init() {
+ ConfigCmd.AddCommand(configShowCmd)
+ ConfigCmd.AddCommand(configSetCmd)
+ ConfigCmd.AddCommand(configPathCmd)
+ ConfigCmd.AddCommand(configTestCmd)
+
+ configSetCmd.Flags().StringVar(&setServerURL, "server-url", "", "Arcane server URL (e.g., http://localhost:3553)")
+ configSetCmd.Flags().StringVar(&setAPIKey, "api-key", "", "API key for authentication")
+ configSetCmd.Flags().StringVar(&setEnvironment, "environment", "", "Default environment ID")
+ configSetCmd.Flags().StringVar(&setLogLevel, "log-level", "", "Default log level (debug, info, warn, error)")
+}
+
+func maskIfEmpty(value, fallback string) string {
+ if value == "" {
+ return fallback
+ }
+ return value
+}
+
+func maskAPIKey(key string) string {
+ if key == "" {
+ return "(not set)"
+ }
+ if len(key) <= 8 {
+ return "***"
+ }
+ return key[:4] + "..." + key[len(key)-4:]
+}
diff --git a/cli/pkg/containers/cmd.go b/cli/pkg/containers/cmd.go
new file mode 100644
index 000000000..85c179222
--- /dev/null
+++ b/cli/pkg/containers/cmd.go
@@ -0,0 +1,99 @@
+package containers
+
+import (
+ "encoding/json"
+ "fmt"
+ "io"
+ "os"
+ "text/tabwriter"
+
+ "github.com/spf13/cobra"
+ "go.getarcane.app/cli/internal/client"
+ "go.getarcane.app/cli/internal/types"
+)
+
+var (
+ containersLimit int
+ containersAll bool
+)
+
+// ContainersCmd is the parent command for container operations
+var ContainersCmd = &cobra.Command{
+ Use: "containers",
+ Aliases: []string{"container", "c"},
+ Short: "Manage containers",
+}
+
+var containersListCmd = &cobra.Command{
+ Use: "list",
+ Aliases: []string{"ls"},
+ Short: "List containers",
+ RunE: func(cmd *cobra.Command, args []string) error {
+ c, err := client.NewFromConfig()
+ if err != nil {
+ return err
+ }
+
+ path := types.Endpoints.FormatContainers(c.EnvID())
+ if containersLimit > 0 {
+ path = fmt.Sprintf("%s?pageSize=%d", path, containersLimit)
+ }
+
+ resp, err := c.Get(cmd.Context(), path)
+ if err != nil {
+ return fmt.Errorf("failed to list containers: %w", err)
+ }
+ defer func() { _ = resp.Body.Close() }()
+
+ body, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return fmt.Errorf("failed to read response: %w", err)
+ }
+
+ var result struct {
+ Items []struct {
+ ID string `json:"id"`
+ Names []string `json:"names"`
+ Image string `json:"image"`
+ State string `json:"state"`
+ Status string `json:"status"`
+ } `json:"items"`
+ Pagination struct {
+ TotalItems int64 `json:"totalItems"`
+ } `json:"pagination"`
+ }
+
+ if err := json.Unmarshal(body, &result); err != nil {
+ return fmt.Errorf("failed to parse response: %w", err)
+ }
+
+ w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
+ _, _ = fmt.Fprintln(w, "ID\tNAME\tIMAGE\tSTATE\tSTATUS")
+ for _, container := range result.Items {
+ name := ""
+ if len(container.Names) > 0 {
+ name = container.Names[0]
+ }
+ _, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", shortID(container.ID), name, container.Image, container.State, container.Status)
+ }
+ _ = w.Flush()
+
+ fmt.Printf("\nTotal: %d containers\n", result.Pagination.TotalItems)
+
+ return nil
+ },
+}
+
+func init() {
+ ContainersCmd.AddCommand(containersListCmd)
+
+ containersListCmd.Flags().IntVarP(&containersLimit, "limit", "n", 20, "Number of containers to show")
+ containersListCmd.Flags().BoolVarP(&containersAll, "all", "a", false, "Show all containers (including stopped)")
+}
+
+func shortID(id string) string {
+ if len(id) > 12 {
+ return id[:12]
+ }
+ return id
+}
diff --git a/backend/internal/cli/generate/generate.go b/cli/pkg/generate/generate.go
similarity index 100%
rename from backend/internal/cli/generate/generate.go
rename to cli/pkg/generate/generate.go
diff --git a/backend/internal/cli/generate/secret.go b/cli/pkg/generate/secret.go
similarity index 99%
rename from backend/internal/cli/generate/secret.go
rename to cli/pkg/generate/secret.go
index 8c973d05d..4297ba39b 100644
--- a/backend/internal/cli/generate/secret.go
+++ b/cli/pkg/generate/secret.go
@@ -110,5 +110,4 @@ func printAllFormats(encKey, jwtKey []byte) {
fmt.Printf("ENCRYPTION_KEY=%s\n", hex.EncodeToString(encKey))
fmt.Printf("JWT_SECRET=%s\n", hex.EncodeToString(jwtKey))
fmt.Println()
-
}
diff --git a/backend/internal/cli/generate/secret_test.go b/cli/pkg/generate/secret_test.go
similarity index 98%
rename from backend/internal/cli/generate/secret_test.go
rename to cli/pkg/generate/secret_test.go
index 2dc6d9564..fc58843b4 100644
--- a/backend/internal/cli/generate/secret_test.go
+++ b/cli/pkg/generate/secret_test.go
@@ -9,7 +9,7 @@ import (
"strings"
"testing"
- gen "github.com/getarcaneapp/arcane/backend/internal/cli/generate"
+ gen "go.getarcane.app/cli/pkg/generate"
)
// captureOutput captures stdout produced by fn and returns it as a string.
diff --git a/cli/pkg/images/cmd.go b/cli/pkg/images/cmd.go
new file mode 100644
index 000000000..1c9173b27
--- /dev/null
+++ b/cli/pkg/images/cmd.go
@@ -0,0 +1,737 @@
+// Package images provides CLI commands for managing Docker images on Arcane servers.
+//
+// This package implements the "arcane images" command group, which includes
+// subcommands for listing, inspecting, pulling, removing, pruning, and uploading
+// Docker images.
+//
+// # Available Commands
+//
+// - list: List all images with optional filtering and pagination
+// - get: Get detailed information about a specific image
+// - pull: Pull an image from a container registry
+// - remove: Remove an image from the server
+// - prune: Remove unused images to reclaim disk space
+// - counts: Display image usage statistics
+// - upload: Upload a Docker image from a tar archive
+//
+// # Example Usage
+//
+// # List all images
+// arcane images list
+//
+// # Pull an image
+// arcane images pull nginx:latest
+//
+// # Get image details
+// arcane images get sha256:abc123...
+//
+// # Remove unused images
+// arcane images prune
+package images
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "io"
+ "mime/multipart"
+ "net/http"
+ "net/url"
+ "os"
+ "path/filepath"
+ "sort"
+ "strings"
+ "time"
+
+ "github.com/fatih/color"
+ "github.com/schollz/progressbar/v3"
+ "github.com/spf13/cobra"
+ "go.getarcane.app/cli/internal/client"
+ "go.getarcane.app/cli/internal/logger"
+ "go.getarcane.app/cli/internal/output"
+ clitypes "go.getarcane.app/cli/internal/types"
+ "go.getarcane.app/types/image"
+ "go.withmatt.com/size"
+)
+
+var (
+ imagesLimit int
+ imagesStart int
+ imagesSort string
+ imagesOrder string
+ imagesSearch string
+)
+
+// ImagesCmd is the parent command for image operations
+var ImagesCmd = &cobra.Command{
+ Use: "images",
+ Aliases: []string{"image", "i"},
+ Short: "Manage images",
+}
+
+var imagesListCmd = &cobra.Command{
+ Use: "list",
+ Aliases: []string{"ls"},
+ Short: "List images",
+ SilenceUsage: true,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ log := logger.GetLogger()
+ c, err := client.NewFromConfig()
+ if err != nil {
+ return err
+ }
+
+ path := clitypes.Endpoints.UseImageEndpoint(clitypes.ImageEndpointActionList, c.EnvID())
+
+ // Parse the path to handle query params
+ u, err := url.Parse(path)
+ if err != nil {
+ return fmt.Errorf("failed to parse endpoint path: %w", err)
+ }
+ q := u.Query()
+
+ if imagesLimit > 0 {
+ q.Set("limit", fmt.Sprintf("%d", imagesLimit))
+ }
+ if imagesStart > 0 {
+ q.Set("start", fmt.Sprintf("%d", imagesStart))
+ }
+ if imagesSort != "" {
+ q.Set("sort", imagesSort)
+ }
+ if imagesOrder != "" {
+ q.Set("order", imagesOrder)
+ }
+ if imagesSearch != "" {
+ q.Set("search", imagesSearch)
+ }
+
+ u.RawQuery = q.Encode()
+ path = u.String()
+
+ log.Debugf("Listing images from: %s", path)
+
+ resp, err := c.Get(cmd.Context(), path)
+ if err != nil {
+ return fmt.Errorf("failed to list images: %w", err)
+ }
+ defer func() { _ = resp.Body.Close() }()
+
+ body, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return fmt.Errorf("failed to read response: %w", err)
+ }
+
+ log.Debugf("Response body: %s", string(body))
+
+ if jsonOutput, _ := cmd.Flags().GetBool("json"); jsonOutput {
+ fmt.Println(string(body))
+ return nil
+ }
+
+ var result struct {
+ Success bool `json:"success"`
+ Data []image.Summary `json:"data"`
+ Pagination struct {
+ TotalItems int64 `json:"totalItems"`
+ } `json:"pagination"`
+ }
+
+ if err := json.Unmarshal(body, &result); err != nil {
+ return fmt.Errorf("failed to parse response: %w", err)
+ }
+
+ headers := []string{"ID", "REPOSITORY:TAG", "SIZE", "IN USE"}
+ var rows [][]string
+
+ for _, img := range result.Data {
+ tag := "<none>"
+ if len(img.RepoTags) > 0 {
+ tag = img.RepoTags[0]
+ }
+ inUse := color.New(color.FgHiBlack).Sprint("No")
+ if img.InUse {
+ inUse = color.New(color.FgGreen).Sprint("Yes")
+ }
+ id := color.New(color.FgHiWhite, color.Bold).Sprint(img.ID)
+ rows = append(rows, []string{id, tag, size.Capacity(img.Size).String(), inUse})
+ }
+
+ output.Table(headers, rows)
+ output.Info("Total: %d images", result.Pagination.TotalItems)
+
+ return nil
+ },
+}
+
+var imagesGetCmd = &cobra.Command{
+ Use: "get [IMAGE_ID]",
+ Short: "Get image details by ID",
+ Args: cobra.ExactArgs(1),
+ SilenceUsage: true,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ log := logger.GetLogger()
+ c, err := client.NewFromConfig()
+ if err != nil {
+ return err
+ }
+
+ imageID := args[0]
+ path := fmt.Sprintf("%s/%s", clitypes.Endpoints.UseImageEndpoint(clitypes.ImageEndpointActionGet, c.EnvID()), imageID)
+
+ log.Debugf("Getting image details from: %s", path)
+
+ resp, err := c.Get(cmd.Context(), path)
+ if err != nil {
+ return fmt.Errorf("failed to get image: %w", err)
+ }
+ defer func() { _ = resp.Body.Close() }()
+
+ body, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return fmt.Errorf("failed to read response: %w", err)
+ }
+
+ log.Debugf("Response body: %s", string(body))
+
+ if jsonOutput, _ := cmd.Flags().GetBool("json"); jsonOutput {
+ fmt.Println(string(body))
+ return nil
+ }
+
+ var result struct {
+ Success bool `json:"success"`
+ Data image.DetailSummary `json:"data"`
+ }
+
+ if err := json.Unmarshal(body, &result); err != nil {
+ return fmt.Errorf("failed to parse response: %w", err)
+ }
+
+ output.Header("Image Details")
+ output.KeyValue("ID", result.Data.ID)
+ if len(result.Data.RepoTags) > 0 {
+ output.KeyValue("Tags", strings.Join(result.Data.RepoTags, ", "))
+ }
+ output.KeyValue("Size", size.Capacity(result.Data.Size).String())
+ output.KeyValue("Architecture", result.Data.Architecture)
+ output.KeyValue("OS", result.Data.Os)
+ if result.Data.Created != "" {
+ output.KeyValue("Created", result.Data.Created)
+ }
+ if result.Data.Author != "" {
+ output.KeyValue("Author", result.Data.Author)
+ }
+
+ if result.Data.Config.WorkingDir != "" {
+ output.KeyValue("Working Dir", result.Data.Config.WorkingDir)
+ }
+
+ if len(result.Data.Config.Cmd) > 0 {
+ output.KeyValue("Cmd", strings.Join(result.Data.Config.Cmd, " "))
+ }
+
+ if len(result.Data.Config.Env) > 0 {
+ output.Header("Environment Variables")
+ for _, env := range result.Data.Config.Env {
+ fmt.Println(env)
+ }
+ }
+
+ if len(result.Data.Config.ExposedPorts) > 0 {
+ output.Header("Exposed Ports")
+ var ports []string
+ for p := range result.Data.Config.ExposedPorts {
+ ports = append(ports, p)
+ }
+ sort.Strings(ports)
+ for _, p := range ports {
+ fmt.Println(p)
+ }
+ }
+
+ return nil
+ },
+}
+
+var (
+ removeForce bool
+)
+
+var imagesRemoveCmd = &cobra.Command{
+ Use: "remove [IMAGE_ID]",
+ Aliases: []string{"rm", "delete"},
+ Short: "Remove an image",
+ Args: cobra.ExactArgs(1),
+ SilenceUsage: true,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ log := logger.GetLogger()
+ c, err := client.NewFromConfig()
+ if err != nil {
+ return err
+ }
+
+ imageID := args[0]
+ path := fmt.Sprintf("%s/%s", clitypes.Endpoints.UseImageEndpoint(clitypes.ImageEndpointActionDelete, c.EnvID()), imageID)
+
+ if removeForce {
+ u, err := url.Parse(path)
+ if err != nil {
+ return fmt.Errorf("failed to parse path: %w", err)
+ }
+ q := u.Query()
+ q.Set("force", "true")
+ u.RawQuery = q.Encode()
+ path = u.String()
+ }
+
+ log.Debugf("Removing image from: %s", path)
+
+ resp, err := c.Delete(cmd.Context(), path)
+ if err != nil {
+ return fmt.Errorf("failed to remove image: %w", err)
+ }
+ defer func() { _ = resp.Body.Close() }()
+
+ body, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return fmt.Errorf("failed to read response: %w", err)
+ }
+
+ log.Debugf("Response body: %s", string(body))
+
+ if jsonOutput, _ := cmd.Flags().GetBool("json"); jsonOutput {
+ fmt.Println(string(body))
+ return nil
+ }
+
+ var result struct {
+ Success bool `json:"success"`
+ Data struct {
+ Message string `json:"message"`
+ } `json:"data"`
+ }
+
+ if err := json.Unmarshal(body, &result); err != nil {
+ return fmt.Errorf("failed to parse response: %w", err)
+ }
+
+ output.Success("%s", result.Data.Message)
+
+ return nil
+ },
+}
+
+var imagesPullCmd = &cobra.Command{
+ Use: "pull [IMAGE_NAME]",
+ Short: "Pull an image from a registry",
+ Args: cobra.ExactArgs(1),
+ SilenceUsage: true,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ log := logger.GetLogger()
+ c, err := client.NewFromConfig()
+ if err != nil {
+ return err
+ }
+
+ imageName := args[0]
+ path := clitypes.Endpoints.UseImageEndpoint(clitypes.ImageEndpointActionPull, c.EnvID())
+
+ log.Debugf("Pulling image from: %s", path)
+
+ requestBody := map[string]interface{}{
+ "imageName": imageName,
+ }
+
+ resp, err := c.Post(cmd.Context(), path, requestBody)
+ if err != nil {
+ return fmt.Errorf("failed to pull image: %w", err)
+ }
+ defer func() { _ = resp.Body.Close() }()
+
+ // Stream the response
+ if jsonOutput, _ := cmd.Flags().GetBool("json"); jsonOutput {
+ _, err = io.Copy(cmd.OutOrStdout(), resp.Body)
+ if err != nil {
+ return fmt.Errorf("failed to read pull stream: %w", err)
+ }
+ return nil
+ }
+
+ output.Info("Pulling image: %s", imageName)
+
+ decoder := json.NewDecoder(resp.Body)
+ var bar *progressbar.ProgressBar
+ var currentID string
+
+ for {
+ var event struct {
+ Status string `json:"status"`
+ Error string `json:"error"`
+ ID string `json:"id"`
+ ProgressDetail struct {
+ Current int64 `json:"current"`
+ Total int64 `json:"total"`
+ } `json:"progressDetail"`
+ }
+
+ if err := decoder.Decode(&event); err != nil {
+ if err == io.EOF {
+ break
+ }
+ return fmt.Errorf("failed to decode stream: %w", err)
+ }
+
+ if event.Error != "" {
+ return fmt.Errorf("pull error: %s", event.Error)
+ }
+
+ if event.Status == "Downloading" && event.ProgressDetail.Total > 0 {
+ if bar == nil || currentID != event.ID {
+ if bar != nil {
+ _ = bar.Finish()
+ fmt.Println()
+ }
+ currentID = event.ID
+ bar = progressbar.NewOptions64(
+ event.ProgressDetail.Total,
+ progressbar.OptionSetDescription(fmt.Sprintf("Downloading %s", event.ID)),
+ progressbar.OptionSetWriter(os.Stdout),
+ progressbar.OptionShowBytes(true),
+ progressbar.OptionSetWidth(15),
+ progressbar.OptionThrottle(65*time.Millisecond),
+ progressbar.OptionShowCount(),
+ progressbar.OptionOnCompletion(func() {
+ fmt.Println()
+ }),
+ progressbar.OptionSpinnerType(14),
+ progressbar.OptionFullWidth(),
+ progressbar.OptionSetTheme(progressbar.Theme{
+ Saucer: "=",
+ SaucerHead: ">",
+ SaucerPadding: " ",
+ BarStart: "[",
+ BarEnd: "]",
+ }),
+ )
+ }
+ _ = bar.Set64(event.ProgressDetail.Current)
+ } else {
+ if bar != nil {
+ // If we switch from downloading to something else for the same ID, finish the bar
+ if event.ID == currentID && event.Status == "Download complete" {
+ _ = bar.Finish()
+ fmt.Println()
+ bar = nil
+ currentID = ""
+ }
+ }
+
+ // Only print status if it's not a progress update for the current bar
+ if event.Status != "Downloading" {
+ if event.ID != "" {
+ fmt.Printf("%s: %s\n", event.ID, event.Status)
+ } else {
+ fmt.Printf("%s\n", event.Status)
+ }
+ }
+ }
+ }
+
+ output.Success("Image pulled successfully")
+
+ return nil
+ },
+}
+
+var (
+ pruneDangling bool
+)
+
+var imagesPruneCmd = &cobra.Command{
+ Use: "prune",
+ Short: "Remove unused images",
+ SilenceUsage: true,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ log := logger.GetLogger()
+ c, err := client.NewFromConfig()
+ if err != nil {
+ return err
+ }
+
+ path := clitypes.Endpoints.UseImageEndpoint(clitypes.ImageEndpointActionPrune, c.EnvID())
+
+ log.Debugf("Pruning images from: %s", path)
+
+ requestBody := map[string]interface{}{
+ "dangling": pruneDangling,
+ }
+
+ jsonOutput, _ := cmd.Flags().GetBool("json")
+ var stopSpinner func()
+
+ if !jsonOutput {
+ bar := progressbar.NewOptions(-1,
+ progressbar.OptionSetDescription("Pruning images..."),
+ progressbar.OptionSpinnerType(14),
+ progressbar.OptionSetWriter(os.Stdout),
+ progressbar.OptionClearOnFinish(),
+ progressbar.OptionSetWidth(10),
+ progressbar.OptionSetTheme(progressbar.Theme{
+ Saucer: "=",
+ SaucerHead: ">",
+ SaucerPadding: " ",
+ BarStart: "[",
+ BarEnd: "]",
+ }),
+ )
+
+ done := make(chan bool)
+ go func() {
+ for {
+ select {
+ case <-done:
+ return
+ case <-time.After(100 * time.Millisecond):
+ _ = bar.Add(1)
+ }
+ }
+ }()
+
+ stopSpinner = func() {
+ done <- true
+ _ = bar.Finish()
+ fmt.Println()
+ }
+ }
+
+ resp, err := c.Post(cmd.Context(), path, requestBody)
+
+ if stopSpinner != nil {
+ stopSpinner()
+ }
+
+ if err != nil {
+ return fmt.Errorf("failed to prune images: %w", err)
+ }
+ defer func() { _ = resp.Body.Close() }()
+
+ body, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return fmt.Errorf("failed to read response: %w", err)
+ }
+
+ log.Debugf("Response body: %s", string(body))
+
+ if jsonOutput, _ := cmd.Flags().GetBool("json"); jsonOutput {
+ fmt.Println(string(body))
+ return nil
+ }
+
+ var result struct {
+ Success bool `json:"success"`
+ Data struct {
+ ImagesDeleted []string `json:"imagesDeleted"`
+ SpaceReclaimed int64 `json:"spaceReclaimed"`
+ } `json:"data"`
+ }
+
+ if err := json.Unmarshal(body, &result); err != nil {
+ return fmt.Errorf("failed to parse response: %w", err)
+ }
+
+ output.Success("Pruned %d images, reclaimed %s", len(result.Data.ImagesDeleted), size.Capacity(result.Data.SpaceReclaimed).String())
+
+ return nil
+ },
+}
+
+var imagesCountsCmd = &cobra.Command{
+ Use: "counts",
+ Short: "Get image usage counts",
+ SilenceUsage: true,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ log := logger.GetLogger()
+ c, err := client.NewFromConfig()
+ if err != nil {
+ return err
+ }
+
+ path := clitypes.Endpoints.UseImageEndpoint(clitypes.ImageEndpointActionCounts, c.EnvID())
+
+ log.Debugf("Getting image counts from: %s", path)
+
+ resp, err := c.Get(cmd.Context(), path)
+ if err != nil {
+ return fmt.Errorf("failed to get image counts: %w", err)
+ }
+ defer func() { _ = resp.Body.Close() }()
+
+ body, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return fmt.Errorf("failed to read response: %w", err)
+ }
+
+ log.Debugf("Response body: %s", string(body))
+
+ if jsonOutput, _ := cmd.Flags().GetBool("json"); jsonOutput {
+ fmt.Println(string(body))
+ return nil
+ }
+
+ var result struct {
+ Success bool `json:"success"`
+ Data image.UsageCounts `json:"data"`
+ }
+
+ if err := json.Unmarshal(body, &result); err != nil {
+ return fmt.Errorf("failed to parse response: %w", err)
+ }
+
+ output.Header("Image Usage Counts")
+ output.KeyValue("In Use", result.Data.Inuse)
+ output.KeyValue("Unused", result.Data.Unused)
+ output.KeyValue("Total", result.Data.Total)
+ output.KeyValue("Total Size", size.Capacity(result.Data.TotalSize).String())
+
+ return nil
+ },
+}
+
+var imagesUploadCmd = &cobra.Command{
+ Use: "upload [FILE]",
+ Short: "Upload a Docker image from a tar archive",
+ Args: cobra.ExactArgs(1),
+ SilenceUsage: true,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ log := logger.GetLogger()
+ c, err := client.NewFromConfig()
+ if err != nil {
+ return err
+ }
+
+ filePath := args[0]
+ path := clitypes.Endpoints.UseImageEndpoint(clitypes.ImageEndpointActionUpload, c.EnvID())
+
+ log.Debugf("Uploading image from file: %s to %s", filePath, path)
+
+ // Open the file
+ file, err := os.Open(filePath)
+ if err != nil {
+ return fmt.Errorf("failed to open file: %w", err)
+ }
+ defer func() { _ = file.Close() }()
+
+ // Create a multipart form
+ body := &bytes.Buffer{}
+ writer := multipart.NewWriter(body)
+
+ part, err := writer.CreateFormFile("file", filepath.Base(filePath))
+ if err != nil {
+ return fmt.Errorf("failed to create form file: %w", err)
+ }
+
+ _, err = io.Copy(part, file)
+ if err != nil {
+ return fmt.Errorf("failed to copy file: %w", err)
+ }
+
+ err = writer.Close()
+ if err != nil {
+ return fmt.Errorf("failed to close writer: %w", err)
+ }
+
+ output.Info("Uploading image: %s", filePath)
+
+ var requestBody io.Reader = body
+
+ jsonOutput, _ := cmd.Flags().GetBool("json")
+ if !jsonOutput {
+ bar := progressbar.NewOptions64(
+ int64(body.Len()),
+ progressbar.OptionSetDescription("Uploading"),
+ progressbar.OptionSetWriter(os.Stdout),
+ progressbar.OptionShowBytes(true),
+ progressbar.OptionSetWidth(15),
+ progressbar.OptionThrottle(65*time.Millisecond),
+ progressbar.OptionShowCount(),
+ progressbar.OptionOnCompletion(func() {
+ fmt.Println()
+ }),
+ progressbar.OptionSpinnerType(14),
+ progressbar.OptionFullWidth(),
+ progressbar.OptionSetTheme(progressbar.Theme{
+ Saucer: "=",
+ SaucerHead: ">",
+ SaucerPadding: " ",
+ BarStart: "[",
+ BarEnd: "]",
+ }),
+ )
+ requestBody = io.TeeReader(body, bar)
+ }
+
+ // Use client.RequestRaw to make the multipart request with correct headers
+ headers := map[string]string{
+ "Content-Type": writer.FormDataContentType(),
+ }
+
+ resp, err := c.RequestRaw(cmd.Context(), http.MethodPost, path, requestBody, headers)
+ if err != nil {
+ return fmt.Errorf("failed to upload image: %w", err)
+ }
+ defer func() { _ = resp.Body.Close() }()
+
+ respBody, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return fmt.Errorf("failed to read response: %w", err)
+ }
+
+ log.Debugf("Response body: %s", string(respBody))
+
+ if jsonOutput, _ := cmd.Flags().GetBool("json"); jsonOutput {
+ fmt.Println(string(respBody))
+ return nil
+ }
+
+ var result struct {
+ Success bool `json:"success"`
+ Data image.LoadResult `json:"data"`
+ }
+
+ if err := json.Unmarshal(respBody, &result); err != nil {
+ return fmt.Errorf("failed to parse response: %w", err)
+ }
+
+ if !result.Success {
+ return fmt.Errorf("upload failed: %s", string(respBody))
+ }
+
+ output.Success("Image uploaded successfully")
+
+ return nil
+ },
+}
+
+func init() {
+ ImagesCmd.AddCommand(imagesListCmd)
+ imagesListCmd.Flags().IntVarP(&imagesLimit, "limit", "n", 0, "Number of images to show (server default 20)")
+ imagesListCmd.Flags().IntVar(&imagesStart, "start", 0, "Offset for pagination")
+ imagesListCmd.Flags().StringVar(&imagesSort, "sort", "", "Field to sort by")
+ imagesListCmd.Flags().StringVar(&imagesOrder, "order", "", "Sort order (asc/desc)")
+ imagesListCmd.Flags().StringVar(&imagesSearch, "search", "", "Search query")
+
+ ImagesCmd.AddCommand(imagesGetCmd)
+
+ ImagesCmd.AddCommand(imagesRemoveCmd)
+ imagesRemoveCmd.Flags().BoolVarP(&removeForce, "force", "f", false, "Force removal of image")
+
+ ImagesCmd.AddCommand(imagesPullCmd)
+
+ ImagesCmd.AddCommand(imagesPruneCmd)
+ imagesPruneCmd.Flags().BoolVar(&pruneDangling, "dangling", false, "Only remove dangling images")
+
+ ImagesCmd.AddCommand(imagesCountsCmd)
+
+ ImagesCmd.AddCommand(imagesUploadCmd)
+}
diff --git a/cli/pkg/root.go b/cli/pkg/root.go
new file mode 100644
index 000000000..6cc54b5f3
--- /dev/null
+++ b/cli/pkg/root.go
@@ -0,0 +1,96 @@
+// Package cli provides the root command and entry point for the Arcane CLI.
+//
+// The Arcane CLI is the official command-line interface for interacting with
+// Arcane servers. It provides commands for managing containers, images,
+// configuration, and more.
+//
+// # Getting Started
+//
+// Configure the CLI with your server URL and API key:
+//
+// arcane config set --server-url https://your-server.com --api-key YOUR_API_KEY
+//
+// # Global Flags
+//
+// The following flags are available on all commands:
+//
+// --log-level string Log level (debug, info, warn, error, fatal, panic) (default "info")
+// --json Output in JSON format
+// -v, --version Print version information
+//
+// # Command Groups
+//
+// - config: Manage CLI configuration
+// - images: Manage Docker images
+// - containers: Manage containers
+// - generate: Generate secrets and tokens
+// - version: Display version information
+package cli
+
+import (
+ "context"
+ "fmt"
+ "os"
+ "runtime"
+
+ "github.com/spf13/cobra"
+ "go.getarcane.app/cli/internal/config"
+ "go.getarcane.app/cli/internal/logger"
+ configClient "go.getarcane.app/cli/pkg/config"
+ "go.getarcane.app/cli/pkg/containers"
+ "go.getarcane.app/cli/pkg/generate"
+ "go.getarcane.app/cli/pkg/images"
+ "go.getarcane.app/cli/pkg/version"
+)
+
+var (
+ logLevel string
+ jsonOutput bool
+ showVersion bool
+)
+
+var rootCmd = &cobra.Command{
+ Use: "arcane",
+ Long: "Arcane CLI - The official command line interface for Arcane",
+ PersistentPreRun: func(cmd *cobra.Command, args []string) {
+ // Load config to check for log level setting
+ cfg, _ := config.Load()
+
+ // If flag is not explicitly set, try to use config value
+ if !cmd.Flags().Changed("log-level") && cfg != nil && cfg.LogLevel != "" {
+ logLevel = cfg.LogLevel
+ }
+
+ logger.Setup(logLevel, jsonOutput)
+ },
+ RunE: func(cmd *cobra.Command, args []string) error {
+ if showVersion {
+ fmt.Printf("Arcane CLI version: %s\n", config.Version)
+ fmt.Printf("Git revision: %s\n", config.Revision)
+ fmt.Printf("Go version: %s\n", runtime.Version())
+ fmt.Printf("OS/Arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
+ return nil
+ }
+ return cmd.Help()
+ },
+ CompletionOptions: cobra.CompletionOptions{DisableDefaultCmd: true},
+}
+
+func Execute() {
+ err := rootCmd.ExecuteContext(context.Background())
+ if err != nil {
+ os.Exit(1)
+ }
+}
+
+func init() {
+ rootCmd.PersistentFlags().StringVar(&logLevel, "log-level", "info", "Log level (debug, info, warn, error, fatal, panic)")
+ rootCmd.PersistentFlags().BoolVar(&jsonOutput, "json", false, "Log in JSON format")
+ rootCmd.Flags().BoolVarP(&showVersion, "version", "v", false, "Print version information")
+
+ rootCmd.AddCommand(configClient.ConfigCmd)
+ rootCmd.AddCommand(generate.GenerateCmd)
+ rootCmd.AddCommand(version.VersionCmd)
+ rootCmd.AddCommand(containers.ContainersCmd)
+ rootCmd.AddCommand(images.ImagesCmd)
+}
diff --git a/cli/pkg/version/cmd.go b/cli/pkg/version/cmd.go
new file mode 100644
index 000000000..e6be05468
--- /dev/null
+++ b/cli/pkg/version/cmd.go
@@ -0,0 +1,68 @@
+package version
+
+import (
+ "encoding/json"
+ "fmt"
+ "io"
+
+ "github.com/spf13/cobra"
+ "go.getarcane.app/cli/internal/client"
+ "go.getarcane.app/cli/internal/logger"
+ "go.getarcane.app/cli/internal/output"
+ clitypes "go.getarcane.app/cli/internal/types"
+ "go.getarcane.app/types/version"
+)
+
+// VersionCmd gets the server version
+var VersionCmd = &cobra.Command{
+ Use: "version",
+ Short: "Get the Arcane server version",
+ SilenceUsage: true,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ logger.GetLogger().Debug("Fetching server version")
+
+ c, err := client.NewFromConfig()
+ if err != nil {
+ return err
+ }
+
+ logger.GetLogger().Debug("Sending request to ", clitypes.Endpoints.VersionEndpoint)
+ resp, err := c.Get(cmd.Context(), clitypes.Endpoints.VersionEndpoint)
+ if err != nil {
+ return fmt.Errorf("failed to get version: %w", err)
+ }
+ defer func() { _ = resp.Body.Close() }()
+
+ logger.GetLogger().Debugf("Response status: %s", resp.Status)
+
+ body, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return fmt.Errorf("failed to read response: %w", err)
+ }
+
+ logger.GetLogger().Debugf("Raw response: %s", string(body))
+
+ var result version.Info
+
+ if err := json.Unmarshal(body, &result); err != nil {
+ return fmt.Errorf("failed to parse response: %w", err)
+ }
+
+ logger.GetLogger().Debugf("Parsed version data: %+v", result)
+
+ output.Header("Arcane Environment Details: \n")
+
+ output.KeyValue("Version", result.DisplayVersion)
+ if result.Revision != "" {
+ output.KeyValue("Revision", result.Revision)
+ }
+ if result.UpdateAvailable {
+ output.Warning("Update available! New version: %s", result.NewestVersion)
+ if result.ReleaseURL != "" {
+ output.Info("Download at: %s", result.ReleaseURL)
+ }
+ }
+
+ return nil
+ },
+}
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 358f2c3ee..aaaaaa435 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -19,17 +19,21 @@ ARG TARGETARCH
ARG BUILD_TAGS
WORKDIR /build
-RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl git tzdata \
+RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl git tzdata jq \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
-COPY ./.version ./VERSION
-COPY ./backend/go.mod ./backend/go.sum ./
+COPY ./.arcane.json ./arcane.json
+COPY ./go.work ./go.work
+COPY ./types ./types
+COPY ./cli ./cli
+COPY ./backend/go.mod ./backend/go.sum ./backend/
+WORKDIR /build/backend
RUN --mount=type=cache,target=/go/pkg/mod go mod download
COPY ./backend ./
COPY --from=frontend-builder /build/frontend/dist ./frontend/dist
RUN --mount=type=cache,target=/root/.cache/go-build \
- VERSION=$(cat VERSION | tr -d '[:space:]') && \
- REVISION=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown") && \
+ VERSION=$(jq -r '.version // "dev"' ../arcane.json) && \
+ REVISION=$(jq -r '.revision // "unknown"' ../arcane.json) && \
CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH \
go build \
-tags "${BUILD_TAGS}" \
diff --git a/docker/Dockerfile-agent b/docker/Dockerfile-agent
index c1e638911..713e05fec 100644
--- a/docker/Dockerfile-agent
+++ b/docker/Dockerfile-agent
@@ -7,19 +7,22 @@ ARG TARGETARCH
ARG BUILD_TAGS="exclude_frontend"
WORKDIR /build
-RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates tzdata curl \
+RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates tzdata curl jq \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
-COPY ./.version ./VERSION
-COPY ./backend/go.mod ./backend/go.sum ./
+COPY ./.arcane.json ./arcane.json
+COPY ./go.work ./go.work
+COPY ./types ./types
+COPY ./cli ./cli
+COPY ./backend/go.mod ./backend/go.sum ./backend/
+WORKDIR /build/backend
RUN go mod download
-COPY ./backend ./backend
+COPY ./backend ./
-WORKDIR /build/backend
RUN --mount=type=cache,target=/root/.cache/go-build \
- VERSION=$(cat ../VERSION | tr -d '[:space:]') && \
- REVISION=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown") && \
+ VERSION=$(jq -r '.version // "dev"' ../arcane.json) && \
+ REVISION=$(jq -r '.revision // "unknown"' ../arcane.json) && \
CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH \
go build \
-tags "${BUILD_TAGS}" \
diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev
index db3984070..99fefffaa 100644
--- a/docker/Dockerfile.dev
+++ b/docker/Dockerfile.dev
@@ -51,18 +51,25 @@ ENV GIN_MODE=debug \
WORKDIR /app
-# Copy Go module files first for dependency caching
-COPY backend/go.mod backend/go.sum ./
+# Copy Go workspace file and all modules first
+COPY go.work ./go.work
+COPY types/ ./types/
+COPY cli/ ./cli/
+
+# Copy backend Go module files for dependency caching
+COPY backend/go.mod backend/go.sum ./backend/
# Download dependencies with cache mounts
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
- go mod download && go mod verify
+ cd backend && go mod download && go mod verify
# Create directories with proper permissions
RUN mkdir -p /app/data /app/.bin && \
chmod 755 /app/data /app/.bin
+WORKDIR /app/backend
+
EXPOSE 3552
CMD ["air", "-c", ".air.toml"]
diff --git a/docker-compose.dev.yml b/docker/compose.dev.yaml
similarity index 53%
rename from docker-compose.dev.yml
rename to docker/compose.dev.yaml
index 3c69435f9..0f1a1fdf4 100644
--- a/docker-compose.dev.yml
+++ b/docker/compose.dev.yaml
@@ -1,29 +1,23 @@
services:
- # Frontend development service with hot reload
frontend:
build:
- context: .
+ context: ..
dockerfile: docker/Dockerfile.dev
target: frontend-dev
container_name: arcane-frontend-dev
ports:
- "3000:3000"
volumes:
- # Source code mounting for hot reload
- - ${HOST_PROJECT_ROOT:-.}/frontend:/app/frontend:cached
- - ${HOST_PROJECT_ROOT:-.}/package.json:/app/package.json:ro
- - ${HOST_PROJECT_ROOT:-.}/pnpm-workspace.yaml:/app/pnpm-workspace.yaml:ro
- - ${HOST_PROJECT_ROOT:-.}/pnpm-lock.yaml:/app/pnpm-lock.yaml:ro
- # Anonymous volumes for node_modules to avoid conflicts
+ - ${HOST_PROJECT_ROOT:-..}/frontend:/app/frontend:cached
+ - ${HOST_PROJECT_ROOT:-..}/package.json:/app/package.json:ro
+ - ${HOST_PROJECT_ROOT:-..}/pnpm-workspace.yaml:/app/pnpm-workspace.yaml:ro
+ - ${HOST_PROJECT_ROOT:-..}/pnpm-lock.yaml:/app/pnpm-lock.yaml:ro
- /app/node_modules
- /app/frontend/node_modules
- # Persistent pnpm cache
- pnpm-cache:/root/.local/share/pnpm/store
- env_file:
- - .env
environment:
- NODE_ENV=development
- - DEV_BACKEND_URL=${DEV_BACKEND_URL:-http://backend:3552}
+ - DEV_BACKEND_URL=http://backend:3552
depends_on:
- backend
networks:
@@ -37,10 +31,9 @@ services:
retries: 3
start_period: 40s
- # Backend development service with hot reload
backend:
build:
- context: .
+ context: ..
dockerfile: docker/Dockerfile.dev
target: backend-dev
args:
@@ -48,28 +41,28 @@ services:
container_name: arcane-backend-dev
ports:
- "3552:3552"
- # deploy:
- # resources:
- # limits:
- # memory: 256M
volumes:
- # Source code mounting for hot reload
- - ${HOST_PROJECT_ROOT:-.}/backend:/app:cached
- - ${HOST_PROJECT_ROOT:-.}/backend/.air.toml:/app/.air.toml:ro
- # Docker socket for container management
+ - ${HOST_PROJECT_ROOT:-..}/go.work:/app/go.work:ro
+ - ${HOST_PROJECT_ROOT:-..}/types:/app/types:cached
+ - ${HOST_PROJECT_ROOT:-..}/cli:/app/cli:cached
+ - ${HOST_PROJECT_ROOT:-..}/backend:/app/backend:cached
+ - ${HOST_PROJECT_ROOT:-..}/backend/.air.toml:/app/backend/.air.toml:ro
- /var/run/docker.sock:/var/run/docker.sock
- # Persistent data storage
- - arcane-dev-data:/app/data
- # Persistent Go build cache
+ - arcane-dev-data:/app/backend/data
- go-build-cache:/go/cache
- go-mod-cache:/go/pkg/mod
- env_file:
- - .env
environment:
- - PORT=${PORT:-3552}
- - PUID=${PUID:-1000}
- - PGID=${PGID:-1000}
- working_dir: /app
+ - GIN_MODE=debug
+ - ENVIRONMENT=development
+ - PORT=3552
+ - APP_URL=http://localhost:3000
+ - PUID=1000
+ - PGID=1000
+ - UI_CONFIGURATION_DISABLED=true
+ - ENCRYPTION_KEY=dev-encryption-key-replace-in-production-must-be-32-chars
+ - JWT_SECRET=dev-jwt-secret-replace-in-production-must-be-long-enough
+ - DATABASE_URL=file:data/arcane.db?_pragma=journal_mode(WAL)&_pragma=busy_timeout(2500)&_txlock=immediate
+ working_dir: /app/backend
networks:
- arcane-dev
restart: unless-stopped
@@ -86,7 +79,7 @@ services:
arcane-agent:
build:
- context: .
+ context: ..
dockerfile: docker/Dockerfile.dev
target: backend-dev
args:
@@ -94,21 +87,26 @@ services:
container_name: arcane-agent
ports:
- "3553:3553"
- env_file:
- - .env
environment:
+ - GIN_MODE=debug
+ - ENVIRONMENT=development
- PORT=3553
- AGENT_MODE=true
- - AGENT_BOOTSTRAP_TOKEN=${AGENT_BOOTSTRAP_TOKEN:-development-bootstrap-token}
+ - AGENT_BOOTSTRAP_TOKEN=development-bootstrap-token
+ - ENCRYPTION_KEY=dev-encryption-key-replace-in-production-must-be-32-chars
+ - JWT_SECRET=dev-jwt-secret-replace-in-production-must-be-long-enough
+ - DATABASE_URL=file:data/arcane.db?_pragma=journal_mode(WAL)&_pragma=busy_timeout(2500)&_txlock=immediate
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- - agent-dev-data:/app/data
- # Optional: hot-reload the agent too (same as backend dev)
- - ${HOST_PROJECT_ROOT:-.}/backend:/app:cached
- - ${HOST_PROJECT_ROOT:-.}/backend/.air.toml:/app/.air.toml:ro
- # Shared Go build cache with backend for consistency
+ - agent-dev-data:/app/backend/data
+ - ${HOST_PROJECT_ROOT:-..}/go.work:/app/go.work:ro
+ - ${HOST_PROJECT_ROOT:-..}/types:/app/types:cached
+ - ${HOST_PROJECT_ROOT:-..}/cli:/app/cli:cached
+ - ${HOST_PROJECT_ROOT:-..}/backend:/app/backend:cached
+ - ${HOST_PROJECT_ROOT:-..}/backend/.air.toml:/app/backend/.air.toml:ro
- go-build-cache:/go/cache
- go-mod-cache:/go/pkg/mod
+ working_dir: /app/backend
networks:
- arcane-dev
restart: unless-stopped
diff --git a/examples/compose.agent.yaml b/docker/examples/compose.agent.yaml
similarity index 100%
rename from examples/compose.agent.yaml
rename to docker/examples/compose.agent.yaml
diff --git a/examples/compose.basic.yaml b/docker/examples/compose.basic.yaml
similarity index 100%
rename from examples/compose.basic.yaml
rename to docker/examples/compose.basic.yaml
diff --git a/examples/compose.proxy.yaml b/docker/examples/compose.proxy.yaml
similarity index 100%
rename from examples/compose.proxy.yaml
rename to docker/examples/compose.proxy.yaml
diff --git a/frontend/src/app.d.ts b/frontend/src/app.d.ts
index a8c0ee8d3..423343b2f 100644
--- a/frontend/src/app.d.ts
+++ b/frontend/src/app.d.ts
@@ -6,9 +6,9 @@ declare global {
message: string;
status?: number;
}
- interface Locals {
- user?: User | null;
- }
+ // interface Locals {
+ // user?: User | null;
+ // }
// interface PageData {}
// interface PageState {}
// interface Platform {}
diff --git a/frontend/src/lib/components/mobile-nav/mobile-user-card.svelte b/frontend/src/lib/components/mobile-nav/mobile-user-card.svelte
index 4b63665ff..4418ad413 100644
--- a/frontend/src/lib/components/mobile-nav/mobile-user-card.svelte
+++ b/frontend/src/lib/components/mobile-nav/mobile-user-card.svelte
@@ -77,7 +77,7 @@
>
<ChevronDownIcon class="size-4" />
</div>
- <form action="/auth/logout" method="POST">
+ <form action="/logout" method="POST">
<Button.Root
variant="ghost"
size="icon"
diff --git a/frontend/src/lib/components/sidebar/sidebar.svelte b/frontend/src/lib/components/sidebar/sidebar.svelte
index faca2202f..f7ea970ff 100644
--- a/frontend/src/lib/components/sidebar/sidebar.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar.svelte
@@ -94,7 +94,7 @@
<div class="px-3 pb-2">
<div class="flex items-center gap-2">
<SidebarUser {isCollapsed} user={effectiveUser} />
- <form action="/auth/logout" method="POST" class="ml-auto">
+ <form action="/logout" method="POST" class="ml-auto">
<Button.Root
variant="ghost"
title={m.common_logout()}
diff --git a/frontend/src/lib/hooks/index.ts b/frontend/src/lib/hooks/index.ts
new file mode 100644
index 000000000..7a285e1e1
--- /dev/null
+++ b/frontend/src/lib/hooks/index.ts
@@ -0,0 +1,6 @@
+export { IsMobile } from './is-mobile.svelte';
+export { IsTablet } from './is-tablet.svelte';
+export { UseClipboard } from './use-clipboard.svelte';
+export { useEnvironmentRefresh } from './use-environment-refresh.svelte';
+export { ScrollDirectionDetector, type ScrollDirection } from './use-scroll-direction.svelte';
+export { UseSettingsForm } from './use-settings-form.svelte';
diff --git a/frontend/src/lib/hooks/use-environment-refresh.svelte.ts b/frontend/src/lib/hooks/use-environment-refresh.svelte.ts
new file mode 100644
index 000000000..20d0bf0d9
--- /dev/null
+++ b/frontend/src/lib/hooks/use-environment-refresh.svelte.ts
@@ -0,0 +1,24 @@
+import { environmentStore } from '$lib/stores/environment.store.svelte';
+
+/**
+ * Creates an effect that triggers a callback when the environment changes.
+ * Returns a cleanup function and tracks the last environment ID internally.
+ */
+export function useEnvironmentRefresh(onRefresh: () => void | Promise<void>) {
+ let lastEnvId: string | null = $state(null);
+
+ $effect(() => {
+ const env = environmentStore.selected;
+ if (!env) return;
+
+ if (lastEnvId === null) {
+ lastEnvId = env.id;
+ return;
+ }
+
+ if (env.id !== lastEnvId) {
+ lastEnvId = env.id;
+ onRefresh();
+ }
+ });
+}
diff --git a/frontend/src/lib/services/api-service.ts b/frontend/src/lib/services/api-service.ts
index 127e2ba7b..76c9c240e 100644
--- a/frontend/src/lib/services/api-service.ts
+++ b/frontend/src/lib/services/api-service.ts
@@ -76,7 +76,7 @@ abstract class BaseAPIService {
const isAuthApi = skipAuthPaths.some((p) => reqUrl.startsWith(p));
const pathname = window.location.pathname || '/';
- const isOnAuthPage = pathname.startsWith('/auth');
+ const isOnAuthPage = pathname.startsWith('/login') || pathname.startsWith('/logout') || pathname.startsWith('/oidc');
if (!isAuthApi && !isOnAuthPage && !isVersionMismatch && BaseAPIService.tokenRefreshHandler) {
try {
@@ -92,7 +92,7 @@ abstract class BaseAPIService {
// If we reach here, refresh failed - redirect to login
if (!isOnAuthPage) {
const redirectTo = encodeURIComponent(pathname);
- window.location.replace(`/auth/login?redirect=${redirectTo}`);
+ window.location.replace(`/login?redirect=${redirectTo}`);
return new Promise(() => {});
}
}
@@ -100,7 +100,7 @@ abstract class BaseAPIService {
if (!isAuthApi && !isOnAuthPage && isVersionMismatch) {
toast.info('Application has been updated. Please log in again.');
const redirectTo = encodeURIComponent(pathname);
- window.location.replace(`/auth/login?redirect=${redirectTo}`);
+ window.location.replace(`/login?redirect=${redirectTo}`);
return new Promise(() => {});
}
}
diff --git a/frontend/src/lib/types/project.type.ts b/frontend/src/lib/types/project.type.ts
index 9ccc4bcec..deebd7d9d 100644
--- a/frontend/src/lib/types/project.type.ts
+++ b/frontend/src/lib/types/project.type.ts
@@ -9,18 +9,39 @@ export interface NetworkSettings {
>;
}
+export interface ServicePort {
+ mode?: string;
+ target: number;
+ published?: string;
+ protocol?: string;
+}
+
+export interface ServiceVolume {
+ type: string;
+ source: string;
+ target: string;
+ read_only?: boolean;
+ volume?: Record<string, any>;
+ bind?: Record<string, any>;
+}
+
export interface ProjectService {
- container_id: string;
- name: string;
- status: string;
+ name?: string;
image?: string;
- ports?: string[];
- networks?: string[];
- volumes?: string[];
+ container_name?: string;
+ command?: string[] | string | null;
+ entrypoint?: string[] | string | null;
environment?: Record<string, string>;
- restart_count?: number;
- health?: string;
- networkSettings?: NetworkSettings;
+ env_file?: string[];
+ ports?: ServicePort[];
+ volumes?: ServiceVolume[];
+ networks?: Record<string, any>;
+ restart?: string;
+ depends_on?: Record<string, any>;
+ labels?: Record<string, string>;
+ healthcheck?: Record<string, any>;
+ deploy?: Record<string, any>;
+ [key: string]: any;
}
export interface IncludeFile {
@@ -29,6 +50,17 @@ export interface IncludeFile {
content: string;
}
+// RuntimeService contains live container status information
+export interface RuntimeService {
+ name: string;
+ image: string;
+ status: string;
+ containerId?: string;
+ containerName?: string;
+ ports?: string[];
+ health?: string;
+}
+
export interface Project {
id: string;
name: string;
@@ -40,6 +72,7 @@ export interface Project {
updatedAt: string;
createdAt: string;
services?: ProjectService[];
+ runtimeServices?: RuntimeService[];
composeContent?: string;
envContent?: string;
includeFiles?: IncludeFile[];
diff --git a/frontend/src/lib/utils/redirect.util.ts b/frontend/src/lib/utils/redirect.util.ts
index a88424fb8..92af7828e 100644
--- a/frontend/src/lib/utils/redirect.util.ts
+++ b/frontend/src/lib/utils/redirect.util.ts
@@ -25,18 +25,18 @@ export function getAuthRedirectPath(path: string, user: User | null) {
const isSignedIn = !!user;
const isUnauthenticatedOnlyPath =
- path === '/auth/login' ||
- path.startsWith('/auth/login/') ||
- path === '/auth/oidc/login' ||
- path.startsWith('/auth/oidc/login') ||
- path === '/auth/oidc/callback' ||
- path.startsWith('/auth/oidc/callback') ||
+ path === '/login' ||
+ path.startsWith('/login/') ||
+ path === '/oidc/login' ||
+ path.startsWith('/oidc/login') ||
+ path === '/oidc/callback' ||
+ path.startsWith('/oidc/callback') ||
path === '/img' ||
path.startsWith('/img') ||
path === '/favicon.ico';
if (!isSignedIn && isProtectedPath(path)) {
- return '/auth/login';
+ return '/login';
}
if (isUnauthenticatedOnlyPath && isSignedIn) {
@@ -44,7 +44,7 @@ export function getAuthRedirectPath(path: string, user: User | null) {
}
if (path === '/') {
- return isSignedIn ? '/dashboard' : '/auth/login';
+ return isSignedIn ? '/dashboard' : '/login';
}
return null;
diff --git a/frontend/src/lib/utils/refresh.util.ts b/frontend/src/lib/utils/refresh.util.ts
new file mode 100644
index 000000000..3a7216bbc
--- /dev/null
+++ b/frontend/src/lib/utils/refresh.util.ts
@@ -0,0 +1,64 @@
+import { toast } from 'svelte-sonner';
+import { tryCatch } from '$lib/utils/try-catch';
+import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
+
+export interface RefreshTask<T> {
+ fetch: () => Promise<T>;
+ onSuccess: (data: T) => void;
+ errorMessage: string;
+}
+
+/**
+ * Executes multiple refresh tasks in parallel with unified loading state management.
+ *
+ * @param tasks - Array of refresh tasks to execute
+ * @param setLoading - Callback to update loading state
+ */
+export async function parallelRefresh<T extends Record<string, RefreshTask<any>>>(
+ tasks: T,
+ setLoading: (loading: boolean) => void
+): Promise<void> {
+ setLoading(true);
+
+ const taskKeys = Object.keys(tasks);
+ const completionStatus = Object.fromEntries(taskKeys.map(k => [k, true]));
+
+ const updateLoading = (key: string, value: boolean) => {
+ completionStatus[key] = value;
+ const stillLoading = Object.values(completionStatus).some(v => v);
+ setLoading(stillLoading);
+ };
+
+ await Promise.all(
+ taskKeys.map(async (key) => {
+ const task = tasks[key];
+ handleApiResultWithCallbacks({
+ result: await tryCatch(task.fetch()),
+ message: task.errorMessage,
+ setLoadingState: (value) => updateLoading(key, value),
+ onSuccess: task.onSuccess
+ });
+ })
+ );
+}
+
+/**
+ * Simple refresh helper for single data fetch with error handling
+ */
+export async function simpleRefresh<T>(
+ fetch: () => Promise<T>,
+ onSuccess: (data: T) => void,
+ errorMessage: string,
+ setLoading: (loading: boolean) => void
+): Promise<void> {
+ setLoading(true);
+ try {
+ const data = await fetch();
+ onSuccess(data);
+ } catch (error) {
+ console.error('Refresh failed:', error);
+ toast.error(errorMessage);
+ } finally {
+ setLoading(false);
+ }
+}
diff --git a/frontend/src/lib/utils/settings-form.util.ts b/frontend/src/lib/utils/settings-form.util.ts
new file mode 100644
index 000000000..3288ae7bd
--- /dev/null
+++ b/frontend/src/lib/utils/settings-form.util.ts
@@ -0,0 +1,97 @@
+import { z } from 'zod/v4';
+import { createForm } from '$lib/utils/form.utils';
+import { UseSettingsForm } from '$lib/hooks/use-settings-form.svelte';
+import { toast } from 'svelte-sonner';
+import { get, type Writable } from 'svelte/store';
+
+type FormInput<T> = { value: T; error: string | null };
+type FormInputs<T> = { [K in keyof T]: FormInput<T[K]> };
+
+export interface SettingsFormConfig<T extends z.ZodType<any, any>> {
+ schema: T;
+ currentSettings: z.infer<T>;
+ onSuccess?: () => void;
+ onReset?: () => void;
+ successMessage?: string;
+ errorMessage?: string;
+}
+
+/**
+ * Creates a complete settings form with automatic change detection and save/reset handling.
+ *
+ * Usage:
+ * ```ts
+ * const { formInputs, form, settingsForm, registerOnMount } = createSettingsForm({
+ * schema: formSchema,
+ * currentSettings,
+ * successMessage: m.general_settings_saved(),
+ * onReset: () => applyAccentColor(currentSettings.accentColor)
+ * });
+ *
+ * onMount(() => registerOnMount());
+ * ```
+ */
+export function createSettingsForm<T extends z.ZodType<any, any>>(config: SettingsFormConfig<T>) {
+ const {
+ schema,
+ currentSettings,
+ onSuccess,
+ onReset,
+ successMessage = 'Settings saved',
+ errorMessage = 'Failed to save settings'
+ } = config;
+
+ const { inputs: formInputs, ...form } = createForm(schema, currentSettings);
+
+ const hasChangesChecker = () => {
+ const current = get(formInputs);
+ const keys = Object.keys(currentSettings) as (keyof z.infer<T>)[];
+ return keys.some(key => {
+ const input = current[key];
+ if (input && 'value' in input) {
+ return input.value !== currentSettings[key];
+ }
+ return false;
+ });
+ };
+
+ const settingsForm = new UseSettingsForm({ hasChangesChecker });
+
+ const onSubmit = async () => {
+ const data = form.validate();
+ if (!data) {
+ toast.error('Please check the form for errors');
+ return;
+ }
+ settingsForm.setLoading(true);
+
+ try {
+ await settingsForm.updateSettings(data);
+ toast.success(successMessage);
+ onSuccess?.();
+ } catch (error) {
+ console.error('Failed to save settings:', error);
+ toast.error(errorMessage);
+ } finally {
+ settingsForm.setLoading(false);
+ }
+ };
+
+ const resetForm = () => {
+ form.reset();
+ onReset?.();
+ };
+
+ const registerOnMount = () => {
+ settingsForm.registerFormActions(onSubmit, resetForm);
+ };
+
+ return {
+ formInputs: formInputs as Writable<FormInputs<z.infer<T>>>,
+ form,
+ settingsForm,
+ onSubmit,
+ resetForm,
+ registerOnMount
+ };
+}
diff --git a/frontend/src/routes/(app)/+layout.svelte b/frontend/src/routes/(app)/+layout.svelte
new file mode 100644
index 000000000..c706ed857
--- /dev/null
+++ b/frontend/src/routes/(app)/+layout.svelte
@@ -0,0 +1,85 @@
+<script lang="ts">
+ import { page } from '$app/state';
+ import { goto, afterNavigate } from '$app/navigation';
+ import { getAuthRedirectPath } from '$lib/utils/redirect.util';
+ import * as Sidebar from '$lib/components/ui/sidebar/index.js';
+ import AppSidebar from '$lib/components/sidebar/sidebar.svelte';
+ import MobileNav from '$lib/components/mobile-nav/mobile-nav.svelte';
+ import { IsMobile } from '$lib/hooks/is-mobile.svelte.js';
+ import { IsTablet } from '$lib/hooks/is-tablet.svelte.js';
+ import { getEffectiveNavigationSettings, navigationSettingsOverridesStore } from '$lib/utils/navigation.utils';
+ import { browser } from '$app/environment';
+ import { cn } from '$lib/utils';
+ import type { Snippet } from 'svelte';
+ import type { LayoutData } from './$types';
+
+ let {
+ data,
+ children
+ }: {
+ data: LayoutData;
+ children: Snippet;
+ } = $props();
+
+ const versionInformation = $derived(data.versionInformation);
+ const user = $derived(data.user);
+ const settings = $derived(data.settings);
+
+ const isMobile = new IsMobile();
+ const isTablet = new IsTablet();
+
+ const navigationSettings = $derived.by(() => {
+ settings;
+ navigationSettingsOverridesStore.current;
+ return getEffectiveNavigationSettings();
+ });
+ const navigationMode = $derived(navigationSettings.mode);
+
+ $effect(() => {
+ const redirectPath = getAuthRedirectPath(page.url.pathname, user);
+ if (redirectPath) {
+ goto(redirectPath);
+ }
+ });
+
+ if (browser) {
+ afterNavigate((event) => {
+ if (!event.from) {
+ return;
+ }
+
+ if (isMobile.current || isTablet.current) {
+ window.scrollTo({ top: 0, left: 0, behavior: 'auto' });
+ }
+ });
+ }
+</script>
+
+{#if isMobile.current}
+ <main class="flex-1">
+ <section
+ class={cn(
+ 'px-2',
+ navigationMode === 'docked'
+ ? navigationSettings.scrollToHide
+ ? 'pt-5 sm:px-5 sm:pt-5'
+ : 'pt-5 pb-(--mobile-docked-nav-offset,calc(3.5rem+env(safe-area-inset-bottom))) sm:p-5'
+ : navigationSettings.scrollToHide
+ ? 'py-5 sm:p-5'
+ : 'py-5 pb-(--mobile-floating-nav-offset,6rem) sm:p-5'
+ )}
+ >
+ {@render children()}
+ </section>
+ </main>
+ <MobileNav {navigationSettings} {user} {versionInformation} />
+{:else}
+ <Sidebar.Provider>
+ <AppSidebar {versionInformation} {user} />
+ <main class="flex-1">
+ <section class="p-5">
+ {@render children()}
+ </section>
+ </main>
+ </Sidebar.Provider>
+{/if}
diff --git a/frontend/src/routes/containers/+page.svelte b/frontend/src/routes/(app)/containers/+page.svelte
similarity index 64%
rename from frontend/src/routes/containers/+page.svelte
rename to frontend/src/routes/(app)/containers/+page.svelte
index 738520a25..3a62aabb0 100644
--- a/frontend/src/routes/containers/+page.svelte
+++ b/frontend/src/routes/(app)/containers/+page.svelte
@@ -7,87 +7,59 @@
import { containerService } from '$lib/services/container-service';
import ContainerTable from './container-table.svelte';
import { m } from '$lib/paraglide/messages';
- import { environmentStore } from '$lib/stores/environment.store.svelte';
import { imageService } from '$lib/services/image-service';
import { untrack } from 'svelte';
import { ResourcePageLayout, type ActionButton, type StatCardConfig } from '$lib/layouts/index.js';
+ import { useEnvironmentRefresh } from '$lib/hooks/use-environment-refresh.svelte';
+ import { parallelRefresh } from '$lib/utils/refresh.util';
let { data } = $props();
let containers = $state(untrack(() => data.containers));
let containerStatusCounts = $state(untrack(() => data.containerStatusCounts));
- let containerRequestOptions = $state(untrack(() => data.containerRequestOptions));
-
let requestOptions = $state(untrack(() => data.containerRequestOptions));
let selectedIds = $state([]);
let isCreateDialogOpen = $state(false);
-
- let isLoading = $state({
- checking: false,
- create: false,
- refreshing: false
- });
+ let isLoading = $state({ checking: false, create: false, refreshing: false });
const baseServerUrl = $derived(
(data.settings as any)?.serverBaseUrl ?? (data.settings as any)?.baseServerUrl ?? (data.settings as any)?.baseUrl ?? ''
);
+ async function refresh() {
+ await parallelRefresh(
+ {
+ containers: {
+ fetch: () => containerService.getContainers(requestOptions),
+ onSuccess: (data) => (containers = data),
+ errorMessage: m.common_refresh_failed({ resource: m.containers_title() })
+ },
+ counts: {
+ fetch: () => containerService.getContainerStatusCounts(),
+ onSuccess: (data) => (containerStatusCounts = data),
+ errorMessage: m.common_refresh_failed({ resource: m.containers_title() })
+ }
+ },
+ (v) => (isLoading.refreshing = v)
+ );
+ }
+
+ useEnvironmentRefresh(refresh);
+
async function handleCheckForUpdates() {
isLoading.checking = true;
handleApiResultWithCallbacks({
result: await tryCatch(imageService.runAutoUpdate()),
message: m.containers_check_updates_failed(),
- setLoadingState: (value) => (isLoading.checking = value),
- async onSuccess() {
+ setLoadingState: (v) => (isLoading.checking = v),
+ onSuccess: async () => {
toast.success(m.containers_check_updates_success());
containers = await containerService.getContainers(requestOptions);
}
});
}
- async function refreshContainers() {
- isLoading.refreshing = true;
- let refreshingContainerList = true;
- let refreshingContainerCounts = true;
- handleApiResultWithCallbacks({
- result: await tryCatch(containerService.getContainers(requestOptions)),
- message: m.common_refresh_failed({ resource: m.containers_title() }),
- setLoadingState: (value) => {
- refreshingContainerList = value;
- isLoading.refreshing = refreshingContainerCounts || refreshingContainerList;
- },
- async onSuccess(newContainers) {
- containers = newContainers;
- }
- });
- handleApiResultWithCallbacks({
- result: await tryCatch(containerService.getContainerStatusCounts()),
- message: m.common_refresh_failed({ resource: m.containers_title() }),
- setLoadingState: (value) => {
- refreshingContainerCounts = value;
- isLoading.refreshing = refreshingContainerCounts || refreshingContainerList;
- },
- async onSuccess(newStatusCounts) {
- containerStatusCounts = newStatusCounts;
- }
- });
- }
-
- let lastEnvId: string | null = null;
- $effect(() => {
- const env = environmentStore.selected;
- if (!env) return;
- if (lastEnvId === null) {
- lastEnvId = env.id;
- return;
- }
- if (env.id !== lastEnvId) {
- lastEnvId = env.id;
- refreshContainers();
- }
- });
-
- const actionButtons: ActionButton[] = $derived.by(() => [
+ const actionButtons: ActionButton[] = $derived([
{
id: 'create',
action: 'create',
@@ -108,7 +80,7 @@
id: 'refresh',
action: 'restart',
label: m.common_refresh(),
- onclick: refreshContainers,
+ onclick: refresh,
loading: isLoading.refreshing,
disabled: isLoading.refreshing
}
@@ -119,7 +91,7 @@
title: m.common_total(),
value: containerStatusCounts.totalContainers,
icon: BoxIcon,
- class: 'border-l-primary border-l-4 transition-shadow hover:shadow-lg'
+ class: 'border-l-primary border-l-4'
},
{
title: m.common_running(),
@@ -139,13 +111,7 @@
]);
</script>
-<ResourcePageLayout
- title={m.containers_title()}
- subtitle={m.containers_subtitle()}
- {actionButtons}
- {statCards}
- statCardsColumns={3}
->
+<ResourcePageLayout title={m.containers_title()} subtitle={m.containers_subtitle()} {actionButtons} {statCards} statCardsColumns={3}>
{#snippet mainContent()}
<ContainerTable bind:containers bind:selectedIds bind:requestOptions {baseServerUrl} />
{/snippet}
@@ -162,7 +128,7 @@
handleApiResultWithCallbacks({
result: await tryCatch(containerService.createContainer(options)),
message: m.containers_create_failed(),
- setLoadingState: (value) => (isLoading.create = value),
+ setLoadingState: (v) => (isLoading.create = v),
onSuccess: async () => {
toast.success(m.common_create_success({ resource: m.resource_container() }));
containers = await containerService.getContainers(requestOptions);
diff --git a/frontend/src/routes/containers/+page.ts b/frontend/src/routes/(app)/containers/+page.ts
similarity index 100%
rename from frontend/src/routes/containers/+page.ts
rename to frontend/src/routes/(app)/containers/+page.ts
diff --git a/frontend/src/routes/containers/[containerId]/+page.svelte b/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
similarity index 100%
rename from frontend/src/routes/containers/[containerId]/+page.svelte
rename to frontend/src/routes/(app)/containers/[containerId]/+page.svelte
diff --git a/frontend/src/routes/containers/[containerId]/+page.ts b/frontend/src/routes/(app)/containers/[containerId]/+page.ts
similarity index 100%
rename from frontend/src/routes/containers/[containerId]/+page.ts
rename to frontend/src/routes/(app)/containers/[containerId]/+page.ts
diff --git a/frontend/src/routes/containers/components/ContainerConfiguration.svelte b/frontend/src/routes/(app)/containers/components/ContainerConfiguration.svelte
similarity index 100%
rename from frontend/src/routes/containers/components/ContainerConfiguration.svelte
rename to frontend/src/routes/(app)/containers/components/ContainerConfiguration.svelte
diff --git a/frontend/src/routes/containers/components/ContainerLogsPanel.svelte b/frontend/src/routes/(app)/containers/components/ContainerLogsPanel.svelte
similarity index 100%
rename from frontend/src/routes/containers/components/ContainerLogsPanel.svelte
rename to frontend/src/routes/(app)/containers/components/ContainerLogsPanel.svelte
diff --git a/frontend/src/routes/containers/components/ContainerNetwork.svelte b/frontend/src/routes/(app)/containers/components/ContainerNetwork.svelte
similarity index 100%
rename from frontend/src/routes/containers/components/ContainerNetwork.svelte
rename to frontend/src/routes/(app)/containers/components/ContainerNetwork.svelte
diff --git a/frontend/src/routes/containers/components/ContainerOverview.svelte b/frontend/src/routes/(app)/containers/components/ContainerOverview.svelte
similarity index 100%
rename from frontend/src/routes/containers/components/ContainerOverview.svelte
rename to frontend/src/routes/(app)/containers/components/ContainerOverview.svelte
diff --git a/frontend/src/routes/containers/components/ContainerShell.svelte b/frontend/src/routes/(app)/containers/components/ContainerShell.svelte
similarity index 100%
rename from frontend/src/routes/containers/components/ContainerShell.svelte
rename to frontend/src/routes/(app)/containers/components/ContainerShell.svelte
diff --git a/frontend/src/routes/containers/components/ContainerStats.svelte b/frontend/src/routes/(app)/containers/components/ContainerStats.svelte
similarity index 100%
rename from frontend/src/routes/containers/components/ContainerStats.svelte
rename to frontend/src/routes/(app)/containers/components/ContainerStats.svelte
diff --git a/frontend/src/routes/containers/components/ContainerStorage.svelte b/frontend/src/routes/(app)/containers/components/ContainerStorage.svelte
similarity index 100%
rename from frontend/src/routes/containers/components/ContainerStorage.svelte
rename to frontend/src/routes/(app)/containers/components/ContainerStorage.svelte
diff --git a/frontend/src/routes/containers/container-table.svelte b/frontend/src/routes/(app)/containers/container-table.svelte
similarity index 100%
rename from frontend/src/routes/containers/container-table.svelte
rename to frontend/src/routes/(app)/containers/container-table.svelte
diff --git a/frontend/src/routes/customize/+page.svelte b/frontend/src/routes/(app)/customize/+page.svelte
similarity index 100%
rename from frontend/src/routes/customize/+page.svelte
rename to frontend/src/routes/(app)/customize/+page.svelte
diff --git a/frontend/src/routes/customize/registries/+page.svelte b/frontend/src/routes/(app)/customize/registries/+page.svelte
similarity index 100%
rename from frontend/src/routes/customize/registries/+page.svelte
rename to frontend/src/routes/(app)/customize/registries/+page.svelte
diff --git a/frontend/src/routes/customize/registries/+page.ts b/frontend/src/routes/(app)/customize/registries/+page.ts
similarity index 100%
rename from frontend/src/routes/customize/registries/+page.ts
rename to frontend/src/routes/(app)/customize/registries/+page.ts
diff --git a/frontend/src/routes/customize/registries/registry-table.svelte b/frontend/src/routes/(app)/customize/registries/registry-table.svelte
similarity index 100%
rename from frontend/src/routes/customize/registries/registry-table.svelte
rename to frontend/src/routes/(app)/customize/registries/registry-table.svelte
diff --git a/frontend/src/routes/customize/templates/+page.svelte b/frontend/src/routes/(app)/customize/templates/+page.svelte
similarity index 100%
rename from frontend/src/routes/customize/templates/+page.svelte
rename to frontend/src/routes/(app)/customize/templates/+page.svelte
diff --git a/frontend/src/routes/customize/templates/+page.ts b/frontend/src/routes/(app)/customize/templates/+page.ts
similarity index 100%
rename from frontend/src/routes/customize/templates/+page.ts
rename to frontend/src/routes/(app)/customize/templates/+page.ts
diff --git a/frontend/src/routes/customize/templates/[id]/+page.svelte b/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte
similarity index 100%
rename from frontend/src/routes/customize/templates/[id]/+page.svelte
rename to frontend/src/routes/(app)/customize/templates/[id]/+page.svelte
diff --git a/frontend/src/routes/customize/templates/[id]/+page.ts b/frontend/src/routes/(app)/customize/templates/[id]/+page.ts
similarity index 100%
rename from frontend/src/routes/customize/templates/[id]/+page.ts
rename to frontend/src/routes/(app)/customize/templates/[id]/+page.ts
diff --git a/frontend/src/routes/customize/templates/components/RegistryManager.svelte b/frontend/src/routes/(app)/customize/templates/components/RegistryManager.svelte
similarity index 100%
rename from frontend/src/routes/customize/templates/components/RegistryManager.svelte
rename to frontend/src/routes/(app)/customize/templates/components/RegistryManager.svelte
diff --git a/frontend/src/routes/customize/templates/components/TemplatesBrowser.svelte b/frontend/src/routes/(app)/customize/templates/components/TemplatesBrowser.svelte
similarity index 100%
rename from frontend/src/routes/customize/templates/components/TemplatesBrowser.svelte
rename to frontend/src/routes/(app)/customize/templates/components/TemplatesBrowser.svelte
diff --git a/frontend/src/routes/customize/templates/default/+page.svelte b/frontend/src/routes/(app)/customize/templates/default/+page.svelte
similarity index 100%
rename from frontend/src/routes/customize/templates/default/+page.svelte
rename to frontend/src/routes/(app)/customize/templates/default/+page.svelte
diff --git a/frontend/src/routes/customize/templates/default/+page.ts b/frontend/src/routes/(app)/customize/templates/default/+page.ts
similarity index 100%
rename from frontend/src/routes/customize/templates/default/+page.ts
rename to frontend/src/routes/(app)/customize/templates/default/+page.ts
diff --git a/frontend/src/routes/customize/templates/template-table.svelte b/frontend/src/routes/(app)/customize/templates/template-table.svelte
similarity index 100%
rename from frontend/src/routes/customize/templates/template-table.svelte
rename to frontend/src/routes/(app)/customize/templates/template-table.svelte
diff --git a/frontend/src/routes/customize/variables/+page.svelte b/frontend/src/routes/(app)/customize/variables/+page.svelte
similarity index 100%
rename from frontend/src/routes/customize/variables/+page.svelte
rename to frontend/src/routes/(app)/customize/variables/+page.svelte
diff --git a/frontend/src/routes/customize/variables/+page.ts b/frontend/src/routes/(app)/customize/variables/+page.ts
similarity index 100%
rename from frontend/src/routes/customize/variables/+page.ts
rename to frontend/src/routes/(app)/customize/variables/+page.ts
diff --git a/frontend/src/routes/dashboard/+page.svelte b/frontend/src/routes/(app)/dashboard/+page.svelte
similarity index 100%
rename from frontend/src/routes/dashboard/+page.svelte
rename to frontend/src/routes/(app)/dashboard/+page.svelte
diff --git a/frontend/src/routes/dashboard/+page.ts b/frontend/src/routes/(app)/dashboard/+page.ts
similarity index 100%
rename from frontend/src/routes/dashboard/+page.ts
rename to frontend/src/routes/(app)/dashboard/+page.ts
diff --git a/frontend/src/routes/dashboard/dash-container-table.svelte b/frontend/src/routes/(app)/dashboard/dash-container-table.svelte
similarity index 100%
rename from frontend/src/routes/dashboard/dash-container-table.svelte
rename to frontend/src/routes/(app)/dashboard/dash-container-table.svelte
diff --git a/frontend/src/routes/dashboard/dash-image-table.svelte b/frontend/src/routes/(app)/dashboard/dash-image-table.svelte
similarity index 100%
rename from frontend/src/routes/dashboard/dash-image-table.svelte
rename to frontend/src/routes/(app)/dashboard/dash-image-table.svelte
diff --git a/frontend/src/routes/environments/+page.svelte b/frontend/src/routes/(app)/environments/+page.svelte
similarity index 64%
rename from frontend/src/routes/environments/+page.svelte
rename to frontend/src/routes/(app)/environments/+page.svelte
index b2ccc64c1..1f25e3b6d 100644
--- a/frontend/src/routes/environments/+page.svelte
+++ b/frontend/src/routes/(app)/environments/+page.svelte
@@ -1,5 +1,4 @@
<script lang="ts">
- import ServerIcon from '@lucide/svelte/icons/server';
import { toast } from 'svelte-sonner';
import NewEnvironmentSheet from '$lib/components/sheets/new-environment-sheet.svelte';
import EnvironmentTable from './environment-table.svelte';
@@ -9,8 +8,9 @@
import { m } from '$lib/paraglide/messages';
import { environmentManagementService } from '$lib/services/env-mgmt-service';
import { untrack } from 'svelte';
- import { ResourcePageLayout, type ActionButton, type StatCardConfig } from '$lib/layouts/index.js';
+ import { ResourcePageLayout, type ActionButton } from '$lib/layouts/index.js';
import { environmentStore } from '$lib/stores/environment.store.svelte';
+ import { simpleRefresh } from '$lib/utils/refresh.util';
let { data } = $props();
@@ -18,23 +18,15 @@
let selectedIds = $state<string[]>([]);
let requestOptions = $state(untrack(() => data.environmentRequestOptions));
let showEnvironmentSheet = $state(false);
-
- let isLoading = $state({
- refresh: false,
- creating: false,
- deleting: false
- });
+ let isLoading = $state({ refresh: false, creating: false, deleting: false });
async function refresh() {
- isLoading.refresh = true;
- try {
- environments = await environmentManagementService.getEnvironments(requestOptions);
- } catch (err) {
- console.error('Failed to refresh environments:', err);
- toast.error(m.common_refresh_failed({ resource: m.environments_title() }));
- } finally {
- isLoading.refresh = false;
- }
+ await simpleRefresh(
+ () => environmentManagementService.getEnvironments(requestOptions),
+ (data) => (environments = data),
+ m.common_refresh_failed({ resource: m.environments_title() }),
+ (v) => (isLoading.refresh = v)
+ );
}
async function handleBulkDelete() {
@@ -57,26 +49,20 @@
result,
message: m.common_bulk_remove_failed({ count: selectedIds.length, resource: m.environments_title() }),
setLoadingState: () => {},
- onSuccess: () => {
- successCount += 1;
- }
+ onSuccess: () => { successCount += 1; }
});
if (result.error) failureCount += 1;
}
isLoading.deleting = false;
-
if (successCount > 0) {
- const msg = m.common_bulk_remove_success({ count: successCount, resource: m.environments_title() });
- toast.success(msg);
+ toast.success(m.common_bulk_remove_success({ count: successCount, resource: m.environments_title() }));
await refresh();
await environmentStore.initialize(environments.data);
}
if (failureCount > 0) {
- const msg = m.common_bulk_remove_failed({ count: failureCount, resource: m.environments_title() });
- toast.error(msg);
+ toast.error(m.common_bulk_remove_failed({ count: failureCount, resource: m.environments_title() }));
}
-
selectedIds = [];
}
}
@@ -88,36 +74,14 @@
environments = await environmentManagementService.getEnvironments(requestOptions);
await environmentStore.initialize(environments.data);
toast.success(m.common_create_success({ resource: m.resource_environment() }));
- refresh();
}
const actionButtons: ActionButton[] = $derived([
...(selectedIds.length > 0
- ? [
- {
- id: 'remove-selected',
- action: 'remove' as const,
- label: m.environments_remove_selected_button(),
- onclick: handleBulkDelete,
- loading: isLoading.deleting,
- disabled: isLoading.deleting
- }
- ]
+ ? [{ id: 'remove-selected', action: 'remove' as const, label: m.environments_remove_selected_button(), onclick: handleBulkDelete, loading: isLoading.deleting, disabled: isLoading.deleting }]
: []),
- {
- id: 'create',
- action: 'create' as const,
- label: m.common_add_button({ resource: m.resource_environment_cap() }),
- onclick: () => (showEnvironmentSheet = true)
- },
- {
- id: 'refresh',
- action: 'restart' as const,
- label: m.common_refresh(),
- onclick: refresh,
- loading: isLoading.refresh,
- disabled: isLoading.refresh
- }
+ { id: 'create', action: 'create' as const, label: m.common_add_button({ resource: m.resource_environment_cap() }), onclick: () => (showEnvironmentSheet = true) },
+ { id: 'refresh', action: 'restart' as const, label: m.common_refresh(), onclick: refresh, loading: isLoading.refresh, disabled: isLoading.refresh }
]);
</script>
diff --git a/frontend/src/routes/environments/+page.ts b/frontend/src/routes/(app)/environments/+page.ts
similarity index 100%
rename from frontend/src/routes/environments/+page.ts
rename to frontend/src/routes/(app)/environments/+page.ts
diff --git a/frontend/src/routes/environments/[id]/+page.svelte b/frontend/src/routes/(app)/environments/[id]/+page.svelte
similarity index 100%
rename from frontend/src/routes/environments/[id]/+page.svelte
rename to frontend/src/routes/(app)/environments/[id]/+page.svelte
diff --git a/frontend/src/routes/environments/[id]/+page.ts b/frontend/src/routes/(app)/environments/[id]/+page.ts
similarity index 100%
rename from frontend/src/routes/environments/[id]/+page.ts
rename to frontend/src/routes/(app)/environments/[id]/+page.ts
diff --git a/frontend/src/routes/environments/environment-table.svelte b/frontend/src/routes/(app)/environments/environment-table.svelte
similarity index 100%
rename from frontend/src/routes/environments/environment-table.svelte
rename to frontend/src/routes/(app)/environments/environment-table.svelte
diff --git a/frontend/src/routes/events/+page.svelte b/frontend/src/routes/(app)/events/+page.svelte
similarity index 50%
rename from frontend/src/routes/events/+page.svelte
rename to frontend/src/routes/(app)/events/+page.svelte
index e3858a973..3cb28ad73 100644
--- a/frontend/src/routes/events/+page.svelte
+++ b/frontend/src/routes/(app)/events/+page.svelte
@@ -3,7 +3,6 @@
import { toast } from 'svelte-sonner';
import { tryCatch } from '$lib/utils/try-catch';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
- import type { PageData } from './$types';
import type { Event } from '$lib/types/event.type';
import EventTable from './event-table.svelte';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
@@ -11,17 +10,14 @@
import { eventService } from '$lib/services/event-service';
import { untrack } from 'svelte';
import { ResourcePageLayout, type ActionButton, type StatCardConfig } from '$lib/layouts/index.js';
+ import { simpleRefresh } from '$lib/utils/refresh.util';
- let { data }: { data: PageData } = $props();
+ let { data } = $props();
let events = $state(untrack(() => data.events));
let selectedIds = $state<string[]>([]);
let requestOptions = $state(untrack(() => data.eventRequestOptions));
-
- let isLoading = $state({
- refreshing: false,
- deleting: false
- });
+ let isLoading = $state({ refreshing: false, deleting: false });
const infoEvents = $derived(events?.data?.filter((e: Event) => e.severity === 'info').length || 0);
const warningEvents = $derived(events?.data?.filter((e: Event) => e.severity === 'warning').length || 0);
@@ -29,16 +25,13 @@
const successEvents = $derived(events?.data?.filter((e: Event) => e.severity === 'success').length || 0);
const totalEvents = $derived(events?.pagination?.totalItems || 0);
- async function refreshEvents() {
- isLoading.refreshing = true;
- try {
- events = await eventService.getEvents(requestOptions);
- } catch (error) {
- console.error('Failed to refresh events:', error);
- toast.error(m.common_refresh_failed({ resource: m.events_title() }));
- } finally {
- isLoading.refreshing = false;
- }
+ async function refresh() {
+ await simpleRefresh(
+ () => eventService.getEvents(requestOptions),
+ (data) => (events = data),
+ m.common_refresh_failed({ resource: m.events_title() }),
+ (v) => (isLoading.refreshing = v)
+ );
}
async function handleDeleteSelected() {
@@ -61,26 +54,19 @@
result,
message: m.events_delete_item_failed({ id: eventId }),
setLoadingState: () => {},
- onSuccess: () => {
- successCount++;
- }
+ onSuccess: () => { successCount++; }
});
-
if (result.error) failureCount++;
}
isLoading.deleting = false;
-
if (successCount > 0) {
- const msg = m.common_bulk_delete_success({ count: successCount, resource: m.events_title() });
- toast.success(msg);
- await refreshEvents();
+ toast.success(m.common_bulk_delete_success({ count: successCount, resource: m.events_title() }));
+ await refresh();
}
if (failureCount > 0) {
- const msg = m.common_bulk_delete_failed({ count: failureCount, resource: m.events_title() });
- toast.error(msg);
+ toast.error(m.common_bulk_delete_failed({ count: failureCount, resource: m.events_title() }));
}
-
selectedIds = [];
}
}
@@ -89,82 +75,21 @@
const actionButtons: ActionButton[] = $derived([
...(selectedIds.length > 0
- ? [
- {
- id: 'remove-selected',
- action: 'remove' as const,
- label: m.events_remove_selected(),
- onclick: handleDeleteSelected,
- loading: isLoading.deleting,
- disabled: isLoading.deleting
- }
- ]
+ ? [{ id: 'remove-selected', action: 'remove' as const, label: m.events_remove_selected(), onclick: handleDeleteSelected, loading: isLoading.deleting, disabled: isLoading.deleting }]
: []),
- {
- id: 'refresh',
- action: 'restart' as const,
- label: m.common_refresh(),
- onclick: refreshEvents,
- loading: isLoading.refreshing,
- disabled: isLoading.refreshing
- }
+ { id: 'refresh', action: 'restart' as const, label: m.common_refresh(), onclick: refresh, loading: isLoading.refreshing, disabled: isLoading.refreshing }
]);
const statCards: StatCardConfig[] = $derived([
- {
- title: m.events_total(),
- value: totalEvents,
- subtitle: m.events_total_subtitle(),
- icon: ActivityIcon,
- class: 'border-l-4 border-l-primary'
- },
- {
- title: m.events_info(),
- value: infoEvents,
- subtitle: m.events_info_subtitle(),
- icon: ActivityIcon,
- iconColor: 'text-blue-500',
- bgColor: 'bg-blue-500/10',
- class: 'border-l-4 border-l-blue-500'
- },
- {
- title: m.events_success(),
- value: successEvents,
- subtitle: m.events_success_subtitle(),
- icon: ActivityIcon,
- iconColor: 'text-green-500',
- bgColor: 'bg-green-500/10',
- class: 'border-l-4 border-l-green-500'
- },
- {
- title: m.events_warning(),
- value: warningEvents,
- subtitle: m.events_warning_subtitle(),
- icon: ActivityIcon,
- iconColor: 'text-yellow-500',
- bgColor: 'bg-yellow-500/10',
- class: 'border-l-4 border-l-yellow-500'
- },
- {
- title: m.events_error(),
- value: errorEvents,
- subtitle: m.events_error_subtitle(),
- icon: ActivityIcon,
- iconColor: 'text-red-500',
- bgColor: 'bg-red-500/10',
- class: 'border-l-4 border-l-red-500'
- }
+ { title: m.events_total(), value: totalEvents, subtitle: m.events_total_subtitle(), icon: ActivityIcon, class: 'border-l-4 border-l-primary' },
+ { title: m.events_info(), value: infoEvents, subtitle: m.events_info_subtitle(), icon: ActivityIcon, iconColor: 'text-blue-500', bgColor: 'bg-blue-500/10', class: 'border-l-4 border-l-blue-500' },
+ { title: m.events_success(), value: successEvents, subtitle: m.events_success_subtitle(), icon: ActivityIcon, iconColor: 'text-green-500', bgColor: 'bg-green-500/10', class: 'border-l-4 border-l-green-500' },
+ { title: m.events_warning(), value: warningEvents, subtitle: m.events_warning_subtitle(), icon: ActivityIcon, iconColor: 'text-yellow-500', bgColor: 'bg-yellow-500/10', class: 'border-l-4 border-l-yellow-500' },
+ { title: m.events_error(), value: errorEvents, subtitle: m.events_error_subtitle(), icon: ActivityIcon, iconColor: 'text-red-500', bgColor: 'bg-red-500/10', class: 'border-l-4 border-l-red-500' }
]);
</script>
-<ResourcePageLayout
- title={m.events_title()}
- subtitle={m.events_subtitle()}
- {actionButtons}
- {statCards}
- statCardsColumns={5}
- containerClass="flex h-full flex-col space-y-6"
->
+<ResourcePageLayout title={m.events_title()} subtitle={m.events_subtitle()} {actionButtons} {statCards} statCardsColumns={5} containerClass="flex h-full flex-col space-y-6">
{#snippet mainContent()}
<div class="flex-1 overflow-hidden">
<EventTable bind:events bind:selectedIds bind:requestOptions />
diff --git a/frontend/src/routes/events/+page.ts b/frontend/src/routes/(app)/events/+page.ts
similarity index 100%
rename from frontend/src/routes/events/+page.ts
rename to frontend/src/routes/(app)/events/+page.ts
diff --git a/frontend/src/routes/events/event-table.svelte b/frontend/src/routes/(app)/events/event-table.svelte
similarity index 100%
rename from frontend/src/routes/events/event-table.svelte
rename to frontend/src/routes/(app)/events/event-table.svelte
diff --git a/frontend/src/routes/(app)/images/+page.svelte b/frontend/src/routes/(app)/images/+page.svelte
new file mode 100644
index 000000000..6d030ac04
--- /dev/null
+++ b/frontend/src/routes/(app)/images/+page.svelte
@@ -0,0 +1,203 @@
+<script lang="ts">
+ import { Button } from '$lib/components/ui/button/index.js';
+ import { Spinner } from '$lib/components/ui/spinner/index.js';
+ import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
+ import PackageIcon from '@lucide/svelte/icons/package';
+ import XIcon from '@lucide/svelte/icons/x';
+ import { toast } from 'svelte-sonner';
+ import ImagePullSheet from '$lib/components/sheets/image-pull-sheet.svelte';
+ import bytes from 'bytes';
+ import * as Dialog from '$lib/components/ui/dialog/index.js';
+ import { displaySize, FileDropZone, MEGABYTE, type FileDropZoneProps } from '$lib/components/ui/file-drop-zone';
+ import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
+ import { tryCatch } from '$lib/utils/try-catch';
+ import ImageTable from './image-table.svelte';
+ import { m } from '$lib/paraglide/messages';
+ import { imageService } from '$lib/services/image-service';
+ import { untrack } from 'svelte';
+ import { ResourcePageLayout, type ActionButton, type StatCardConfig } from '$lib/layouts/index.js';
+ import { useEnvironmentRefresh } from '$lib/hooks/use-environment-refresh.svelte';
+ import { parallelRefresh } from '$lib/utils/refresh.util';
+
+ let { data } = $props();
+
+ let images = $state(untrack(() => data.images));
+ let imageUsageCounts = $state(untrack(() => data.imageUsageCounts));
+ let requestOptions = $state(untrack(() => data.imageRequestOptions));
+ let selectedIds = $state<string[]>([]);
+
+ let isLoading = $state({ pulling: false, uploading: false, refreshing: false, pruning: false, checking: false });
+ let isPullDialogOpen = $state(false);
+ let isUploadDialogOpen = $state(false);
+ let isConfirmPruneDialogOpen = $state(false);
+ let uploadedFiles = $state<File[]>([]);
+
+ const maxUploadSizeMB = $derived(parseInt(String(data.settings?.maxImageUploadSize || '500'), 10));
+
+ async function refresh() {
+ await parallelRefresh(
+ {
+ images: {
+ fetch: () => imageService.getImages(requestOptions),
+ onSuccess: (data) => (images = data),
+ errorMessage: m.common_refresh_failed({ resource: m.images_title() })
+ },
+ counts: {
+ fetch: () => imageService.getImageUsageCounts(),
+ onSuccess: (data) => (imageUsageCounts = data),
+ errorMessage: m.common_refresh_failed({ resource: m.images_title() })
+ }
+ },
+ (v) => (isLoading.refreshing = v)
+ );
+ }
+
+ useEnvironmentRefresh(refresh);
+
+ async function handlePruneImages() {
+ isLoading.pruning = true;
+ const dangling = data.settings?.dockerPruneMode === 'dangling';
+ handleApiResultWithCallbacks({
+ result: await tryCatch(imageService.pruneImages(dangling)),
+ message: m.images_prune_failed(),
+ setLoadingState: (v) => (isLoading.pruning = v),
+ onSuccess: async () => {
+ toast.success(m.images_pruned_success());
+ images = await imageService.getImages(requestOptions);
+ isConfirmPruneDialogOpen = false;
+ }
+ });
+ }
+
+ const onUpload: FileDropZoneProps['onUpload'] = async (files) => {
+ uploadedFiles = [...uploadedFiles, ...files];
+ };
+
+ const onFileRejected: FileDropZoneProps['onFileRejected'] = async ({ reason, file }) => {
+ toast.error(`${file.name} failed to upload!`, { description: reason });
+ };
+
+ async function handleUploadImages() {
+ if (uploadedFiles.length === 0) {
+ toast.error(m.images_upload_file_required());
+ return;
+ }
+ isLoading.uploading = true;
+ for (const file of uploadedFiles) {
+ handleApiResultWithCallbacks({
+ result: await tryCatch(imageService.uploadImage(file)),
+ message: m.images_upload_failed(),
+ setLoadingState: (v) => { isLoading.uploading = v; },
+ onSuccess: () => { toast.success(m.images_upload_success()); }
+ });
+ }
+ images = await imageService.getImages(requestOptions);
+ uploadedFiles = [];
+ isUploadDialogOpen = false;
+ isLoading.uploading = false;
+ }
+
+ async function handleTriggerBulkUpdateCheck() {
+ isLoading.checking = true;
+ try {
+ await imageService.checkAllImages();
+ toast.success(m.images_update_check_completed());
+ images = await imageService.getImages(requestOptions);
+ } catch {
+ toast.error(m.images_update_check_failed());
+ } finally {
+ isLoading.checking = false;
+ }
+ }
+
+ const actionButtons: ActionButton[] = $derived([
+ { id: 'pull', action: 'pull', label: m.images_pull_image(), onclick: () => (isPullDialogOpen = true) },
+ { id: 'upload', action: 'create', label: m.images_upload_image(), onclick: () => (isUploadDialogOpen = true) },
+ {
+ id: 'check-updates',
+ action: 'inspect',
+ label: m.images_check_updates(),
+ loadingLabel: m.common_action_checking(),
+ onclick: handleTriggerBulkUpdateCheck,
+ loading: isLoading.checking,
+ disabled: isLoading.checking
+ },
+ { id: 'refresh', action: 'restart', label: m.common_refresh(), onclick: refresh, loading: isLoading.refreshing, disabled: isLoading.refreshing },
+ {
+ id: 'prune',
+ action: 'remove',
+ label: m.images_prune_unused(),
+ loadingLabel: m.common_action_pruning(),
+ onclick: () => (isConfirmPruneDialogOpen = true),
+ loading: isLoading.pruning,
+ disabled: isLoading.pruning
+ }
+ ]);
+
+ const statCards: StatCardConfig[] = $derived([
+ { title: m.images_total(), value: imageUsageCounts.totalImages, icon: HardDriveIcon, iconColor: 'text-blue-500', class: 'border-l-4 border-l-blue-500' },
+ { title: m.images_total_size(), value: String(bytes.format(imageUsageCounts.totalImageSize)), icon: PackageIcon, iconColor: 'text-amber-500', class: 'border-l-4 border-l-amber-500' }
+ ]);
+</script>
+
+<ResourcePageLayout title={m.images_title()} subtitle={m.images_subtitle()} {actionButtons} {statCards} statCardsColumns={2}>
+ {#snippet mainContent()}
+ <ImageTable bind:images bind:selectedIds bind:requestOptions onImageUpdated={async () => { images = await imageService.getImages(requestOptions); }} />
+ {/snippet}
+
+ {#snippet additionalContent()}
+ <ImagePullSheet bind:open={isPullDialogOpen} onPullFinished={async () => { images = await imageService.getImages(requestOptions); }} />
+
+ <Dialog.Root bind:open={isUploadDialogOpen}>
+ <Dialog.Content class="max-w-2xl">
+ <Dialog.Header>
+ <Dialog.Title>{m.images_upload_image()}</Dialog.Title>
+ <Dialog.Description>{m.images_upload_description()}</Dialog.Description>
+ </Dialog.Header>
+ <div class="space-y-4 py-4">
+ <FileDropZone {onUpload} {onFileRejected} maxFileSize={maxUploadSizeMB * MEGABYTE} accept=".tar,.tar.gz,.tgz,.tar.xz" maxFiles={10} fileCount={uploadedFiles.length} disabled={isLoading.uploading} />
+ {#if uploadedFiles.length > 0}
+ <div class="flex flex-col gap-2">
+ {#each uploadedFiles as file, i (file.name)}
+ <div class="border-border bg-muted/50 flex items-center justify-between gap-2 rounded-lg border p-3">
+ <div class="flex flex-col">
+ <span class="text-sm font-medium">{file.name}</span>
+ <span class="text-muted-foreground text-xs">{displaySize(file.size)}</span>
+ </div>
+ <Button variant="ghost" size="icon" onclick={() => (uploadedFiles = [...uploadedFiles.slice(0, i), ...uploadedFiles.slice(i + 1)])} disabled={isLoading.uploading}>
+ <XIcon class="size-4" />
+ </Button>
+ </div>
+ {/each}
+ </div>
+ {/if}
+ {#if isLoading.uploading}
+ <div class="text-muted-foreground flex items-center gap-2 text-sm"><Spinner class="size-4" />{m.images_uploading()}</div>
+ {/if}
+ </div>
+ <div class="flex justify-end gap-3">
+ <Button variant="outline" onclick={() => { isUploadDialogOpen = false; uploadedFiles = []; }} disabled={isLoading.uploading}>{m.common_cancel()}</Button>
+ <Button onclick={handleUploadImages} disabled={isLoading.uploading || uploadedFiles.length === 0}>
+ {#if isLoading.uploading}<Spinner class="mr-2 size-4" />{/if}
+ {m.images_upload_image()}
+ </Button>
+ </div>
+ </Dialog.Content>
+ </Dialog.Root>
+
+ <Dialog.Root bind:open={isConfirmPruneDialogOpen}>
+ <Dialog.Content>
+ <Dialog.Header>
+ <Dialog.Title>{m.images_prune_confirm_title()}</Dialog.Title>
+ <Dialog.Description>{m.images_prune_confirm_description({ mode: String(data.settings.dockerPruneMode) })}</Dialog.Description>
+ </Dialog.Header>
+ <div class="flex justify-end gap-3 pt-6">
+ <Button variant="outline" onclick={() => (isConfirmPruneDialogOpen = false)} disabled={isLoading.pruning}>{m.common_cancel()}</Button>
+ <Button variant="destructive" onclick={handlePruneImages} disabled={isLoading.pruning}>
+ {#if isLoading.pruning}<Spinner class="mr-2 size-4" /> {m.common_action_pruning()}{:else}{m.images_prune_action()}{/if}
+ </Button>
+ </div>
+ </Dialog.Content>
+ </Dialog.Root>
+ {/snippet}
+</ResourcePageLayout>
diff --git a/frontend/src/routes/images/+page.ts b/frontend/src/routes/(app)/images/+page.ts
similarity index 100%
rename from frontend/src/routes/images/+page.ts
rename to frontend/src/routes/(app)/images/+page.ts
diff --git a/frontend/src/routes/images/[imageId]/+page.svelte b/frontend/src/routes/(app)/images/[imageId]/+page.svelte
similarity index 100%
rename from frontend/src/routes/images/[imageId]/+page.svelte
rename to frontend/src/routes/(app)/images/[imageId]/+page.svelte
diff --git a/frontend/src/routes/images/[imageId]/+page.ts b/frontend/src/routes/(app)/images/[imageId]/+page.ts
similarity index 100%
rename from frontend/src/routes/images/[imageId]/+page.ts
rename to frontend/src/routes/(app)/images/[imageId]/+page.ts
diff --git a/frontend/src/routes/images/image-table.svelte b/frontend/src/routes/(app)/images/image-table.svelte
similarity index 100%
rename from frontend/src/routes/images/image-table.svelte
rename to frontend/src/routes/(app)/images/image-table.svelte
diff --git a/frontend/src/routes/networks/+page.svelte b/frontend/src/routes/(app)/networks/+page.svelte
similarity index 61%
rename from frontend/src/routes/networks/+page.svelte
rename to frontend/src/routes/(app)/networks/+page.svelte
index 76f85cbaa..a5013f851 100644
--- a/frontend/src/routes/networks/+page.svelte
+++ b/frontend/src/routes/(app)/networks/+page.svelte
@@ -10,10 +10,10 @@
import NetworkTable from './network-table.svelte';
import { m } from '$lib/paraglide/messages';
import { networkService } from '$lib/services/network-service';
- import { environmentStore } from '$lib/stores/environment.store.svelte';
- import type { Environment } from '$lib/types/environment.type';
import { untrack } from 'svelte';
import { ResourcePageLayout, type ActionButton, type StatCardConfig } from '$lib/layouts/index.js';
+ import { useEnvironmentRefresh } from '$lib/hooks/use-environment-refresh.svelte';
+ import { parallelRefresh } from '$lib/utils/refresh.util';
let { data } = $props();
@@ -22,44 +22,29 @@
let requestOptions = $state(untrack(() => data.networkRequestOptions));
let selectedIds = $state<string[]>([]);
let isCreateDialogOpen = $state(false);
+ let isLoading = $state({ create: false, refresh: false });
- let isLoading = $state({
- create: false,
- refresh: false
- });
-
- const totalNetworks = $derived(networkUsageCounts.totalNetworks);
- const unusedNetworks = $derived(networkUsageCounts.networksUnused);
-
- async function refreshNetworks() {
- isLoading.refresh = true;
- let refreshingNetworkList = true;
- let refreshingNetworkCounts = true;
- handleApiResultWithCallbacks({
- result: await tryCatch(networkService.getNetworks(requestOptions)),
- message: m.common_refresh_failed({ resource: m.networks_title() }),
- setLoadingState: (value) => {
- refreshingNetworkList = value;
- isLoading.refresh = refreshingNetworkCounts || refreshingNetworkList;
- },
- async onSuccess(newNetworks) {
- networks = newNetworks;
- }
- });
- handleApiResultWithCallbacks({
- result: await tryCatch(networkService.getNetworkUsageCounts()),
- message: m.common_refresh_failed({ resource: m.networks_title() }),
- setLoadingState: (value) => {
- refreshingNetworkCounts = value;
- isLoading.refresh = refreshingNetworkCounts || refreshingNetworkList;
+ async function refresh() {
+ await parallelRefresh(
+ {
+ networks: {
+ fetch: () => networkService.getNetworks(requestOptions),
+ onSuccess: (data) => (networks = data),
+ errorMessage: m.common_refresh_failed({ resource: m.networks_title() })
+ },
+ counts: {
+ fetch: () => networkService.getNetworkUsageCounts(),
+ onSuccess: (data) => (networkUsageCounts = data),
+ errorMessage: m.common_refresh_failed({ resource: m.networks_title() })
+ }
},
- async onSuccess(newNetworkCounts) {
- networkUsageCounts = newNetworkCounts;
- }
- });
+ (v) => (isLoading.refresh = v)
+ );
}
- async function handleCreateNetworkSubmit(options: NetworkCreateOptions) {
+ useEnvironmentRefresh(refresh);
+
+ async function handleCreate(options: NetworkCreateOptions) {
isLoading.create = true;
const name = options.Name?.trim() || m.common_unknown();
const dto: NetworkCreateDto = {
@@ -76,7 +61,7 @@
handleApiResultWithCallbacks({
result: await tryCatch(networkService.createNetwork(name, dto)),
message: m.common_create_failed({ resource: `${m.resource_network()} "${name}"` }),
- setLoadingState: (value) => (isLoading.create = value),
+ setLoadingState: (v) => (isLoading.create = v),
onSuccess: async () => {
toast.success(m.common_create_success({ resource: `${m.resource_network()} "${name}"` }));
networks = await networkService.getNetworks(requestOptions);
@@ -85,21 +70,7 @@
});
}
- let lastEnvId: string | null = null;
- $effect(() => {
- const env = environmentStore.selected;
- if (!env) return;
- if (lastEnvId === null) {
- lastEnvId = env.id;
- return;
- }
- if (env.id !== lastEnvId) {
- lastEnvId = env.id;
- refreshNetworks();
- }
- });
-
- const actionButtons: ActionButton[] = $derived.by(() => [
+ const actionButtons: ActionButton[] = $derived([
{
id: 'create',
action: 'create',
@@ -110,7 +81,7 @@
id: 'refresh',
action: 'restart',
label: m.common_refresh(),
- onclick: refreshNetworks,
+ onclick: refresh,
loading: isLoading.refresh,
disabled: isLoading.refresh
}
@@ -119,14 +90,14 @@
const statCards: StatCardConfig[] = $derived([
{
title: m.networks_total(),
- value: totalNetworks,
+ value: networkUsageCounts.totalNetworks,
icon: NetworkIcon,
iconColor: 'text-blue-500',
class: 'border-l-4 border-l-blue-500'
},
{
title: m.unused_networks(),
- value: unusedNetworks,
+ value: networkUsageCounts.networksUnused,
icon: EthernetPortIcon,
iconColor: 'text-amber-500',
class: 'border-l-4 border-l-amber-500'
@@ -140,6 +111,6 @@
{/snippet}
{#snippet additionalContent()}
- <CreateNetworkSheet bind:open={isCreateDialogOpen} isLoading={isLoading.create} onSubmit={handleCreateNetworkSubmit} />
+ <CreateNetworkSheet bind:open={isCreateDialogOpen} isLoading={isLoading.create} onSubmit={handleCreate} />
{/snippet}
</ResourcePageLayout>
diff --git a/frontend/src/routes/networks/+page.ts b/frontend/src/routes/(app)/networks/+page.ts
similarity index 100%
rename from frontend/src/routes/networks/+page.ts
rename to frontend/src/routes/(app)/networks/+page.ts
diff --git a/frontend/src/routes/networks/[networkId]/+page.svelte b/frontend/src/routes/(app)/networks/[networkId]/+page.svelte
similarity index 100%
rename from frontend/src/routes/networks/[networkId]/+page.svelte
rename to frontend/src/routes/(app)/networks/[networkId]/+page.svelte
diff --git a/frontend/src/routes/networks/[networkId]/+page.ts b/frontend/src/routes/(app)/networks/[networkId]/+page.ts
similarity index 100%
rename from frontend/src/routes/networks/[networkId]/+page.ts
rename to frontend/src/routes/(app)/networks/[networkId]/+page.ts
diff --git a/frontend/src/routes/networks/network-table.svelte b/frontend/src/routes/(app)/networks/network-table.svelte
similarity index 100%
rename from frontend/src/routes/networks/network-table.svelte
rename to frontend/src/routes/(app)/networks/network-table.svelte
diff --git a/frontend/src/routes/projects/+page.svelte b/frontend/src/routes/(app)/projects/+page.svelte
similarity index 100%
rename from frontend/src/routes/projects/+page.svelte
rename to frontend/src/routes/(app)/projects/+page.svelte
diff --git a/frontend/src/routes/projects/+page.ts b/frontend/src/routes/(app)/projects/+page.ts
similarity index 100%
rename from frontend/src/routes/projects/+page.ts
rename to frontend/src/routes/(app)/projects/+page.ts
diff --git a/frontend/src/routes/projects/[projectId]/+page.svelte b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
similarity index 99%
rename from frontend/src/routes/projects/[projectId]/+page.svelte
rename to frontend/src/routes/(app)/projects/[projectId]/+page.svelte
index 79be17f2e..81e3f98f7 100644
--- a/frontend/src/routes/projects/[projectId]/+page.svelte
+++ b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
@@ -302,7 +302,7 @@
{#snippet tabContent()}
<Tabs.Content value="services" class="h-full">
- <ServicesGrid services={project.services} {projectId} />
+ <ServicesGrid services={project.runtimeServices} {projectId} />
</Tabs.Content>
<Tabs.Content value="compose" class="h-full">
diff --git a/frontend/src/routes/projects/[projectId]/+page.ts b/frontend/src/routes/(app)/projects/[projectId]/+page.ts
similarity index 100%
rename from frontend/src/routes/projects/[projectId]/+page.ts
rename to frontend/src/routes/(app)/projects/[projectId]/+page.ts
diff --git a/frontend/src/routes/projects/components/CodePanel.svelte b/frontend/src/routes/(app)/projects/components/CodePanel.svelte
similarity index 100%
rename from frontend/src/routes/projects/components/CodePanel.svelte
rename to frontend/src/routes/(app)/projects/components/CodePanel.svelte
diff --git a/frontend/src/routes/projects/components/EditableName.svelte b/frontend/src/routes/(app)/projects/components/EditableName.svelte
similarity index 100%
rename from frontend/src/routes/projects/components/EditableName.svelte
rename to frontend/src/routes/(app)/projects/components/EditableName.svelte
diff --git a/frontend/src/routes/projects/components/ProjectLogsPanel.svelte b/frontend/src/routes/(app)/projects/components/ProjectLogsPanel.svelte
similarity index 100%
rename from frontend/src/routes/projects/components/ProjectLogsPanel.svelte
rename to frontend/src/routes/(app)/projects/components/ProjectLogsPanel.svelte
diff --git a/frontend/src/routes/(app)/projects/components/ServicesGrid.svelte b/frontend/src/routes/(app)/projects/components/ServicesGrid.svelte
new file mode 100644
index 000000000..bbba7387c
--- /dev/null
+++ b/frontend/src/routes/(app)/projects/components/ServicesGrid.svelte
@@ -0,0 +1,123 @@
+<script lang="ts">
+ import * as Card from '$lib/components/ui/card';
+ import LayersIcon from '@lucide/svelte/icons/layers';
+ import HeartPulseIcon from '@lucide/svelte/icons/heart-pulse';
+ import StatusBadge from '$lib/components/badges/status-badge.svelte';
+ import { getStatusVariant } from '$lib/utils/status.utils';
+ import { capitalizeFirstLetter } from '$lib/utils/string.utils';
+ import { m } from '$lib/paraglide/messages';
+ import { Badge } from '$lib/components/ui/badge';
+ import type { RuntimeService } from '$lib/types/project.type';
+
+ interface Props {
+ services?: RuntimeService[];
+ projectId?: string;
+ }
+
+ let { services, projectId }: Props = $props();
+
+ function getHealthColor(health: string | undefined): string {
+ if (!health) return 'text-amber-500';
+ const normalized = health.toLowerCase();
+ if (normalized === 'healthy') return 'text-green-500';
+ if (normalized === 'unhealthy') return 'text-red-500';
+ return 'text-amber-500';
+ }
+</script>
+
+{#snippet serviceCard(service: RuntimeService)}
+ {@const status = service.status || 'unknown'}
+ {@const containerUrl = projectId
+ ? `/containers/${service.containerId}?from=project&projectId=${projectId}`
+ : `/containers/${service.containerId}`}
+
+ {#if service.containerId}
+ <a href={containerUrl} class="group">
+ <Card.Root
+ variant="subtle"
+ class="group-hover:border-border/60 group-hover:bg-muted/50 flex h-full cursor-pointer transition-all duration-200"
+ >
+ <Card.Content class="flex flex-col p-4">
+ <div class="flex items-start gap-3">
+ <div class="rounded-lg bg-blue-500/10 p-2 transition-colors group-hover:bg-blue-500/15">
+ <LayersIcon class="size-5 text-blue-500" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <div class="mb-2 flex items-center gap-2">
+ <h3 class="text-foreground text-base font-semibold transition-colors">
+ {service.containerName || service.name}
+ </h3>
+ <Badge variant="outline" class="text-xs">
+ {service.name}
+ </Badge>
+ </div>
+ <div class="flex flex-wrap items-center gap-3">
+ <StatusBadge variant={getStatusVariant(status)} text={capitalizeFirstLetter(status)} />
+ {#if service.health}
+ {@const healthColor = getHealthColor(service.health)}
+ <div class="flex items-center gap-1.5">
+ <HeartPulseIcon class="{healthColor} size-4" />
+ <span class="text-muted-foreground text-xs">{capitalizeFirstLetter(service.health)}</span>
+ </div>
+ {/if}
+ </div>
+ {#if service.ports && service.ports.length > 0}
+ <div class="text-muted-foreground mt-2 text-xs">
+ {m.common_ports()}: {service.ports.join(', ')}
+ </div>
+ {/if}
+ </div>
+ </div>
+ </Card.Content>
+ </Card.Root>
+ </a>
+ {:else}
+ <Card.Root variant="subtle" class="flex h-full opacity-60">
+ <Card.Content class="flex flex-col p-4">
+ <div class="flex items-start gap-3">
+ <div class="rounded-lg bg-amber-500/10 p-2">
+ <LayersIcon class="size-5 text-amber-500" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <h3 class="text-foreground mb-2 text-base font-semibold">
+ {service.name}
+ </h3>
+ <StatusBadge variant={getStatusVariant(status)} text={capitalizeFirstLetter(status)} />
+ <p class="text-muted-foreground mt-2 text-xs">
+ {m.compose_service_not_created()}
+ </p>
+ </div>
+ </div>
+ </Card.Content>
+ </Card.Root>
+ {/if}
+{/snippet}
+
+<Card.Root>
+ <Card.Header icon={LayersIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>
+ <h2>
+ {m.compose_services()}
+ </h2>
+ </Card.Title>
+ <Card.Description>{m.compose_services_description()}</Card.Description>
+ </div>
+ </Card.Header>
+ <Card.Content class="p-4">
+ {#if services && services.length > 0}
+ <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
+ {#each services as service, i (service.containerId || service.name || i)}
+ {@render serviceCard(service)}
+ {/each}
+ </div>
+ {:else}
+ <div class="rounded-lg border border-dashed py-12 text-center">
+ <div class="bg-muted/50 mx-auto mb-4 flex size-16 items-center justify-center rounded-full">
+ <LayersIcon class="text-muted-foreground size-6" />
+ </div>
+ <div class="text-muted-foreground text-sm">{m.compose_no_services_found()}</div>
+ </div>
+ {/if}
+ </Card.Content>
+</Card.Root>
diff --git a/frontend/src/routes/projects/new/+page.svelte b/frontend/src/routes/(app)/projects/new/+page.svelte
similarity index 100%
rename from frontend/src/routes/projects/new/+page.svelte
rename to frontend/src/routes/(app)/projects/new/+page.svelte
diff --git a/frontend/src/routes/projects/new/+page.ts b/frontend/src/routes/(app)/projects/new/+page.ts
similarity index 100%
rename from frontend/src/routes/projects/new/+page.ts
rename to frontend/src/routes/(app)/projects/new/+page.ts
diff --git a/frontend/src/routes/projects/projects-table.svelte b/frontend/src/routes/(app)/projects/projects-table.svelte
similarity index 100%
rename from frontend/src/routes/projects/projects-table.svelte
rename to frontend/src/routes/(app)/projects/projects-table.svelte
diff --git a/frontend/src/routes/settings/+layout.svelte b/frontend/src/routes/(app)/settings/+layout.svelte
similarity index 100%
rename from frontend/src/routes/settings/+layout.svelte
rename to frontend/src/routes/(app)/settings/+layout.svelte
diff --git a/frontend/src/routes/settings/+layout.ts b/frontend/src/routes/(app)/settings/+layout.ts
similarity index 100%
rename from frontend/src/routes/settings/+layout.ts
rename to frontend/src/routes/(app)/settings/+layout.ts
diff --git a/frontend/src/routes/settings/+page.svelte b/frontend/src/routes/(app)/settings/+page.svelte
similarity index 100%
rename from frontend/src/routes/settings/+page.svelte
rename to frontend/src/routes/(app)/settings/+page.svelte
diff --git a/frontend/src/routes/settings/docker/+page.svelte b/frontend/src/routes/(app)/settings/docker/+page.svelte
similarity index 77%
rename from frontend/src/routes/settings/docker/+page.svelte
rename to frontend/src/routes/(app)/settings/docker/+page.svelte
index 4b5f7fcab..0c7fd9cda 100644
--- a/frontend/src/routes/settings/docker/+page.svelte
+++ b/frontend/src/routes/(app)/settings/docker/+page.svelte
@@ -2,11 +2,9 @@
import * as Card from '$lib/components/ui/card';
import ZapIcon from '@lucide/svelte/icons/zap';
import * as Alert from '$lib/components/ui/alert';
- import { toast } from 'svelte-sonner';
import type { Settings } from '$lib/types/settings.type';
import { z } from 'zod/v4';
import { onMount } from 'svelte';
- import { createForm } from '$lib/utils/form.utils';
import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
import SelectWithLabel from '$lib/components/form/select-with-label.svelte';
import { m } from '$lib/paraglide/messages';
@@ -18,7 +16,7 @@
import settingsStore from '$lib/stores/config-store';
import BoxesIcon from '@lucide/svelte/icons/boxes';
import { SettingsPageLayout } from '$lib/layouts';
- import { UseSettingsForm } from '$lib/hooks/use-settings-form.svelte';
+ import { createSettingsForm } from '$lib/utils/settings-form.util';
let { data } = $props();
const currentSettings = $derived<Settings>($settingsStore || data.settings!);
@@ -44,29 +42,10 @@
description: string;
minutes?: number;
}> = [
- {
- value: 'hourly',
- minutes: 60,
- label: m.hourly(),
- description: m.polling_hourly_description()
- },
- {
- value: 'daily',
- minutes: 1440,
- label: m.daily(),
- description: m.polling_daily_description()
- },
- {
- value: 'weekly',
- minutes: 10080,
- label: m.weekly(),
- description: m.polling_weekly_description()
- },
- {
- value: 'custom',
- label: m.custom(),
- description: m.use_custom_polling_value()
- }
+ { value: 'hourly', minutes: 60, label: m.hourly(), description: m.polling_hourly_description() },
+ { value: 'daily', minutes: 1440, label: m.daily(), description: m.polling_daily_description() },
+ { value: 'weekly', minutes: 10080, label: m.weekly(), description: m.polling_weekly_description() },
+ { value: 'custom', label: m.custom(), description: m.use_custom_polling_value() }
];
const presetToMinutes = Object.fromEntries(
@@ -78,16 +57,8 @@
);
const pruneModeOptions = [
- {
- value: 'all',
- label: m.docker_prune_all(),
- description: m.docker_prune_all_description()
- },
- {
- value: 'dangling',
- label: m.docker_prune_dangling(),
- description: m.docker_prune_dangling_description()
- }
+ { value: 'all', label: m.docker_prune_all(), description: m.docker_prune_all_description() },
+ { value: 'dangling', label: m.docker_prune_dangling(), description: m.docker_prune_dangling_description() }
];
const pruneModeDescription = $derived(
@@ -103,61 +74,29 @@
let shellSelectValue = $state<string>(shellOptions.find((o) => o.value === currentSettings.defaultShell)?.value ?? 'custom');
- let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, currentSettings));
-
- const settingsForm = new UseSettingsForm({
- hasChangesChecker: () =>
- $formInputs.pollingEnabled.value !== currentSettings.pollingEnabled ||
- $formInputs.pollingInterval.value !== currentSettings.pollingInterval ||
- $formInputs.autoUpdate.value !== currentSettings.autoUpdate ||
- $formInputs.autoUpdateInterval.value != currentSettings.autoUpdateInterval ||
- $formInputs.dockerPruneMode.value != currentSettings.dockerPruneMode ||
- $formInputs.maxImageUploadSize.value != currentSettings.maxImageUploadSize ||
- $formInputs.defaultShell.value != currentSettings.defaultShell
- });
+ let { formInputs, registerOnMount } = $derived(
+ createSettingsForm({
+ schema: formSchema,
+ currentSettings,
+ successMessage: m.general_settings_saved()
+ })
+ );
+ // Sync polling mode select with form value
$effect(() => {
if (pollingIntervalMode !== 'custom') {
$formInputs.pollingInterval.value = presetToMinutes[pollingIntervalMode];
}
});
+ // Sync shell select with form value
$effect(() => {
if (shellSelectValue !== 'custom') {
$formInputs.defaultShell.value = shellSelectValue;
}
});
- async function onSubmit() {
- const data = form.validate();
- if (!data) {
- toast.error('Please check the form for errors');
- return;
- }
- settingsForm.setLoading(true);
-
- await settingsForm
- .updateSettings(data)
- .then(() => toast.success(m.general_settings_saved()))
- .catch((error) => {
- console.error('Failed to save Docker settings:', error);
- toast.error('Failed to save Docker settings. Please try again.');
- })
- .finally(() => settingsForm.setLoading(false));
- }
- function resetForm() {
- $formInputs.pollingEnabled.value = currentSettings.pollingEnabled;
- $formInputs.pollingInterval.value = currentSettings.pollingInterval;
- $formInputs.autoUpdate.value = currentSettings.autoUpdate;
- $formInputs.autoUpdateInterval.value = currentSettings.autoUpdateInterval;
- $formInputs.dockerPruneMode.value = currentSettings.dockerPruneMode;
- $formInputs.maxImageUploadSize.value = currentSettings.maxImageUploadSize;
- $formInputs.defaultShell.value = currentSettings.defaultShell;
- }
-
- onMount(() => {
- settingsForm.registerFormActions(onSubmit, resetForm);
- });
+ onMount(() => registerOnMount());
</script>
<SettingsPageLayout
diff --git a/frontend/src/routes/settings/general/+page.svelte b/frontend/src/routes/(app)/settings/general/+page.svelte
similarity index 76%
rename from frontend/src/routes/settings/general/+page.svelte
rename to frontend/src/routes/(app)/settings/general/+page.svelte
index 3889bbc45..e1ea5c0d7 100644
--- a/frontend/src/routes/settings/general/+page.svelte
+++ b/frontend/src/routes/(app)/settings/general/+page.svelte
@@ -2,8 +2,6 @@
import * as Card from '$lib/components/ui/card';
import { z } from 'zod/v4';
import { onMount } from 'svelte';
- import { createForm } from '$lib/utils/form.utils';
- import { toast } from 'svelte-sonner';
import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
import { m } from '$lib/paraglide/messages';
import FolderIcon from '@lucide/svelte/icons/folder';
@@ -17,7 +15,7 @@
import { applyAccentColor } from '$lib/utils/accent-color-util';
import SparklesIcon from '@lucide/svelte/icons/sparkles';
import { Switch } from '$lib/components/ui/switch/index.js';
- import { UseSettingsForm } from '$lib/hooks/use-settings-form.svelte';
+ import { createSettingsForm } from '$lib/utils/settings-form.util';
let { data } = $props();
@@ -33,49 +31,16 @@
glassEffectEnabled: z.boolean()
});
- let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, currentSettings));
+ let { formInputs, registerOnMount } = $derived(
+ createSettingsForm({
+ schema: formSchema,
+ currentSettings,
+ successMessage: m.general_settings_saved(),
+ onReset: () => applyAccentColor(currentSettings.accentColor)
+ })
+ );
- const settingsForm = new UseSettingsForm({
- hasChangesChecker: () =>
- $formInputs.projectsDirectory.value !== currentSettings.projectsDirectory ||
- $formInputs.baseServerUrl.value !== currentSettings.baseServerUrl ||
- $formInputs.enableGravatar.value !== currentSettings.enableGravatar ||
- $formInputs.environmentHealthInterval.value !== currentSettings.environmentHealthInterval ||
- $formInputs.accentColor.value !== currentSettings.accentColor ||
- $formInputs.glassEffectEnabled.value !== currentSettings.glassEffectEnabled
- });
-
- async function onSubmit() {
- const data = form.validate();
- if (!data) {
- toast.error('Please check the form for errors');
- return;
- }
- settingsForm.setLoading(true);
-
- await settingsForm
- .updateSettings(data)
- .then(() => toast.success(m.general_settings_saved()))
- .catch((error) => {
- console.error('Failed to save settings:', error);
- toast.error('Failed to save settings. Please try again.');
- })
- .finally(() => settingsForm.setLoading(false));
- }
-
- function resetForm() {
- $formInputs.projectsDirectory.value = currentSettings.projectsDirectory;
- $formInputs.baseServerUrl.value = currentSettings.baseServerUrl;
- $formInputs.enableGravatar.value = currentSettings.enableGravatar;
- $formInputs.environmentHealthInterval.value = currentSettings.environmentHealthInterval;
- $formInputs.accentColor.value = currentSettings.accentColor;
- $formInputs.glassEffectEnabled.value = currentSettings.glassEffectEnabled;
- applyAccentColor(currentSettings.accentColor);
- }
-
- onMount(() => {
- settingsForm.registerFormActions(onSubmit, resetForm);
- });
+ onMount(() => registerOnMount());
</script>
<SettingsPageLayout
diff --git a/frontend/src/routes/settings/navigation/+page.svelte b/frontend/src/routes/(app)/settings/navigation/+page.svelte
similarity index 76%
rename from frontend/src/routes/settings/navigation/+page.svelte
rename to frontend/src/routes/(app)/settings/navigation/+page.svelte
index f65c93d46..260f807e0 100644
--- a/frontend/src/routes/settings/navigation/+page.svelte
+++ b/frontend/src/routes/(app)/settings/navigation/+page.svelte
@@ -2,7 +2,6 @@
import * as Card from '$lib/components/ui/card';
import { z } from 'zod/v4';
import { onMount } from 'svelte';
- import { createForm } from '$lib/utils/form.utils';
import { toast } from 'svelte-sonner';
import EyeIcon from '@lucide/svelte/icons/eye';
import NavigationIcon from '@lucide/svelte/icons/navigation';
@@ -15,7 +14,7 @@
import { SettingsPageLayout } from '$lib/layouts';
import { Switch } from '$lib/components/ui/switch/index.js';
import { useSidebar } from '$lib/components/ui/sidebar/context.svelte.js';
- import { UseSettingsForm } from '$lib/hooks/use-settings-form.svelte';
+ import { createSettingsForm } from '$lib/utils/settings-form.util';
let { data } = $props();
const currentSettings = $derived($settingsStore || data.settings!);
@@ -32,34 +31,25 @@
// Sidebar context is only available in desktop view
let sidebar: ReturnType<typeof useSidebar> | null = null;
-
try {
sidebar = useSidebar();
- } catch (e) {
+ } catch {
// Sidebar context not available (mobile view)
}
- let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, currentSettings));
-
- const settingsForm = new UseSettingsForm({
- hasChangesChecker: () =>
- $formInputs.mobileNavigationMode.value !== currentSettings.mobileNavigationMode ||
- $formInputs.mobileNavigationShowLabels.value !== currentSettings.mobileNavigationShowLabels ||
- $formInputs.sidebarHoverExpansion.value !== currentSettings.sidebarHoverExpansion
- });
+ let { formInputs, registerOnMount } = $derived(
+ createSettingsForm({
+ schema: formSchema,
+ currentSettings,
+ successMessage: m.navigation_settings_saved()
+ })
+ );
function setLocalOverride(key: 'mode' | 'showLabels', value: any) {
const currentOverrides = navigationSettingsOverridesStore.current;
- navigationSettingsOverridesStore.current = {
- ...currentOverrides,
- [key]: value
- };
+ navigationSettingsOverridesStore.current = { ...currentOverrides, [key]: value };
persistedState = navigationSettingsOverridesStore.current;
-
- // Reset navigation bar visibility when mode changes (affects scroll-to-hide behavior)
- if (key === 'mode') {
- resetNavigationVisibility();
- }
+ if (key === 'mode') resetNavigationVisibility();
}
function clearLocalOverride(key: 'mode' | 'showLabels') {
@@ -68,40 +58,11 @@
delete newOverrides[key];
navigationSettingsOverridesStore.current = newOverrides;
persistedState = navigationSettingsOverridesStore.current;
-
- // Reset navigation bar visibility when mode changes (affects scroll-to-hide behavior)
- if (key === 'mode') {
- resetNavigationVisibility();
- }
-
+ if (key === 'mode') resetNavigationVisibility();
toast.success(`Local override cleared for ${key.replace(/([A-Z])/g, ' $1').toLowerCase()}`);
}
- async function onSubmit() {
- const data = form.validate();
- if (!data) {
- toast.error('Please check the form for errors');
- return;
- }
- settingsForm.setLoading(true);
-
- await settingsForm
- .updateSettings(data)
- .then(() => toast.success(m.navigation_settings_saved()))
- .catch((error) => {
- console.error('Failed to save navigation settings:', error);
- toast.error('Failed to save navigation settings. Please try again.');
- })
- .finally(() => settingsForm.setLoading(false));
- }
- function resetForm() {
- $formInputs.mobileNavigationMode.value = currentSettings.mobileNavigationMode;
- $formInputs.mobileNavigationShowLabels.value = currentSettings.mobileNavigationShowLabels;
- }
-
- onMount(() => {
- settingsForm.registerFormActions(onSubmit, resetForm);
- });
+ onMount(() => registerOnMount());
</script>
<SettingsPageLayout
diff --git a/frontend/src/routes/settings/notifications/+page.svelte b/frontend/src/routes/(app)/settings/notifications/+page.svelte
similarity index 100%
rename from frontend/src/routes/settings/notifications/+page.svelte
rename to frontend/src/routes/(app)/settings/notifications/+page.svelte
diff --git a/frontend/src/routes/settings/notifications/+page.ts b/frontend/src/routes/(app)/settings/notifications/+page.ts
similarity index 100%
rename from frontend/src/routes/settings/notifications/+page.ts
rename to frontend/src/routes/(app)/settings/notifications/+page.ts
diff --git a/frontend/src/routes/settings/security/+page.svelte b/frontend/src/routes/(app)/settings/security/+page.svelte
similarity index 91%
rename from frontend/src/routes/settings/security/+page.svelte
rename to frontend/src/routes/(app)/settings/security/+page.svelte
index 40d273c2d..ec800f44a 100644
--- a/frontend/src/routes/settings/security/+page.svelte
+++ b/frontend/src/routes/(app)/settings/security/+page.svelte
@@ -3,7 +3,6 @@
import * as AlertDialog from '$lib/components/ui/alert-dialog';
import { z } from 'zod/v4';
import { onMount } from 'svelte';
- import { createForm } from '$lib/utils/form.utils';
import { Button } from '$lib/components/ui/button';
import { Input } from '$lib/components/ui/input';
import { Label } from '$lib/components/ui/label';
@@ -23,8 +22,8 @@
import TextInputWithLabel from '$lib/components/form/text-input-with-label.svelte';
import settingsStore from '$lib/stores/config-store';
import { SettingsPageLayout } from '$lib/layouts';
- import { UseSettingsForm } from '$lib/hooks/use-settings-form.svelte';
import { UseClipboard } from '$lib/hooks/use-clipboard.svelte';
+ import { createSettingsForm } from '$lib/utils/settings-form.util';
let { data }: { data: PageData } = $props();
const currentSettings = $derived<Settings>($settingsStore || data.settings!);
@@ -49,7 +48,6 @@
oidcAdminValue: z.string()
})
.superRefine((formData, ctx) => {
- // If server forces OIDC or OIDC is enabled, local auth can be disabled
if (data.oidcStatus.envForced || formData.oidcEnabled) return;
if (!formData.authLocalEnabled) {
ctx.addIssue({
@@ -62,7 +60,6 @@
let showMergeAccountsAlert = $state(false);
- // Form initial values with OIDC defaults
const formDefaults = $derived({
authLocalEnabled: currentSettings.authLocalEnabled,
authSessionTimeout: currentSettings.authSessionTimeout,
@@ -77,11 +74,18 @@
oidcAdminValue: currentSettings.oidcAdminValue
});
- let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formDefaults));
+ // Security page needs custom submit logic for OIDC client secret handling
+ let { formInputs, form, settingsForm, registerOnMount } = $derived(
+ createSettingsForm({
+ schema: formSchema,
+ currentSettings: formDefaults,
+ successMessage: m.security_settings_saved()
+ })
+ );
- const settingsForm = new UseSettingsForm({
- hasChangesChecker: () =>
- $formInputs.authLocalEnabled.value !== currentSettings.authLocalEnabled ||
+ // Override the default hasChanges since we need special handling for oidcClientSecret
+ const hasSecurityChanges = $derived(
+ $formInputs.authLocalEnabled.value !== currentSettings.authLocalEnabled ||
$formInputs.authSessionTimeout.value !== currentSettings.authSessionTimeout ||
$formInputs.authPasswordPolicy.value !== currentSettings.authPasswordPolicy ||
$formInputs.oidcEnabled.value !== currentSettings.oidcEnabled ||
@@ -92,20 +96,19 @@
$formInputs.oidcAdminClaim.value !== currentSettings.oidcAdminClaim ||
$formInputs.oidcAdminValue.value !== currentSettings.oidcAdminValue ||
$formInputs.oidcClientSecret.value !== ''
- });
+ );
const clipboard = new UseClipboard();
const redirectUri = $derived(`${globalThis?.location?.origin ?? ''}/auth/oidc/callback`);
const isOidcEnvForced = $derived(data.oidcStatus.envForced);
- async function onSubmit() {
+ async function customSubmit() {
const formData = form.validate();
if (!formData) {
toast.error(m.security_form_validation_error());
return;
}
- // Validate OIDC required fields when enabling
if (formData.oidcEnabled && !isOidcEnvForced) {
if (!formData.oidcClientId || !formData.oidcIssuerUrl) {
toast.error(m.security_oidc_required_fields());
@@ -129,8 +132,6 @@
oidcAdminValue: formData.oidcAdminValue,
...(formData.oidcClientSecret && { oidcClientSecret: formData.oidcClientSecret })
});
-
- // Clear the secret field after save
$formInputs.oidcClientSecret.value = '';
toast.success(m.security_settings_saved());
} catch (error: any) {
@@ -141,22 +142,12 @@
}
}
- function resetForm() {
- $formInputs.authLocalEnabled.value = currentSettings.authLocalEnabled;
- $formInputs.authSessionTimeout.value = currentSettings.authSessionTimeout;
- $formInputs.authPasswordPolicy.value = currentSettings.authPasswordPolicy;
- $formInputs.oidcEnabled.value = currentSettings.oidcEnabled;
- $formInputs.oidcMergeAccounts.value = currentSettings.oidcMergeAccounts;
- $formInputs.oidcClientId.value = currentSettings.oidcClientId;
+ function customReset() {
+ form.reset();
$formInputs.oidcClientSecret.value = '';
- $formInputs.oidcIssuerUrl.value = currentSettings.oidcIssuerUrl;
- $formInputs.oidcScopes.value = currentSettings.oidcScopes;
- $formInputs.oidcAdminClaim.value = currentSettings.oidcAdminClaim;
- $formInputs.oidcAdminValue.value = currentSettings.oidcAdminValue;
}
function handleLocalSwitchChange(checked: boolean) {
- // If trying to disable local auth, check if OIDC is enabled
if (!checked && !$formInputs.oidcEnabled.value && !data.oidcStatus.envForced) {
$formInputs.authLocalEnabled.value = true;
toast.error(m.security_enable_one_provider_error());
@@ -166,7 +157,6 @@
}
function handleOidcEnabledChange(checked: boolean) {
- // If trying to disable OIDC and local auth is also disabled
if (!checked && !$formInputs.authLocalEnabled.value && !data.oidcStatus.envForced) {
$formInputs.authLocalEnabled.value = true;
toast.info(m.security_local_enabled_info());
@@ -198,7 +188,8 @@
}
onMount(() => {
- settingsForm.registerFormActions(onSubmit, resetForm);
+ // Use custom submit/reset for security page
+ settingsForm.registerFormActions(customSubmit, customReset);
});
</script>
diff --git a/frontend/src/routes/settings/users/+page.svelte b/frontend/src/routes/(app)/settings/users/+page.svelte
similarity index 100%
rename from frontend/src/routes/settings/users/+page.svelte
rename to frontend/src/routes/(app)/settings/users/+page.svelte
diff --git a/frontend/src/routes/settings/users/+page.ts b/frontend/src/routes/(app)/settings/users/+page.ts
similarity index 100%
rename from frontend/src/routes/settings/users/+page.ts
rename to frontend/src/routes/(app)/settings/users/+page.ts
diff --git a/frontend/src/routes/settings/users/user-table.svelte b/frontend/src/routes/(app)/settings/users/user-table.svelte
similarity index 100%
rename from frontend/src/routes/settings/users/user-table.svelte
rename to frontend/src/routes/(app)/settings/users/user-table.svelte
diff --git a/frontend/src/routes/volumes/+page.svelte b/frontend/src/routes/(app)/volumes/+page.svelte
similarity index 60%
rename from frontend/src/routes/volumes/+page.svelte
rename to frontend/src/routes/(app)/volumes/+page.svelte
index 680d221c4..d083d94bf 100644
--- a/frontend/src/routes/volumes/+page.svelte
+++ b/frontend/src/routes/(app)/volumes/+page.svelte
@@ -10,36 +10,47 @@
import VolumeTable from './volume-table.svelte';
import { m } from '$lib/paraglide/messages';
import { volumeService } from '$lib/services/volume-service';
- import { environmentStore } from '$lib/stores/environment.store.svelte';
import { untrack } from 'svelte';
import { ResourcePageLayout, type ActionButton, type StatCardConfig } from '$lib/layouts/index.js';
+ import { useEnvironmentRefresh } from '$lib/hooks/use-environment-refresh.svelte';
+ import { parallelRefresh } from '$lib/utils/refresh.util';
let { data } = $props();
let volumes = $state(untrack(() => data.volumes));
let volumeUsageCounts = $state(untrack(() => data.volumeUsageCounts));
let requestOptions = $state(untrack(() => data.volumeRequestOptions));
-
let selectedIds = $state<string[]>([]);
let isCreateDialogOpen = $state(false);
+ let isLoading = $state({ creating: false, refresh: false });
- let isLoading = $state({
- creating: false,
- refresh: false,
- removingSelected: false
- });
+ async function refresh() {
+ await parallelRefresh(
+ {
+ volumes: {
+ fetch: () => volumeService.getVolumes(requestOptions),
+ onSuccess: (data) => (volumes = data),
+ errorMessage: m.common_refresh_failed({ resource: m.volumes_title() })
+ },
+ counts: {
+ fetch: () => volumeService.getVolumeUsageCounts(),
+ onSuccess: (data) => (volumeUsageCounts = data),
+ errorMessage: m.common_refresh_failed({ resource: m.volumes_title() })
+ }
+ },
+ (v) => (isLoading.refresh = v)
+ );
+ }
- const totalVolumes = $derived(volumeUsageCounts.totalVolumes);
- const usedVolumes = $derived(volumeUsageCounts.volumesInuse);
- const unusedVolumes = $derived(volumeUsageCounts.volumesUnused);
+ useEnvironmentRefresh(refresh);
- async function handleCreateVolumeSubmit(options: VolumeCreateOptions) {
+ async function handleCreate(options: VolumeCreateOptions) {
isLoading.creating = true;
const name = options.Name?.trim() || m.common_unknown();
handleApiResultWithCallbacks({
result: await tryCatch(volumeService.createVolume(options)),
message: m.common_create_failed({ resource: `${m.resource_volume()} "${name}"` }),
- setLoadingState: (value) => (isLoading.creating = value),
+ setLoadingState: (v) => (isLoading.creating = v),
onSuccess: async () => {
toast.success(m.common_create_success({ resource: `${m.resource_volume()} "${name}"` }));
volumes = await volumeService.getVolumes(requestOptions);
@@ -48,49 +59,7 @@
});
}
- async function refreshVolumes() {
- isLoading.refresh = true;
- let refreshingVolumeList = true;
- let refreshingVolumeCounts = true;
- handleApiResultWithCallbacks({
- result: await tryCatch(volumeService.getVolumes(requestOptions)),
- message: m.common_refresh_failed({ resource: m.volumes_title() }),
- setLoadingState: (value) => {
- refreshingVolumeList = value;
- isLoading.refresh = refreshingVolumeCounts || refreshingVolumeList;
- },
- async onSuccess(newVolumes) {
- volumes = newVolumes;
- }
- });
- handleApiResultWithCallbacks({
- result: await tryCatch(volumeService.getVolumeUsageCounts()),
- message: m.common_refresh_failed({ resource: m.volumes_title() }),
- setLoadingState: (value) => {
- refreshingVolumeCounts = value;
- isLoading.refresh = refreshingVolumeCounts || refreshingVolumeList;
- },
- async onSuccess(newVolumeCounts) {
- volumeUsageCounts = newVolumeCounts;
- }
- });
- }
-
- let lastEnvId: string | null = null;
- $effect(() => {
- const env = environmentStore.selected;
- if (!env) return;
- if (lastEnvId === null) {
- lastEnvId = env.id;
- return;
- }
- if (env.id !== lastEnvId) {
- lastEnvId = env.id;
- refreshVolumes();
- }
- });
-
- const actionButtons: ActionButton[] = $derived.by(() => [
+ const actionButtons: ActionButton[] = $derived([
{
id: 'create',
action: 'create',
@@ -103,7 +72,7 @@
id: 'refresh',
action: 'restart',
label: m.common_refresh(),
- onclick: refreshVolumes,
+ onclick: refresh,
loading: isLoading.refresh,
disabled: isLoading.refresh
}
@@ -112,21 +81,21 @@
const statCards: StatCardConfig[] = $derived([
{
title: m.volumes_stat_total(),
- value: totalVolumes,
+ value: volumeUsageCounts.totalVolumes,
icon: HardDriveIcon,
iconColor: 'text-blue-500',
class: 'border-l-4 border-l-blue-500'
},
{
title: m.volumes_stat_used(),
- value: usedVolumes,
+ value: volumeUsageCounts.volumesInuse,
icon: ArchiveRestoreIcon,
iconColor: 'text-green-500',
class: 'border-l-4 border-l-green-500'
},
{
title: m.volumes_stat_unused(),
- value: unusedVolumes,
+ value: volumeUsageCounts.volumesUnused,
icon: ArchiveXIcon,
iconColor: 'text-red-500',
class: 'border-l-4 border-l-red-500'
@@ -140,6 +109,6 @@
{/snippet}
{#snippet additionalContent()}
- <CreateVolumeSheet bind:open={isCreateDialogOpen} isLoading={isLoading.creating} onSubmit={handleCreateVolumeSubmit} />
+ <CreateVolumeSheet bind:open={isCreateDialogOpen} isLoading={isLoading.creating} onSubmit={handleCreate} />
{/snippet}
</ResourcePageLayout>
diff --git a/frontend/src/routes/volumes/+page.ts b/frontend/src/routes/(app)/volumes/+page.ts
similarity index 100%
rename from frontend/src/routes/volumes/+page.ts
rename to frontend/src/routes/(app)/volumes/+page.ts
diff --git a/frontend/src/routes/volumes/[volumeName]/+page.svelte b/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
similarity index 100%
rename from frontend/src/routes/volumes/[volumeName]/+page.svelte
rename to frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
diff --git a/frontend/src/routes/volumes/[volumeName]/+page.ts b/frontend/src/routes/(app)/volumes/[volumeName]/+page.ts
similarity index 100%
rename from frontend/src/routes/volumes/[volumeName]/+page.ts
rename to frontend/src/routes/(app)/volumes/[volumeName]/+page.ts
diff --git a/frontend/src/routes/volumes/volume-table.svelte b/frontend/src/routes/(app)/volumes/volume-table.svelte
similarity index 100%
rename from frontend/src/routes/volumes/volume-table.svelte
rename to frontend/src/routes/(app)/volumes/volume-table.svelte
diff --git a/frontend/src/routes/(auth)/+layout.svelte b/frontend/src/routes/(auth)/+layout.svelte
new file mode 100644
index 000000000..099aa46f6
--- /dev/null
+++ b/frontend/src/routes/(auth)/+layout.svelte
@@ -0,0 +1,9 @@
+<script lang="ts">
+ import type { Snippet } from 'svelte';
+
+ let { children }: { children: Snippet } = $props();
+</script>
+
+<main class="flex-1">
+ {@render children()}
+</main>
diff --git a/frontend/src/routes/auth/login/+page.svelte b/frontend/src/routes/(auth)/login/+page.svelte
similarity index 99%
rename from frontend/src/routes/auth/login/+page.svelte
rename to frontend/src/routes/(auth)/login/+page.svelte
index b51f6b075..07901bf67 100644
--- a/frontend/src/routes/auth/login/+page.svelte
+++ b/frontend/src/routes/(auth)/login/+page.svelte
@@ -34,7 +34,7 @@
function handleOidcLogin() {
const currentRedirect = data.redirectTo || '/dashboard';
- goto(`/auth/oidc/login?redirect=${encodeURIComponent(currentRedirect)}`);
+ goto(`/oidc/login?redirect=${encodeURIComponent(currentRedirect)}`);
}
async function handleLogin(event: Event) {
diff --git a/frontend/src/routes/auth/login/+page.ts b/frontend/src/routes/(auth)/login/+page.ts
similarity index 100%
rename from frontend/src/routes/auth/login/+page.ts
rename to frontend/src/routes/(auth)/login/+page.ts
diff --git a/frontend/src/routes/auth/logout/+page.ts b/frontend/src/routes/(auth)/logout/+page.ts
similarity index 91%
rename from frontend/src/routes/auth/logout/+page.ts
rename to frontend/src/routes/(auth)/logout/+page.ts
index 06dc2d989..03b2f0283 100644
--- a/frontend/src/routes/auth/logout/+page.ts
+++ b/frontend/src/routes/(auth)/logout/+page.ts
@@ -14,5 +14,5 @@ export const load: PageLoad = async ({ fetch }) => {
authService.logout();
- throw redirect(302, '/auth/login');
+ throw redirect(302, '/login');
};
diff --git a/frontend/src/routes/auth/oidc/callback/+page.svelte b/frontend/src/routes/(auth)/oidc/callback/+page.svelte
similarity index 92%
rename from frontend/src/routes/auth/oidc/callback/+page.svelte
rename to frontend/src/routes/(auth)/oidc/callback/+page.svelte
index 0b51cea55..ae76a2e56 100644
--- a/frontend/src/routes/auth/oidc/callback/+page.svelte
+++ b/frontend/src/routes/(auth)/oidc/callback/+page.svelte
@@ -32,14 +32,14 @@
}
error = errorDescription || userMessage;
- setTimeout(() => goto('/auth/login?error=oidc_provider_error'), 3000);
+ setTimeout(() => goto('/login?error=oidc_provider_error'), 3000);
isProcessing = false;
return;
}
if (!code || !stateFromUrl) {
error = m.auth_oidc_invalid_response();
- setTimeout(() => goto('/auth/login?error=oidc_invalid_response'), 3000);
+ setTimeout(() => goto('/login?error=oidc_invalid_response'), 3000);
isProcessing = false;
return;
}
@@ -55,7 +55,7 @@
}
error = userMessage;
- setTimeout(() => goto('/auth/login?error=oidc_auth_failed'), 3000);
+ setTimeout(() => goto('/login?error=oidc_auth_failed'), 3000);
isProcessing = false;
return;
}
@@ -89,7 +89,7 @@
finalizeLogin();
} else {
error = m.auth_oidc_user_info_missing();
- setTimeout(() => goto('/auth/login?error=oidc_user_info_missing'), 3000);
+ setTimeout(() => goto('/login?error=oidc_user_info_missing'), 3000);
isProcessing = false;
}
} catch (err: any) {
@@ -101,7 +101,7 @@
}
error = userMessage;
- setTimeout(() => goto('/auth/login?error=oidc_callback_error'), 3000);
+ setTimeout(() => goto('/login?error=oidc_callback_error'), 3000);
isProcessing = false;
}
});
diff --git a/frontend/src/routes/auth/oidc/login/+page.svelte b/frontend/src/routes/(auth)/oidc/login/+page.svelte
similarity index 93%
rename from frontend/src/routes/auth/oidc/login/+page.svelte
rename to frontend/src/routes/(auth)/oidc/login/+page.svelte
index 614edaaec..23367c5e2 100644
--- a/frontend/src/routes/auth/oidc/login/+page.svelte
+++ b/frontend/src/routes/(auth)/oidc/login/+page.svelte
@@ -15,7 +15,7 @@
const authUrl = await authService.getAuthUrl(redirect);
if (!authUrl) {
error = m.auth_oidc_url_generation_failed();
- setTimeout(() => goto('/auth/login?error=oidc_url_generation_failed'), 3000);
+ setTimeout(() => goto('/login?error=oidc_url_generation_failed'), 3000);
isRedirecting = false;
return;
}
@@ -33,7 +33,7 @@
}
error = userMessage;
- setTimeout(() => goto('/auth/login?error=oidc_init_failed'), 3000);
+ setTimeout(() => goto('/login?error=oidc_init_failed'), 3000);
isRedirecting = false;
}
});
diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte
index 81aff2ace..470cf014f 100644
--- a/frontend/src/routes/+layout.svelte
+++ b/frontend/src/routes/+layout.svelte
@@ -4,10 +4,6 @@
import { Toaster } from '$lib/components/ui/sonner/index.js';
import { navigating, page } from '$app/state';
import ConfirmDialog from '$lib/components/confirm-dialog/confirm-dialog.svelte';
- import * as Sidebar from '$lib/components/ui/sidebar/index.js';
- import AppSidebar from '$lib/components/sidebar/sidebar.svelte';
- import { goto, afterNavigate } from '$app/navigation';
- import { getAuthRedirectPath } from '$lib/utils/redirect.util';
import LoadingIndicator from '$lib/components/loading-indicator.svelte';
import type { LayoutData } from './$types';
import type { Snippet } from 'svelte';
@@ -15,8 +11,6 @@
import { m } from '$lib/paraglide/messages';
import { IsMobile } from '$lib/hooks/is-mobile.svelte.js';
import { IsTablet } from '$lib/hooks/is-tablet.svelte.js';
- import MobileNav from '$lib/components/mobile-nav/mobile-nav.svelte';
- import { getEffectiveNavigationSettings, navigationSettingsOverridesStore } from '$lib/utils/navigation.utils';
import { browser, dev } from '$app/environment';
import { onMount } from 'svelte';
import settingsStore from '$lib/stores/config-store';
@@ -38,8 +32,6 @@
}
});
- const versionInformation = $derived(data.versionInformation);
- const user = $derived(data.user);
const settings = $derived(data.settings);
let isGlassEnabled = $state(false);
@@ -47,7 +39,6 @@
isGlassEnabled = settings?.glassEffectEnabled ?? false;
});
- // Apply glass-enabled class to body based on settings
$effect(() => {
if (browser && settings) {
const enabled = $settingsStore?.glassEffectEnabled ?? settings.glassEffectEnabled ?? false;
@@ -63,19 +54,17 @@
const isMobile = new IsMobile();
const isTablet = new IsTablet();
const isNavigating = $derived(navigating.type !== null);
- const isLoginPage = $derived(
- String(page.url.pathname) === '/login' ||
- String(page.url.pathname).startsWith('/auth/login') ||
- String(page.url.pathname) === '/auth' ||
- String(page.url.pathname).includes('/login') ||
- String(page.url.pathname).includes('/callback')
+
+ const isAuthPage = $derived(
+ String(page.url.pathname).startsWith('/login') ||
+ String(page.url.pathname).startsWith('/logout') ||
+ String(page.url.pathname).startsWith('/oidc')
);
+
let showPasswordChangeDialog = $state(false);
$effect(() => {
- // Show password change dialog if user requires password change
- // Make it reactive to data changes
- if (data.user && data.user.requiresPasswordChange && !isLoginPage) {
+ if (data.user && data.user.requiresPasswordChange && !isAuthPage) {
showPasswordChangeDialog = true;
} else {
showPasswordChangeDialog = false;
@@ -85,32 +74,6 @@
function handlePasswordChangeSuccess() {
invalidateAll();
}
-
- const navigationSettings = $derived.by(() => {
- settings;
- navigationSettingsOverridesStore.current;
- return getEffectiveNavigationSettings();
- });
- const navigationMode = $derived(navigationSettings.mode);
-
- $effect(() => {
- const redirectPath = getAuthRedirectPath(page.url.pathname, user);
- if (redirectPath) {
- goto(redirectPath);
- }
- });
-
- if (browser) {
- afterNavigate((event) => {
- if (!event.from) {
- return;
- }
-
- if (isMobile.current || isTablet.current) {
- window.scrollTo({ top: 0, left: 0, behavior: 'auto' });
- }
- });
- }
</script>
<svelte:head><title>{m.layout_title()}</title></svelte:head>
@@ -118,39 +81,8 @@
<div class={cn('flex min-h-dvh flex-col', isGlassEnabled ? 'bg-transparent' : 'bg-background')}>
{#if !settings}
<Error message={m.error_occurred()} showButton={true} />
- {:else if !isLoginPage}
- {#if isMobile.current}
- <main class="flex-1">
- <section
- class={cn(
- 'px-2',
- navigationMode === 'docked'
- ? navigationSettings.scrollToHide
- ? 'pt-5 sm:px-5 sm:pt-5'
- : 'pt-5 pb-(--mobile-docked-nav-offset,calc(3.5rem+env(safe-area-inset-bottom))) sm:p-5'
- : navigationSettings.scrollToHide
- ? 'py-5 sm:p-5'
- : 'py-5 pb-(--mobile-floating-nav-offset,6rem) sm:p-5'
- )}
- >
- {@render children()}
- </section>
- </main>
- <MobileNav {navigationSettings} {user} {versionInformation} />
- {:else}
- <Sidebar.Provider>
- <AppSidebar {versionInformation} {user} />
- <main class="flex-1">
- <section class="p-5">
- {@render children()}
- </section>
- </main>
- </Sidebar.Provider>
- {/if}
{:else}
- <main class="flex-1">
- {@render children()}
- </main>
+ {@render children()}
{/if}
</div>
diff --git a/frontend/src/routes/+page.ts b/frontend/src/routes/+page.ts
index e3bf628c8..85dc086ad 100644
--- a/frontend/src/routes/+page.ts
+++ b/frontend/src/routes/+page.ts
@@ -2,5 +2,5 @@ import { redirect } from '@sveltejs/kit';
import type { PageLoad } from './$types';
export const load: PageLoad = async () => {
- return redirect(302, '/auth/login');
+ return redirect(302, '/login');
};
diff --git a/frontend/src/routes/images/+page.svelte b/frontend/src/routes/images/+page.svelte
deleted file mode 100644
index 03d448fea..000000000
--- a/frontend/src/routes/images/+page.svelte
+++ /dev/null
@@ -1,379 +0,0 @@
-<script lang="ts">
- import { Button } from '$lib/components/ui/button/index.js';
- import { Spinner } from '$lib/components/ui/spinner/index.js';
- import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
- import PackageIcon from '@lucide/svelte/icons/package';
- import XIcon from '@lucide/svelte/icons/x';
- import { toast } from 'svelte-sonner';
- import ImagePullSheet from '$lib/components/sheets/image-pull-sheet.svelte';
- import bytes from 'bytes';
- import * as Dialog from '$lib/components/ui/dialog/index.js';
- import { displaySize, FileDropZone, MEGABYTE, type FileDropZoneProps } from '$lib/components/ui/file-drop-zone';
- import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
- import { tryCatch } from '$lib/utils/try-catch';
- import ImageTable from './image-table.svelte';
- import { m } from '$lib/paraglide/messages';
- import { imageService } from '$lib/services/image-service';
- import { environmentStore } from '$lib/stores/environment.store.svelte';
- import { untrack } from 'svelte';
- import { ResourcePageLayout, type ActionButton, type StatCardConfig } from '$lib/layouts/index.js';
-
- let { data } = $props();
-
- let images = $state(untrack(() => data.images));
- let imageUsageCounts = $state(untrack(() => data.imageUsageCounts));
- let requestOptions = $state(untrack(() => data.imageRequestOptions));
- let selectedIds = $state<string[]>([]);
-
- let isLoading = $state({
- pulling: false,
- uploading: false,
- refreshing: false,
- pruning: false,
- checking: false
- });
-
- let isPullDialogOpen = $state(false);
- let isUploadDialogOpen = $state(false);
- let isConfirmPruneDialogOpen = $state(false);
- let uploadedFiles = $state<File[]>([]);
-
- // Get max upload size from settings (default 500MB)
- const maxUploadSizeMB = $derived(parseInt(String(data.settings?.maxImageUploadSize || '500'), 10));
-
- async function handlePruneImages() {
- isLoading.pruning = true;
- const dangling = data.settings?.dockerPruneMode === 'dangling';
- handleApiResultWithCallbacks({
- result: await tryCatch(imageService.pruneImages(dangling)),
- message: m.images_prune_failed(),
- setLoadingState: (value) => (isLoading.pruning = value),
- onSuccess: async () => {
- toast.success(m.images_pruned_success());
- images = await imageService.getImages(requestOptions);
- isConfirmPruneDialogOpen = false;
- }
- });
- }
-
- const onUpload: FileDropZoneProps['onUpload'] = async (files) => {
- uploadedFiles = [...uploadedFiles, ...files];
- };
-
- const onFileRejected: FileDropZoneProps['onFileRejected'] = async ({ reason, file }) => {
- toast.error(`${file.name} failed to upload!`, { description: reason });
- };
-
- const removeFile = (index: number) => {
- uploadedFiles = [...uploadedFiles.slice(0, index), ...uploadedFiles.slice(index + 1)];
- };
-
- async function handleUploadImages() {
- if (uploadedFiles.length === 0) {
- toast.error(m.images_upload_file_required());
- return;
- }
-
- isLoading.uploading = true;
-
- for (const file of uploadedFiles) {
- handleApiResultWithCallbacks({
- result: await tryCatch(imageService.uploadImage(file)),
- message: m.images_upload_failed(),
- setLoadingState: (value) => (isLoading.uploading = value),
- onSuccess: async () => {
- toast.success(m.images_upload_success());
- }
- });
- }
-
- images = await imageService.getImages(requestOptions);
- uploadedFiles = [];
- isUploadDialogOpen = false;
- isLoading.uploading = false;
- }
-
- async function handleTriggerBulkUpdateCheck() {
- isLoading.checking = true;
- try {
- await imageService.checkAllImages();
- toast.success(m.images_update_check_completed());
- images = await imageService.getImages(requestOptions);
- } catch (error) {
- console.error('Failed to check for updates:', error);
- toast.error(m.images_update_check_failed());
- } finally {
- isLoading.checking = false;
- }
- }
-
- async function refreshImages() {
- isLoading.refreshing = true;
- let refreshingImageList = true;
- let refreshingImageCounts = true;
- handleApiResultWithCallbacks({
- result: await tryCatch(imageService.getImages(requestOptions)),
- message: m.common_refresh_failed({ resource: m.images_title() }),
- setLoadingState: (value) => {
- refreshingImageList = value;
- isLoading.refreshing = refreshingImageCounts || refreshingImageList;
- },
- async onSuccess(newImages) {
- images = newImages;
- }
- });
- handleApiResultWithCallbacks({
- result: await tryCatch(imageService.getImageUsageCounts()),
- message: m.common_refresh_failed({ resource: m.images_title() }),
- setLoadingState: (value) => {
- refreshingImageCounts = value;
- isLoading.refreshing = refreshingImageCounts || refreshingImageList;
- },
- async onSuccess(newImageCounts) {
- imageUsageCounts = newImageCounts;
- }
- });
- }
-
- let lastEnvId: string | null = null;
- $effect(() => {
- const env = environmentStore.selected;
- if (!env) return;
- if (lastEnvId === null) {
- lastEnvId = env.id;
- return;
- }
- if (env.id !== lastEnvId) {
- lastEnvId = env.id;
- refreshImages();
- }
- });
-
- const actionButtons: ActionButton[] = $derived.by(() => [
- {
- id: 'pull',
- action: 'pull',
- label: m.images_pull_image(),
- onclick: () => (isPullDialogOpen = true)
- },
- {
- id: 'upload',
- action: 'create',
- label: m.images_upload_image(),
- onclick: () => (isUploadDialogOpen = true)
- },
- {
- id: 'check-updates',
- action: 'inspect',
- label: m.images_check_updates(),
- loadingLabel: m.common_action_checking(),
- onclick: handleTriggerBulkUpdateCheck,
- loading: isLoading.checking,
- disabled: isLoading.checking
- },
- {
- id: 'refresh',
- action: 'restart',
- label: m.common_refresh(),
- onclick: refreshImages,
- loading: isLoading.refreshing,
- disabled: isLoading.refreshing
- },
- {
- id: 'prune',
- action: 'remove',
- label: m.images_prune_unused(),
- loadingLabel: m.common_action_pruning(),
- onclick: () => (isConfirmPruneDialogOpen = true),
- loading: isLoading.pruning,
- disabled: isLoading.pruning
- }
- ]);
-
- const statCards: StatCardConfig[] = $derived([
- {
- title: m.images_total(),
- value: imageUsageCounts.totalImages,
- icon: HardDriveIcon,
- iconColor: 'text-blue-500',
- class: 'border-l-4 border-l-blue-500'
- },
- {
- title: m.images_total_size(),
- value: String(bytes.format(imageUsageCounts.totalImageSize)),
- icon: PackageIcon,
- iconColor: 'text-amber-500',
- class: 'border-l-4 border-l-amber-500'
- }
- ]);
-</script>
-
-<ResourcePageLayout title={m.images_title()} subtitle={m.images_subtitle()} {actionButtons} {statCards} statCardsColumns={2}>
- {#snippet mainContent()}
- <ImageTable
- bind:images
- bind:selectedIds
- bind:requestOptions
- onImageUpdated={async () => {
- images = await imageService.getImages(requestOptions);
- }}
- />
- {/snippet}
-
- {#snippet additionalContent()}
- <ImagePullSheet
- bind:open={isPullDialogOpen}
- onPullFinished={async () => (images = await imageService.getImages(requestOptions))}
- />
-
- <Dialog.Root bind:open={isUploadDialogOpen}>
- <Dialog.Content class="max-w-2xl">
- <Dialog.Header>
- <Dialog.Title>{m.images_upload_image()}</Dialog.Title>
- <Dialog.Description>
- {m.images_upload_description()}
- </Dialog.Description>
- </Dialog.Header>
- <div class="space-y-4 py-4">
- <FileDropZone
- {onUpload}
- {onFileRejected}
- maxFileSize={maxUploadSizeMB * MEGABYTE}
- accept=".tar,.tar.gz,.tgz,.tar.xz"
- maxFiles={10}
- fileCount={uploadedFiles.length}
- disabled={isLoading.uploading}
- />
- {#if uploadedFiles.length > 0}
- <div class="flex flex-col gap-2">
- {#each uploadedFiles as file, i (file.name)}
- <div class="border-border bg-muted/50 flex items-center justify-between gap-2 rounded-lg border p-3">
- <div class="flex flex-col">
- <span class="text-sm font-medium">{file.name}</span>
- <span class="text-muted-foreground text-xs">{displaySize(file.size)}</span>
- </div>
- <Button variant="ghost" size="icon" onclick={() => removeFile(i)} disabled={isLoading.uploading}>
- <XIcon class="size-4" />
- </Button>
- </div>
- {/each}
- </div>
- {/if}
-
- {#if isLoading.uploading}
- <div class="text-muted-foreground flex items-center gap-2 text-sm">
- <Spinner class="size-4" />
- {m.images_uploading()}
- </div>
- {/if}
- </div>
- <div class="flex justify-end gap-3">
- <Button
- variant="outline"
- onclick={() => {
- isUploadDialogOpen = false;
- uploadedFiles = [];
- }}
- disabled={isLoading.uploading}
- >
- {m.common_cancel()}
- </Button>
- <Button onclick={handleUploadImages} disabled={isLoading.uploading || uploadedFiles.length === 0}>
- {#if isLoading.uploading}
- <Spinner class="mr-2 size-4" />
- {/if}
- {m.images_upload_image()}
- </Button>
- </div>
- </Dialog.Content>
- </Dialog.Root>
-
- <Dialog.Root bind:open={isConfirmPruneDialogOpen}>
- <Dialog.Content>
- <Dialog.Header>
- <Dialog.Title>{m.images_prune_confirm_title()}</Dialog.Title>
- <Dialog.Description>
- {m.images_prune_confirm_description({ mode: String(data.settings.dockerPruneMode) })}
- </Dialog.Description>
- </Dialog.Header>
- <div class="flex justify-end gap-3 pt-6">
- <Button variant="outline" onclick={() => (isConfirmPruneDialogOpen = false)} disabled={isLoading.pruning}>
- {m.common_cancel()}
- </Button>
- <Button variant="destructive" onclick={handlePruneImages} disabled={isLoading.pruning}>
- {#if isLoading.pruning}
- <Spinner class="mr-2 size-4" /> {m.common_action_pruning()}
- {:else}
- {m.images_prune_action()}
- {/if}
- </Button>
- </div>
- </Dialog.Content>
- </Dialog.Root>
- {/snippet}
-</ResourcePageLayout>
-
-<style>
- :global(body) {
- overflow-x: hidden;
- }
-
- :global([data-radix-popper-content-wrapper]) {
- position: fixed !important;
- z-index: 50;
- }
-
- :global([data-radix-dropdown-menu-content]) {
- position: fixed !important;
- z-index: 50;
- }
-
- :global(.tooltip-with-arrow) {
- position: relative;
- overflow: visible;
- }
-
- :global(.tooltip-with-arrow::before) {
- content: '';
- position: absolute;
- width: 8px;
- height: 8px;
- background-color: color-mix(in oklch, var(--glass-base, var(--bg-surface)) calc(var(--glass-bg-alpha) * 100%), transparent);
- border: 1px solid
- color-mix(in oklch, var(--glass-base, var(--bg-surface)) calc(var(--glass-border-alpha) * 100%), transparent);
- z-index: 1;
- }
-
- :global(.tooltip-with-arrow[data-side='top']::before) {
- bottom: -4px;
- left: 50%;
- transform: translateX(-50%) rotate(45deg);
- border-top: none;
- border-left: none;
- }
-
- :global(.tooltip-with-arrow[data-side='bottom']::before) {
- top: -4px;
- left: 50%;
- transform: translateX(-50%) rotate(225deg);
- border-bottom: none;
- border-right: none;
- }
-
- :global(.tooltip-with-arrow[data-side='left']::before) {
- top: 50%;
- right: -4px;
- transform: translateY(-50%) rotate(-45deg);
- border-left: none;
- border-bottom: none;
- }
-
- :global(.tooltip-with-arrow[data-side='right']::before) {
- top: 50%;
- left: -4px;
- transform: translateY(-50%) rotate(-45deg);
- border-left: none;
- border-top: none;
- box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.05);
- }
-</style>
diff --git a/frontend/src/routes/projects/components/ServicesGrid.svelte b/frontend/src/routes/projects/components/ServicesGrid.svelte
deleted file mode 100644
index 343dd163e..000000000
--- a/frontend/src/routes/projects/components/ServicesGrid.svelte
+++ /dev/null
@@ -1,117 +0,0 @@
-<script lang="ts">
- import * as Card from '$lib/components/ui/card';
- import LayersIcon from '@lucide/svelte/icons/layers';
- import HeartPulseIcon from '@lucide/svelte/icons/heart-pulse';
- import StatusBadge from '$lib/components/badges/status-badge.svelte';
- import { getStatusVariant } from '$lib/utils/status.utils';
- import { capitalizeFirstLetter } from '$lib/utils/string.utils';
- import { m } from '$lib/paraglide/messages';
- import { Badge } from '$lib/components/ui/badge';
-
- type Service = {
- container_id?: string;
- container_name?: string;
- name: string;
- status?: string;
- health?: string;
- };
-
- let { services, projectId }: { services?: Service[]; projectId?: string } = $props();
-
- function getHealthColor(health: string | undefined): string {
- if (!health) return 'text-amber-500';
- const normalized = health.toLowerCase();
- if (normalized === 'healthy') return 'text-green-500';
- if (normalized === 'unhealthy') return 'text-red-500';
- return 'text-amber-500';
- }
-</script>
-
-<Card.Root>
- <Card.Header icon={LayersIcon}>
- <div class="flex flex-col space-y-1.5">
- <Card.Title>
- <h2>
- {m.compose_services()}
- </h2>
- </Card.Title>
- <Card.Description>{m.compose_services_description()}</Card.Description>
- </div>
- </Card.Header>
- <Card.Content class="p-4">
- {#if services && services.length > 0}
- <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
- {#each services as service (service.container_id || service.name)}
- {@const status = service.status || 'unknown'}
- {@const containerUrl = projectId
- ? `/containers/${service.container_id}?from=project&projectId=${projectId}`
- : `/containers/${service.container_id}`}
-
- {#if service.container_id}
- <a href={containerUrl} class="group">
- <Card.Root
- variant="subtle"
- class="group-hover:border-border/60 group-hover:bg-muted/50 flex h-full cursor-pointer transition-all duration-200"
- >
- <Card.Content class="flex flex-col p-4">
- <div class="flex items-start gap-3">
- <div class="rounded-lg bg-blue-500/10 p-2 transition-colors group-hover:bg-blue-500/15">
- <LayersIcon class="size-5 text-blue-500" />
- </div>
- <div class="min-w-0 flex-1">
- <div class="mb-2 flex items-center gap-2">
- <h3 class="text-foreground text-base font-semibold transition-colors">
- {service.container_name || service.name}
- </h3>
- <Badge variant="outline" class="text-xs">
- {service.name}
- </Badge>
- </div>
- <div class="flex flex-wrap items-center gap-3">
- <StatusBadge variant={getStatusVariant(status)} text={capitalizeFirstLetter(status)} />
- {#if service.health}
- {@const healthColor = getHealthColor(service.health)}
- <div class="flex items-center gap-1.5">
- <HeartPulseIcon class="{healthColor} size-4" />
- <span class="text-muted-foreground text-xs">{capitalizeFirstLetter(service.health)}</span>
- </div>
- {/if}
- </div>
- <p class="text-muted-foreground mt-2 text-xs">{m.compose_active_container()}</p>
- </div>
- </div>
- </Card.Content>
- </Card.Root>
- </a>
- {:else}
- <Card.Root variant="subtle" class="flex h-full opacity-60">
- <Card.Content class="flex flex-col p-4">
- <div class="flex items-start gap-3">
- <div class="rounded-lg bg-amber-500/10 p-2">
- <LayersIcon class="size-5 text-amber-500" />
- </div>
- <div class="min-w-0 flex-1">
- <h3 class="text-foreground mb-2 text-base font-semibold">
- {service.name}
- </h3>
- <StatusBadge variant={getStatusVariant(status)} text={capitalizeFirstLetter(status)} />
- <p class="text-muted-foreground mt-2 text-xs">
- {m.compose_service_not_created()}
- </p>
- </div>
- </div>
- </Card.Content>
- </Card.Root>
- {/if}
- {/each}
- </div>
- {:else}
- <div class="rounded-lg border border-dashed py-12 text-center">
- <div class="bg-muted/50 mx-auto mb-4 flex size-16 items-center justify-center rounded-full">
- <LayersIcon class="text-muted-foreground size-6" />
- </div>
- <div class="text-muted-foreground text-sm">{m.compose_no_services_found()}</div>
- </div>
- {/if}
- </Card.Content>
-</Card.Root>
diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json
index a8f10c8e3..28e696e0f 100644
--- a/frontend/tsconfig.json
+++ b/frontend/tsconfig.json
@@ -1,13 +1,15 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
+ "target": "ES2022",
+ "verbatimModuleSyntax": true,
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
- "sourceMap": true,
+ "sourceMap": false,
"strict": true,
"moduleResolution": "bundler"
}
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index 24bc3d10f..7ed45a01d 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -17,6 +17,11 @@ export default defineConfig({
}),
devtoolsJson()
],
+ build: {
+ target: 'es2022',
+ // Disable gzip reporting to speed up builds
+ reportCompressedSize: false
+ },
server: {
host: process.env.HOST,
proxy: {
diff --git a/go.work b/go.work
new file mode 100644
index 000000000..a55299e03
--- /dev/null
+++ b/go.work
@@ -0,0 +1,7 @@
+go 1.25.4
+
+use (
+ ./backend
+ ./cli
+ ./types
+)
diff --git a/go.work.sum b/go.work.sum
new file mode 100644
index 000000000..a90db0ccc
--- /dev/null
+++ b/go.work.sum
@@ -0,0 +1,315 @@
+cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw=
+cloud.google.com/go v0.121.6/go.mod h1:coChdst4Ea5vUpiALcYKXEpR1S9ZgXbhEzzMcMR66vI=
+cloud.google.com/go/auth v0.16.4/go.mod h1:j10ncYwjX/g3cdX7GpEzsdM+d+ZNsXAbb6qXA7p1Y5M=
+cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c=
+cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10=
+cloud.google.com/go/iam v1.5.2/go.mod h1:SE1vg0N81zQqLzQEwxL2WI6yhetBdbNQuTvIKCSkUHE=
+cloud.google.com/go/longrunning v0.6.7/go.mod h1:EAFV3IZAKmM56TyiE6VAP3VoTzhZzySwI/YI1s/nRsY=
+cloud.google.com/go/monitoring v1.24.2/go.mod h1:x7yzPWcgDRnPEv3sI+jJGBkwl5qINf+6qY4eq0I9B4U=
+cloud.google.com/go/spanner v1.85.0/go.mod h1:9zhmtOEoYV06nE4Orbin0dc/ugHzZW9yXuvaM61rpxs=
+cloud.google.com/go/storage v1.56.0/go.mod h1:Tpuj6t4NweCLzlNbw9Z9iwxEkrSem20AetIeH/shgVU=
+dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA=
+github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4=
+github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA=
+github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo=
+github.com/Azure/azure-sdk-for-go/sdk/azcore v1.18.2/go.mod h1:QyVsSSN64v5TGltphKLQ2sQxe4OBQg0J1eKRcVBnfgE=
+github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.11.0/go.mod h1:okZ+ZURbArNdlJ+ptXoyHNuOETzOl1Oww19rm8I2WLA=
+github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2/go.mod h1:XtLgD3ZD34DAaVIIAyG3objl5DynM3CQ/vMcbBNJZGI=
+github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.5.0/go.mod h1:PXe2h+LKcWTX9afWdZoHyODqR4fBa5boUM/8uJfZ0Jo=
+github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
+github.com/Azure/go-autorest/autorest/adal v0.9.16/go.mod h1:tGMin8I49Yij6AQ+rvV+Xa/zwxYQB5hmsd6DkfAx2+A=
+github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74=
+github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=
+github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
+github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
+github.com/ClickHouse/clickhouse-go v1.4.3/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
+github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.5.3/go.mod h1:dppbR7CwXD4pgtV9t3wD1812RaLDcBjtblcDF5f1vI0=
+github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0/go.mod h1:P4WPRUkOhJC13W//jWpyfJNDAIpvRbAUIYLX/4jtlE0=
+github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0/go.mod h1:ZPpqegjbE99EPKsu3iUWV22A04wzGPcAY/ziSIQEEgs=
+github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.53.0/go.mod h1:cSgYe11MCNYunTnRXrKiR/tHc0eoKjICUuWpNZoVCOo=
+github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
+github.com/Microsoft/go-winio v0.4.21/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84=
+github.com/ProtonMail/go-crypto v1.3.0/go.mod h1:9whxjD8Rbs29b4XWbB8irEcE8KHMqaR2e7GWU1R+/PE=
+github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
+github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
+github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
+github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE=
+github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
+github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
+github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
+github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0Ih0vcRo/gZ1M0=
+github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU=
+github.com/apparentlymart/go-cidr v1.0.1/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc=
+github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
+github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
+github.com/aws/aws-sdk-go v1.49.6/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
+github.com/aws/aws-sdk-go-v2 v1.38.1/go.mod h1:9Q0OoGQoboYIAJyslFyF1f5K1Ryddop8gqMhWx/n4Wg=
+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.0/go.mod h1:/mXlTIVG9jbxkqDnr5UQNQxW1HRYxeGklkM9vAFeabg=
+github.com/aws/aws-sdk-go-v2/config v1.31.3/go.mod h1:jjgx1n7x0FAKl6TnakqrpkHWWKcX3xfWtdnIJs5K9CE=
+github.com/aws/aws-sdk-go-v2/credentials v1.18.7/go.mod h1:/4M5OidTskkgkv+nCIfC9/tbiQ/c8qTox9QcUDV0cgc=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.4/go.mod h1:9xzb8/SV62W6gHQGC/8rrvgNXU6ZoYM3sAIJCIrXJxY=
+github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.10/go.mod h1:3HKuexPDcwLWPaqpW2UR/9n8N/u/3CKcGAzSs8p8u8g=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.4/go.mod h1:l4bdfCD7XyyZA9BolKBo1eLqgaJxl0/x91PL4Yqe0ao=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.4/go.mod h1:yDmJgqOiH4EA8Hndnv4KwAo8jCGTSnM5ASG1nBI+toA=
+github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3/go.mod h1:H5O/EsxDWyU+LP/V8i5sm8cxoZgc2fdNR9bxlOFrQTo=
+github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.4/go.mod h1:SPBBhkJxjcrzJBc+qY85e83MQ2q3qdra8fghhkkyrJg=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.0/go.mod h1:eb3gfbVIxIoGgJsi9pGne19dhCBpK6opTYpQqAmdy44=
+github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.8.4/go.mod h1:b17At0o8inygF+c6FOD3rNyYZufPw62o9XJbSfQPgbo=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.4/go.mod h1:nLEfLnVMmLvyIG58/6gsSA03F1voKGaCfHV7+lR8S7s=
+github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.4/go.mod h1:DnbBOv4FlIXHj2/xmrUQYtawRFC9L9ZmQPz+DBc6X5I=
+github.com/aws/aws-sdk-go-v2/service/s3 v1.87.1/go.mod h1:w5PC+6GHLkvMJKasYGVloB3TduOtROEMqm15HSuIbw4=
+github.com/aws/aws-sdk-go-v2/service/sso v1.28.2/go.mod h1:n9bTZFZcBa9hGGqVz3i/a6+NG0zmZgtkB9qVVFDqPA8=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.34.0/go.mod h1:eknndR9rU8UpE/OmFpqU78V1EcXPKFTTm5l/buZYgvM=
+github.com/aws/aws-sdk-go-v2/service/sts v1.38.0/go.mod h1:bEPcjW7IbolPfK67G1nilqWyoxYMSPrDiIQ3RdIdKgo=
+github.com/aws/smithy-go v1.22.5/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI=
+github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
+github.com/checkpoint-restore/checkpointctl v1.4.0/go.mod h1:ynQ52zQBazgcTZuxpwTFzRinIcAf0haDTC1X1LA/FKA=
+github.com/checkpoint-restore/go-criu/v7 v7.2.0/go.mod h1:u0LCWLg0w4yqqu14aXhiB4YD3a1qd8EcCEg7vda5dwo=
+github.com/chengxilo/virtualterm v1.0.4/go.mod h1:DyxxBZz/x1iqJjFxTFcr6/x+jSpqN0iwWCOK1q10rlY=
+github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk=
+github.com/cilium/ebpf v0.16.0/go.mod h1:L7u2Blt2jMM/vLAVgjxluxtBKlz3/GWjB0dMOEngfwE=
+github.com/clipperhouse/uax29/v2 v2.2.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
+github.com/cloudflare/circl v1.6.0/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
+github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
+github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
+github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f/go.mod h1:HlzOvOjVBOfTGSRXRyY0OiCS/3J1akRGQQpRO/7zyF4=
+github.com/cockroachdb/cockroach-go/v2 v2.1.1/go.mod h1:7NtUnP6eK+l6k483WSYNrq3Kb23bWV10IRV1TyeSpwM=
+github.com/containerd/accelerated-container-image v1.3.0/go.mod h1:EvKVWor6ZQNUyYp0MZm5hw4k21ropuz7EegM+m/Jb/Q=
+github.com/containerd/btrfs/v2 v2.0.0/go.mod h1:swkD/7j9HApWpzl8OHfrHNxppPd9l44DFZdF94BUj9k=
+github.com/containerd/fuse-overlayfs-snapshotter/v2 v2.1.6/go.mod h1:Mau9LZ7ZnyKCIgcNT7sMG5fjaZ9YCOHU5RuolUikhBQ=
+github.com/containerd/go-cni v1.1.13/go.mod h1:nTieub0XDRmvCZ9VI/SBG6PyqT95N4FIhxsauF1vSBI=
+github.com/containerd/go-runc v1.1.0/go.mod h1:xJv2hFF7GvHtTJd9JqTS2UVxMkULUYw4JN5XAUZqH5U=
+github.com/containerd/imgcrypt/v2 v2.0.1/go.mod h1:/qIJL8nxzdzMA2n5iYyyuIY36KfoVQWmgTWdfVtyebM=
+github.com/containerd/nri v0.10.0/go.mod h1:5VyvLa/4uL8FjyO8nis1UjbCutXDpngil17KvBSL6BU=
+github.com/containerd/otelttrpc v0.1.0/go.mod h1:XhoA2VvaGPW1clB2ULwrBZfXVuEWuyOd2NUD1IM0yTg=
+github.com/containerd/stargz-snapshotter v0.17.0/go.mod h1:ySEul1ck7jCE4jqsuFCo8FFLrHU20UWQeI9g7mdsanI=
+github.com/containerd/zfs/v2 v2.0.0-rc.0/go.mod h1:g36g/XCEGDRxUXIFdM3oWAEvmTvhfz/eKWElqg4Secw=
+github.com/containernetworking/cni v1.3.0/go.mod h1:Bs8glZjjFfGPHMw6hQu82RUgEPNGEaBb9KS5KtNMnJ4=
+github.com/containernetworking/plugins v1.8.0/go.mod h1:JG3BxoJifxxHBhG3hFyxyhid7JgRVBu/wtooGEvWf1c=
+github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01/go.mod h1:9rfv8iPl1ZP7aqh9YA68wnZv2NUDbXdcdPHVz0pFbPY=
+github.com/containers/ocicrypt v1.2.1/go.mod h1:aD0AAqfMp0MtwqWgHM1bUwe1anx0VazI108CRrSKINQ=
+github.com/coreos/go-systemd/v22 v22.6.0/go.mod h1:iG+pp635Fo7ZmV/j14KUcmEyWF+0X7Lua8rrTWzYgWU=
+github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
+github.com/cyberphone/json-canonicalization v0.0.0-20241213102144-19d51d7fe467/go.mod h1:uzvlm1mxhHkdfqitSA92i7Se+S9ksOn3a3qmv/kyOCw=
+github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI=
+github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM=
+github.com/danieljoos/wincred v1.2.3/go.mod h1:6qqX0WNrS4RzPZ1tnroDzq9kY3fu1KwE7MRLQK4X0bs=
+github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
+github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA=
+github.com/dvsekhvalnov/jose2go v1.7.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU=
+github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
+github.com/emicklei/go-restful/v3 v3.13.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
+github.com/envoyproxy/go-control-plane v0.13.5-0.20251024222203-75eaa193e329/go.mod h1:Alz8LEClvR7xKsrq3qzoc4N0guvVNSS8KmSChGYr9hs=
+github.com/envoyproxy/go-control-plane/envoy v1.35.0/go.mod h1:09qwbGVuSWWAyN5t/b3iyVfz5+z8QWGrzkoqm/8SbEs=
+github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4=
+github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2TmLfsJ31lvEjwamM4DxlWXU=
+github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw=
+github.com/form3tech-oss/jwt-go v3.2.5+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
+github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY=
+github.com/fsouza/fake-gcs-server v1.17.0/go.mod h1:D1rTE4YCyHFNa99oyJJ5HyclvN/0uQR+pM/VdlL83bw=
+github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
+github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8=
+github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
+github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
+github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
+github.com/gobuffalo/here v0.6.0/go.mod h1:wAG085dHOYqUpf+Ap+WOdrPTp5IYcDAs/x7PLa8Y5fM=
+github.com/gocql/gocql v0.0.0-20210515062232-b7ef815b4556/go.mod h1:DL0ekTmBSTdlNF25Orwt/JMzqIq3EJ4MVa/J/uK64OY=
+github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4=
+github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
+github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
+github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI=
+github.com/golang/glog v1.2.5/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
+github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/google/certtostore v1.0.6/go.mod h1:2N0ZPLkGvQWhYvXaiBGq02r71fnSLfq78VKIWQHr1wo=
+github.com/google/deck v0.0.0-20230104221208-105ad94aa8ae/go.mod h1:DoDv8G58DuLNZF0KysYn0bA/6ZWhmRW3fZE2VnGEH0w=
+github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
+github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ=
+github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/google/go-containerregistry v0.20.6/go.mod h1:T0x8MuoAoKX/873bkeSfLD2FAkwCDf9/HZgsFJ02E2Y=
+github.com/google/go-dap v0.12.0/go.mod h1:tNjCASCm5cqePi/RVXXWEVqtnNLV1KTWtYOqu6rZNzc=
+github.com/google/go-github/v39 v39.2.0/go.mod h1:C1s8C5aCC9L+JXIYpJM5GYytdX52vC1bLvHEF1IhBrE=
+github.com/google/go-intervals v0.0.2/go.mod h1:MkaR3LNRfeKLPmqgJYs4E66z5InYjmCjbbr4TQlcT6Y=
+github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
+github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
+github.com/googleapis/enterprise-certificate-proxy v0.3.6/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA=
+github.com/googleapis/gax-go/v2 v2.15.0/go.mod h1:zVVkkxAQHa1RQpg9z2AUCMnKhi0Qld9rcmyfL1OZhoc=
+github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
+github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0/go.mod h1:hM2alZsMUni80N33RBe6J0e423LB+odMj7d3EMP9l20=
+github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0/go.mod h1:XKMd7iuf/RGPSMJ/U4HP0zS2Z9Fh8Ps9a+6X26m/tmI=
+github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0=
+github.com/hanwen/go-fuse/v2 v2.8.0/go.mod h1:yE6D2PqWwm3CbYRxFXV9xUd8Md5d6NG0WBs5spCswmI=
+github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
+github.com/hashicorp/go-cty-funcs v0.0.0-20250818135842-6aab67130928/go.mod h1:YC9ASYt9Z9sQEAtzCe+yaAzi3E7wcxfRphDXtwZoWC0=
+github.com/hashicorp/go-immutable-radix/v2 v2.1.0/go.mod h1:hgdqLXA4f6NIjRVisM1TJ9aOJVNRqKZj+xDGF6m7PBw=
+github.com/hashicorp/go-retryablehttp v0.7.8/go.mod h1:rjiScheydd+CxvumBsIrFKlx3iS0jrZ7LvzFGFmuKbw=
+github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
+github.com/hashicorp/hcl/v2 v2.24.0/go.mod h1:oGoO1FIQYfn/AgyOhlg9qLC6/nOJPX3qGbkZpYAcqfM=
+github.com/hiddeco/sshsig v0.2.0/go.mod h1:nJc98aGgiH6Yql2doqH4CTBVHexQA40Q+hMMLHP4EqE=
+github.com/intel/goresctrl v0.10.0/go.mod h1:1S8GDqL46GuKb525bxNhIEEkhf4rhVcbSf9DuKhp7mw=
+github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
+github.com/jackc/pgconn v1.14.3/go.mod h1:RZbme4uasqzybK2RK5c65VsHxoyaml09lx3tXOcO/VM=
+github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa/go.mod h1:a/s9Lp5W7n/DD0VrVoyJ00FbP2ytTPDVOivvn2bMlds=
+github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8=
+github.com/jackc/pgproto3/v2 v2.3.3/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
+github.com/jackc/pgtype v1.14.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4=
+github.com/jackc/pgx/v4 v4.18.2/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw=
+github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
+github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
+github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
+github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
+github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw=
+github.com/k0kubun/pp v2.3.0+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg=
+github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
+github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
+github.com/keybase/go-keychain v0.0.1/go.mod h1:PdEILRW3i9D8JcdM+FmY6RwkHGnhHxXwkPPMeUgOK1k=
+github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE=
+github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
+github.com/knqyf263/go-plugin v0.9.0/go.mod h1:2z5lCO1/pez6qGo8CvCxSlBFSEat4MEp1DrnA+f7w8Q=
+github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
+github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq19sBYvuMoyQ4=
+github.com/letsencrypt/boulder v0.0.0-20240620165639-de9c06129bec/go.mod h1:TmwEoGCwIti7BCeJ9hescZgRtatxRE+A72pCoPfmcfk=
+github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
+github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg=
+github.com/markbates/pkger v0.15.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI=
+github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
+github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
+github.com/mdlayher/socket v0.5.1/go.mod h1:TjPLHI1UgwEv5J1B5q0zTZq12A/6H7nKmtTanQE37IQ=
+github.com/mdlayher/vsock v1.2.1/go.mod h1:NRfCibel++DgeMD8z/hP+PPTjlNJsdPOmxcnENvE+SE=
+github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
+github.com/microsoft/go-mssqldb v1.0.0/go.mod h1:+4wZTUnz/SV6nffv+RRRB/ss8jPng5Sho2SmM1l2ts4=
+github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY=
+github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE=
+github.com/mistifyio/go-zfs/v3 v3.1.0/go.mod h1:CzVgeB0RvF2EGzQnytKVvVSDwmKJXxkOTUGbNrTja/k=
+github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg=
+github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
+github.com/moby/policy-helpers v0.0.0-20251105011237-bcaa71c99f14/go.mod h1:HJfK0E8dR+Jpk5anJ3oADg2dRSom1gJK17sqEiiMS7w=
+github.com/moby/profiles/seccomp v0.1.0/go.mod h1:Kqk57vxH6/wuOc5bmqRiSXJ6iEz8Pvo3LQRkv0ytFWs=
+github.com/moby/spdystream v0.5.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI=
+github.com/moby/sys/mount v0.3.4/go.mod h1:KcQJMbQdJHPlq5lcYT+/CjatWM4PuxKe+XLSVS4J6Os=
+github.com/moby/sys/reexec v0.1.0/go.mod h1:EqjBg8F3X7iZe5pU6nRZnYCMUTXoxsjiIfHup5wYIN8=
+github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns=
+github.com/mutecomm/go-sqlcipher/v4 v4.4.0/go.mod h1:PyN04SaWalavxRGH9E8ZftG6Ju7rsPrGmQRjrEaVpiY=
+github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
+github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
+github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8/go.mod h1:86wM1zFnC6/uDBfZGNwB65O+pR2OFi5q/YQaEUid1qA=
+github.com/neo4j/neo4j-go-driver v1.8.1-0.20200803113522-b626aa943eba/go.mod h1:ncO5VaFWh0Nrt+4KT4mOZboaczBZcLuHrG+/sUeP8gI=
+github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
+github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0=
+github.com/opencontainers/runtime-tools v0.9.1-0.20250523060157-0ea5ed0382a2/go.mod h1:MXdPzqAA8pHC58USHqNCSjyLnRQ6D+NjbpP+02Z1U/0=
+github.com/otiai10/copy v1.14.1/go.mod h1:oQwrEDDOci3IM8dJF0d8+jnbfPDllW6vUjNc3DoZm9I=
+github.com/otiai10/mint v1.6.3/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM=
+github.com/package-url/packageurl-go v0.1.1/go.mod h1:uQd4a7Rh3ZsVg5j0lNyAfyxIeGde9yrlhjF78GzeW0c=
+github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
+github.com/pierrec/lz4/v4 v4.1.16/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
+github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
+github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
+github.com/pkg/profile v1.7.0/go.mod h1:8Uer0jas47ZQMJ7VD+OHknK4YDY07LPUC6dEvqDjvNo=
+github.com/proglottis/gpgme v0.1.5/go.mod h1:5LoXMgpE4bttgwwdv9bLs/vwqv3qV7F4glEEZ7mRKrM=
+github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
+github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
+github.com/rqlite/gorqlite v0.0.0-20230708021416-2acd02b70b79/go.mod h1:xF/KoXmrRyahPfo5L7Szb5cAAUl53dMWBh9cMruGEZg=
+github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
+github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY=
+github.com/santhosh-tekuri/jsonschema/v6 v6.0.1/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
+github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U=
+github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE=
+github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
+github.com/serialx/hashring v0.0.0-20200727003509-22c0c7ab6b1b/go.mod h1:/yeG0My1xr/u+HZrFQ1tOQQQQrOawfyMUH13ai5brBc=
+github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
+github.com/sigstore/fulcio v1.7.1/go.mod h1:7lYY+hsd8Dt+IvKQRC+KEhWpCZ/GlmNvwIa5JhypMS8=
+github.com/sigstore/protobuf-specs v0.4.1/go.mod h1:+gXR+38nIa2oEupqDdzg4qSBT0Os+sP7oYv6alWewWc=
+github.com/sigstore/sigstore v1.9.5/go.mod h1:VtxgvGqCmEZN9X2zhFSOkfXxvKUjpy8RpUW39oCtoII=
+github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
+github.com/smallstep/pkcs7 v0.1.1/go.mod h1:dL6j5AIz9GHjVEBTXtW+QliALcgM19RtXaTeyxI+AfA=
+github.com/snowflakedb/gosnowflake v1.6.19/go.mod h1:FM1+PWUdwB9udFDsXdfD58NONC0m+MlOSmQRvimobSM=
+github.com/spiffe/go-spiffe/v2 v2.6.0/go.mod h1:gm2SeUoMZEtpnzPNs2Csc0D/gX33k1xIx7lEzqblHEs=
+github.com/stefanberger/go-pkcs11uri v0.0.0-20230803200340-78284954bff6/go.mod h1:39R/xuhNgVhi+K0/zst4TLrJrVmbm6LVgl4A0+ZFS5M=
+github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
+github.com/sylabs/sif/v2 v2.22.0/go.mod h1:W1XhWTmG1KcG7j5a3KSYdMcUIFvbs240w/MMVW627hs=
+github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
+github.com/tchap/go-patricia/v2 v2.3.3/go.mod h1:VZRHKAb53DLaG+nA9EaYYiaEx6YztwDlLElMsnSHD4k=
+github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM=
+github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399/go.mod h1:LdwHTNJT99C5fTAzDz0ud328OgXz+gierycbcIx2fRs=
+github.com/tonistiigi/go-actions-cache v0.0.0-20250626083717-378c5ed1ddd9/go.mod h1:cD0SB2270BYw6HYKriFn4H6NRLhGj6ytf48YTpsm8LY=
+github.com/tonistiigi/go-archvariant v1.0.0/go.mod h1:TxFmO5VS6vMq2kvs3ht04iPXtu2rUT/erOnGFYfk5Ho=
+github.com/tonistiigi/jaeger-ui-rest v0.0.0-20250408171107-3dd17559e117/go.mod h1:3Ez1Paeg+0Ghu3KwpEGC1HgZ4CHDlg+Ez/5Baeomk54=
+github.com/ulikunitz/xz v0.5.15/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
+github.com/urfave/cli v1.22.17/go.mod h1:b0ht0aqgH/6pBYzzxURyrM4xXNgsoT/n2ZzwQiEhNVo=
+github.com/urfave/cli/v2 v2.27.7/go.mod h1:CyNAG/xg+iAOg0N4MPGZqVmv2rCoP267496AOXUZjA4=
+github.com/vbauerster/mpb/v8 v8.10.2/go.mod h1:+Ja4P92E3/CorSZgfDtK46D7AVbDqmBQRTmyTqPElo0=
+github.com/vishvananda/netlink v1.3.1/go.mod h1:ARtKouGSTGchR8aMwmkzC0qiNPrrWO5JS/XMVl45+b4=
+github.com/vishvananda/netns v0.0.5/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
+github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
+github.com/xanzy/go-gitlab v0.15.0/go.mod h1:8zdQa/ri1dfn8eS3Ir1SyfvOKlw7WBJ8DVThkpGiXrs=
+github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
+github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=
+github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8=
+github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
+github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
+github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
+github.com/zclconf/go-cty v1.17.0/go.mod h1:wqFzcImaLTI6A5HfsRwB0nj5n0MRZFwmey8YoFPPs3U=
+github.com/zeebo/errs v1.4.0/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4=
+github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
+gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE=
+go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E=
+go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng=
+go.opentelemetry.io/contrib/detectors/gcp v1.38.0/go.mod h1:SU+iU7nu5ud4oCb3LQOhIZ3nRLj6FNVrKgtflbaf2ts=
+go.opentelemetry.io/otel/exporters/jaeger v1.17.0/go.mod h1:nPCqOnEH9rNLKqH/+rrUjiMzHJdV1BlpKcTwRTyKkKI=
+go.opentelemetry.io/otel/exporters/prometheus v0.42.0/go.mod h1:f3bYiqNqhoPxkvI2LrXqQVC546K7BuRDL/kKuxkujhA=
+go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0/go.mod h1:fcwWuDuaObkkChiDlhEpSq9+X1C0omv+s5mBtToAQ64=
+go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
+golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc=
+golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
+golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
+golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
+golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
+golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8/go.mod h1:Pi4ztBfryZoJEkyFTI5/Ocsu2jXyDr6iSdgJiYE/uwE=
+golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
+golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
+golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8=
+golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
+golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w=
+golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY=
+golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGNv1ib0J382/DPCRS/BPnsGebyM1Gj5VSDpG8=
+golang.org/x/tools/godoc v0.1.0-deprecated/go.mod h1:qM63CriJ961IHWmnWa9CjZnBndniPt4a3CK0PVB9bIg=
+golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
+google.golang.org/api v0.247.0/go.mod h1:r1qZOPmxXffXg6xS5uhx16Fa/UFY8QU/K4bfKrnvovM=
+google.golang.org/genproto v0.0.0-20250603155806-513f23925822 h1:rHWScKit0gvAPuOnu87KpaYtjK5zBMLcULh7gxkCXu4=
+google.golang.org/genproto v0.0.0-20250603155806-513f23925822/go.mod h1:HubltRL7rMh0LfnQPkMH4NPDFEWp0jw3vixw7jEM53s=
+google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA=
+gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M=
+gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
+gorm.io/driver/sqlite v1.6.0/go.mod h1:AO9V1qIQddBESngQUKWL9yoH93HIeA1X6V633rBwyT8=
+gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g=
+k8s.io/api v0.34.1/go.mod h1:SB80FxFtXn5/gwzCoN6QCtPD7Vbu5w2n1S0J5gFfTYk=
+k8s.io/apimachinery v0.34.1/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw=
+k8s.io/client-go v0.34.1/go.mod h1:kA8v0FP+tk6sZA0yKLRG67LWjqufAoSHA2xVGKw9Of8=
+k8s.io/cri-api v0.34.1/go.mod h1:4qVUjidMg7/Z9YGZpqIDygbkPWkg3mkS1PvOx/kpHTE=
+k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
+k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b/go.mod h1:UZ2yyWbFTpuhSbFhv24aGNOdoRdJZgsIObGBUaYVsts=
+k8s.io/utils v0.0.0-20250604170112-4c0f3b243397/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
+kernel.org/pub/linux/libs/security/libcap/cap v1.2.76/go.mod h1:7V2BQeHnVAQwhCnCPJ977giCeGDiywVewWF+8vkpPlc=
+kernel.org/pub/linux/libs/security/libcap/psx v1.2.76/go.mod h1:+l6Ee2F59XiJ2I6WR5ObpC1utCQJZ/VLsEbQCD8RG24=
+lukechampine.com/uint128 v1.3.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
+modernc.org/b v1.0.0/go.mod h1:uZWcZfRj1BpYzfN9JTerzlNUnnPsV9O2ZA8JsRcubNg=
+modernc.org/cc/v3 v3.41.0/go.mod h1:Ni4zjJYJ04CDOhG7dn640WGfwBzfE0ecX8TyMB0Fv0Y=
+modernc.org/ccgo/v3 v3.16.15/go.mod h1:yT7B+/E2m43tmMOT51GMoM98/MtHIcQQSleGnddkUNI=
+modernc.org/db v1.0.0/go.mod h1:kYD/cO29L/29RM0hXYl4i3+Q5VojL31kTUVpVJDw0s8=
+modernc.org/file v1.0.0/go.mod h1:uqEokAEn1u6e+J45e54dsEA/pw4o7zLrA2GwyntZzjw=
+modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
+modernc.org/internal v1.0.0/go.mod h1:VUD/+JAkhCpvkUitlEOnhpVxCgsBI90oTzSCRcqQVSM=
+modernc.org/lldb v1.0.0/go.mod h1:jcRvJGWfCGodDZz8BPwiKMJxGJngQ/5DrRapkQnLob8=
+modernc.org/ql v1.0.0/go.mod h1:xGVyrLIatPcO2C1JvI/Co8c0sr6y91HKFNy4pt9JXEY=
+modernc.org/zappy v1.0.0/go.mod h1:hHe+oGahLVII/aTTyWK/b53VDHMAGCBYYeZ9sn83HC4=
+rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
+sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
+sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
+sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE=
+sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4=
+tags.cncf.io/container-device-interface/specs-go v1.0.0/go.mod h1:u86hoFWqnh3hWz3esofRFKbI261bUlvUfLKGrDhJkgQ=
diff --git a/greptile.json b/greptile.json
index 20c7b8539..1df7399f8 100644
--- a/greptile.json
+++ b/greptile.json
@@ -1,27 +1,19 @@
{
"labels": [],
- "comment": "**Disclaimer** Greptiles Reviews uses AI, make sure to check over its work",
+ "comment": "**Disclaimer** Greptiles Reviews use AI, make sure to check over its work",
"fixWithAI": true,
"strictness": 2,
"statusCheck": true,
- "commentTypes": [
- "syntax",
- "logic",
- "style"
- ],
+ "commentTypes": ["syntax", "logic", "style"],
"instructions": "",
"disabledLabels": [],
- "excludeAuthors": [
- "dependabot[bot]",
- "blacksmith-sh[bot]",
- "github-actions[bot]"
- ],
+ "excludeAuthors": ["dependabot[bot]", "github-actions[bot]"],
"ignoreKeywords": "chore(translations)",
"includeAuthors": [],
"summarySection": {
"included": true,
"collapsible": true,
- "defaultOpen": false
+ "defaultOpen": true
},
"excludeBranches": [],
"includeBranches": [],
@@ -37,9 +29,10 @@
"defaultOpen": false
},
"sequenceDiagramSection": {
- "included": false,
- "collapsible": false,
+ "included": true,
+ "collapsible": true,
"defaultOpen": false
},
- "shouldUpdateDescription": true
-}
\ No newline at end of file
+ "shouldUpdateDescription": true,
+ "updateExistingSummaryComment": true
+}
diff --git a/scripts/build-docker.sh b/scripts/build-docker.sh
index a9500b075..5261917e4 100755
--- a/scripts/build-docker.sh
+++ b/scripts/build-docker.sh
@@ -1,10 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail
-# Read version from .version file
-VERSION=$(sed 's/^\s*\|\s*$//g' .version || echo "dev")
-# Get git revision (short commit hash)
-REVISION=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
+# Read version and revision from .arcane.json file
+if [ -f .arcane.json ]; then
+ VERSION=$(jq -r '.version // "dev"' .arcane.json)
+ REVISION=$(jq -r '.revision // empty' .arcane.json)
+fi
+VERSION=${VERSION:-"dev"}
+REVISION=${REVISION:-$(git rev-parse --short HEAD 2>/dev/null || "unknown")}
# Parse optional arguments
TAG="${1:-arcane:latest}"
diff --git a/scripts/development/dev.sh b/scripts/development/dev.sh
index 325365a81..cc5dad63a 100755
--- a/scripts/development/dev.sh
+++ b/scripts/development/dev.sh
@@ -6,7 +6,7 @@
set -euo pipefail
# Configuration
-readonly COMPOSE_FILE="docker-compose.dev.yml"
+readonly COMPOSE_FILE="docker/compose.dev.yaml"
readonly PROJECT_NAME="arcane-dev"
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
@@ -207,7 +207,7 @@ show_env_config() {
grep -E "^[A-Z_]+" .env | sort
echo "----------------------------------------"
else
- log_warning "No .env file found. Run 'start' to create one from .env.dev"
+ log_warning "No .env file found (not needed for development - values are in docker/compose.dev.yaml)"
fi
fi
}
@@ -236,31 +236,9 @@ show_logs() {
fi
}
-create_env_file() {
- local env_file=".env"
- local env_dev=".env.dev"
-
- if [[ -f "$env_file" ]]; then
- return 0
- fi
-
- if [[ ! -f "$env_dev" ]]; then
- log_error ".env.dev file not found!"
- log_error "Please ensure .env.dev exists in the project root"
- exit 1
- fi
-
- log_warning ".env file not found, creating from .env.dev..."
- cp "$env_dev" "$env_file"
- log_success "Created .env file from .env.dev template"
- log_info "You can customize the values in .env for your development setup"
-}
-
start_dev() {
log_info "Starting Arcane development environment..."
- create_env_file
-
if ! docker compose -f "${COMPOSE_FILE}" -p "${PROJECT_NAME}" up -d --build; then
log_error "Failed to start development environment"
exit 1
@@ -286,9 +264,6 @@ stop_dev() {
restart_dev() {
log_info "Restarting Arcane development environment..."
- # Check if .env file exists and create if needed (to pick up any new changes)
- create_env_file
-
# Stop containers gracefully to allow Air to clean up properly
log_info "Stopping containers gracefully..."
if ! docker compose -f "${COMPOSE_FILE}" -p "${PROJECT_NAME}" down; then
@@ -722,7 +697,7 @@ show_help() {
echo "Commands:"
echo " start Start the development environment"
echo " stop Stop the development environment"
- echo " restart Restart the development environment (reloads .env file)"
+ echo " restart Restart the development environment"
echo " status Show status of all services"
echo " env Show current environment configuration (optionally specify service: backend, frontend)"
echo " logs Show logs (optionally specify service: frontend, backend, agent)"
diff --git a/scripts/github/build-binaries.sh b/scripts/github/build-binaries.sh
index 19949bb03..a5a05a822 100755
--- a/scripts/github/build-binaries.sh
+++ b/scripts/github/build-binaries.sh
@@ -5,8 +5,14 @@ cd backend
mkdir -p .bin
HOST_OS="$(go env GOHOSTOS)"
-VERSION=${VERSION:-$(sed 's/^\s*\|\s*$//g' ../.version)}
-REVISION=${REVISION:-$(cat ../.revision 2>/dev/null || git rev-parse --short HEAD 2>/dev/null || echo "unknown")}
+
+# Read version and revision from .arcane.json
+if [ -f ../.arcane.json ]; then
+ VERSION=${VERSION:-$(jq -r '.version' ../.arcane.json)}
+ REVISION=${REVISION:-$(jq -r '.revision // empty' ../.arcane.json)}
+fi
+VERSION=${VERSION:-"dev"}
+REVISION=${REVISION:-$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")}
LDFLAGS="-w -s -buildid=${VERSION} \
-X github.com/getarcaneapp/arcane/backend/internal/config.Version=${VERSION} \
diff --git a/scripts/github/create-release.sh b/scripts/github/create-release.sh
index dbfa4aeb2..844f8fea8 100755
--- a/scripts/github/create-release.sh
+++ b/scripts/github/create-release.sh
@@ -2,7 +2,7 @@
set -euo pipefail
# Check if the script is being run from the root of the project
-if [ ! -f .version ] || [ ! -f frontend/package.json ] || [ ! -f CHANGELOG.md ]; then
+if [ ! -f .arcane.json ] || [ ! -f frontend/package.json ] || [ ! -f CHANGELOG.md ]; then
echo "Error: This script must be run from the root of the project."
exit 1
fi
@@ -28,8 +28,8 @@ if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then
exit 1
fi
-# Read the current version from .version
-VERSION=$(cat .version)
+# Read the current version from .arcane.json
+VERSION=$(jq -r '.version' .arcane.json)
# Function to increment the version
increment_version() {
@@ -110,20 +110,17 @@ if [[ "$CONFIRM" != "y" ]]; then
exit 1
fi
-# Update the .version file with the new version
-echo "$NEW_VERSION" > .version
-git add .version
+# Update .arcane.json file with the new version and revision
+echo "Updating .arcane.json file..."
+LATEST_REVISION=$(git rev-parse --short HEAD)
+jq --arg version "$NEW_VERSION" --arg revision "$LATEST_REVISION" \
+ '.version = $version | .revision = $revision' .arcane.json > .arcane_tmp.json && mv .arcane_tmp.json .arcane.json
+git add .arcane.json
# Update version in frontend/package.json
jq --arg new_version "$NEW_VERSION" '.version = $new_version' frontend/package.json > frontend/package_tmp.json && mv frontend/package_tmp.json frontend/package.json
git add frontend/package.json
-# Create/Update .revision file with the latest commit short hash
-echo "Creating/Updating .revision file..."
-LATEST_REVISION=$(git rev-parse --short HEAD)
-echo "$LATEST_REVISION" > .revision
-git add .revision
-
# Generate changelog
echo "Generating changelog..."
git cliff --github-token=$(gh auth token) --prepend CHANGELOG.md --tag "v$NEW_VERSION" --unreleased
diff --git a/scripts/github/hotfix-release.sh b/scripts/github/hotfix-release.sh
index 7d8b3121a..21b8ead38 100755
--- a/scripts/github/hotfix-release.sh
+++ b/scripts/github/hotfix-release.sh
@@ -9,7 +9,7 @@ BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Check if the script is being run from the root of the project
-if [ ! -f .version ] || [ ! -f frontend/package.json ] || [ ! -f CHANGELOG.md ]; then
+if [ ! -f .arcane.json ] || [ ! -f frontend/package.json ] || [ ! -f CHANGELOG.md ]; then
echo -e "${RED}Error: This script must be run from the root of the project.${NC}"
exit 1
fi
@@ -179,19 +179,16 @@ fi
echo ""
echo -e "${BLUE}Finalizing hotfix release ${NEW_TAG}...${NC}"
-# Update .version file
-echo "$NEW_VERSION" > .version
-git add .version
+# Update .arcane.json file with the new version and revision
+LATEST_REVISION=$(git rev-parse --short HEAD)
+jq --arg version "$NEW_VERSION" --arg revision "$LATEST_REVISION" \
+ '.version = $version | .revision = $revision' .arcane.json > .arcane_tmp.json && mv .arcane_tmp.json .arcane.json
+git add .arcane.json
# Update version in frontend/package.json
jq --arg new_version "$NEW_VERSION" '.version = $new_version' frontend/package.json > frontend/package_tmp.json && mv frontend/package_tmp.json frontend/package.json
git add frontend/package.json
-# Create/Update .revision file with the latest commit short hash
-LATEST_REVISION=$(git rev-parse --short HEAD)
-echo "$LATEST_REVISION" > .revision
-git add .revision
-
# Generate changelog for ONLY the fixes in this release branch
echo -e "${BLUE}Generating changelog for hotfix...${NC}"
@@ -259,20 +256,18 @@ echo -e "${BLUE}Updating main branch with version ${NEW_VERSION}...${NC}"
git checkout main
git pull origin main --quiet
-# Update .version file
-echo "$NEW_VERSION" > .version
+# Update .arcane.json file with the new version and revision
+jq --arg version "$NEW_VERSION" --arg revision "$LATEST_REVISION" \
+ '.version = $version | .revision = $revision' .arcane.json > .arcane_tmp.json && mv .arcane_tmp.json .arcane.json
# Update version in frontend/package.json
jq --arg new_version "$NEW_VERSION" '.version = $new_version' frontend/package.json > frontend/package_tmp.json && mv frontend/package_tmp.json frontend/package.json
-# Update .revision file
-echo "$LATEST_REVISION" > .revision
-
# Copy the updated CHANGELOG.md from the release branch
git checkout "${RELEASE_BRANCH}" -- CHANGELOG.md
# Commit the version updates to main
-git add .version frontend/package.json .revision CHANGELOG.md
+git add .arcane.json frontend/package.json CHANGELOG.md
git commit -m "chore: bump version to ${NEW_VERSION} after hotfix release"
git push origin main
diff --git a/types/auth/auth.go b/types/auth/auth.go
new file mode 100644
index 000000000..7c1569d42
--- /dev/null
+++ b/types/auth/auth.go
@@ -0,0 +1,32 @@
+package auth
+
+type Login struct {
+ // Username of the user.
+ //
+ // Required: true
+ Username string `json:"username" binding:"required"`
+
+ // Password of the user.
+ //
+ // Required: true
+ Password string `json:"password" binding:"required"`
+}
+
+type Refresh struct {
+ // RefreshToken is the refresh token used to obtain a new access token.
+ //
+ // Required: true
+ RefreshToken string `json:"refreshToken" binding:"required"`
+}
+
+type PasswordChange struct {
+ // CurrentPassword is the current password of the user.
+ //
+ // Required: false
+ CurrentPassword string `json:"currentPassword"`
+
+ // NewPassword is the new password for the user.
+ //
+ // Required: true
+ NewPassword string `json:"newPassword" binding:"required"`
+}
diff --git a/types/auth/oidc.go b/types/auth/oidc.go
new file mode 100644
index 000000000..397ee74af
--- /dev/null
+++ b/types/auth/oidc.go
@@ -0,0 +1,114 @@
+package auth
+
+// OidcUserInfo represents user information retrieved from an OIDC provider.
+type OidcUserInfo struct {
+ // Subject is the unique identifier for the user at the OIDC provider.
+ //
+ // Required: true
+ Subject string `json:"sub"`
+
+ // Name is the full name of the user.
+ //
+ // Required: false
+ Name string `json:"name,omitempty"`
+
+ // Email is the email address of the user.
+ //
+ // Required: false
+ Email string `json:"email,omitempty"`
+
+ // EmailVerified indicates if the user's email has been verified.
+ //
+ // Required: false
+ EmailVerified bool `json:"email_verified,omitempty"`
+
+ // PreferredUsername is the user's preferred username.
+ //
+ // Required: false
+ PreferredUsername string `json:"preferred_username,omitempty"`
+
+ // GivenName is the user's given name (first name).
+ //
+ // Required: false
+ GivenName string `json:"given_name,omitempty"`
+
+ // FamilyName is the user's family name (last name).
+ //
+ // Required: false
+ FamilyName string `json:"family_name,omitempty"`
+
+ // Admin indicates if the user is an administrator.
+ //
+ // Required: false
+ Admin bool `json:"admin,omitempty"`
+
+ // Roles is a list of roles assigned to the user.
+ //
+ // Required: false
+ Roles []string `json:"roles,omitempty"`
+
+ // Groups is a list of groups the user belongs to.
+ //
+ // Required: false
+ Groups []string `json:"groups,omitempty"`
+
+ // Extra contains additional claims from the userinfo endpoint that are not
+ // part of the standard OIDC claims. This field is not serialized to JSON.
+ //
+ // Required: false
+ Extra map[string]any `json:"-"`
+}
+
+// OidcTokenResponse represents the response from an OIDC token endpoint.
+type OidcTokenResponse struct {
+ // AccessToken is the OAuth 2.0 access token.
+ //
+ // Required: true
+ AccessToken string `json:"access_token"`
+
+ // TokenType specifies the type of the access token (typically "Bearer").
+ //
+ // Required: true
+ TokenType string `json:"token_type"`
+
+ // RefreshToken is the OAuth 2.0 refresh token.
+ //
+ // Required: false
+ RefreshToken string `json:"refresh_token,omitempty"`
+
+ // ExpiresIn is the lifetime of the access token in seconds.
+ //
+ // Required: false
+ ExpiresIn int `json:"expires_in,omitempty"`
+
+ // IDToken is the OpenID Connect ID token.
+ //
+ // Required: false
+ IDToken string `json:"id_token,omitempty"`
+}
+
+// OidcStatusInfo represents the status of OIDC configuration and usage.
+type OidcStatusInfo struct {
+ // EnvForced indicates if OIDC is forced via environment configuration.
+ //
+ // Required: true
+ EnvForced bool `json:"envForced"`
+
+ // EnvConfigured indicates if OIDC is configured via environment variables.
+ //
+ // Required: true
+ EnvConfigured bool `json:"envConfigured"`
+
+ // MergeAccounts indicates if accounts should be merged when using OIDC.
+ //
+ // Required: true
+ MergeAccounts bool `json:"mergeAccounts"`
+}
+
+// OidcAuthUrlRequest is used to request an OIDC authorization URL.
+type OidcAuthUrlRequest struct {
+ // RedirectUri is the URI to redirect to after successful authentication.
+ //
+ // Required: true
+ RedirectUri string `json:"redirectUri"`
+}
diff --git a/types/base/json.go b/types/base/json.go
new file mode 100644
index 000000000..4e515bb8d
--- /dev/null
+++ b/types/base/json.go
@@ -0,0 +1,42 @@
+package base
+
+import (
+ "database/sql/driver"
+ "encoding/json"
+)
+
+// JsonObject is a map-based representation of a JSON object that can be stored
+// in a database. It implements the sql.Valuer and sql.Scanner interfaces for
+// seamless database integration.
+//
+// nolint:recvcheck
+type JsonObject map[string]interface{}
+
+// Value implements the driver.Valuer interface for database storage.
+// It marshals the JsonObject to JSON bytes for database insertion.
+// If the JsonObject is nil, it returns nil.
+func (j JsonObject) Value() (driver.Value, error) {
+ if j == nil {
+ return nil, nil
+ }
+ return json.Marshal(j)
+}
+
+// Scan implements the sql.Scanner interface for database retrieval.
+// It unmarshals JSON data from the database into the JsonObject.
+// Supports scanning from []byte or string values.
+// If the value is nil, the JsonObject is set to nil.
+func (j *JsonObject) Scan(value interface{}) error {
+ if value == nil {
+ *j = nil
+ return nil
+ }
+ switch v := value.(type) {
+ case []byte:
+ return json.Unmarshal(v, j)
+ case string:
+ return json.Unmarshal([]byte(v), j)
+ default:
+ return json.Unmarshal(nil, j)
+ }
+}
diff --git a/types/category/category.go b/types/category/category.go
new file mode 100644
index 000000000..5710784be
--- /dev/null
+++ b/types/category/category.go
@@ -0,0 +1,51 @@
+package category
+
+import "go.getarcane.app/types/meta"
+
+// Category represents a category with associated metadata and settings.
+type Category struct {
+ // ID is the unique identifier of the category.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // Title of the category.
+ //
+ // Required: true
+ Title string `json:"title"`
+
+ // Description of the category.
+ //
+ // Required: true
+ Description string `json:"description"`
+
+ // Icon is the icon identifier or URL for the category.
+ //
+ // Required: true
+ Icon string `json:"icon"`
+
+ // URL is the associated URL for the category.
+ //
+ // Required: true
+ URL string `json:"url"`
+
+ // Keywords is a list of keywords associated with the category.
+ //
+ // Required: true
+ Keywords []string `json:"keywords"`
+
+ // Settings is a list of metadata settings for the category.
+ //
+ // Required: true
+ Settings []meta.Metadata `json:"settings"`
+
+ // MatchingSettings is a list of settings that match a search query.
+ //
+ // Required: false
+ MatchingSettings []meta.Metadata `json:"matchingSettings,omitempty"`
+
+ // RelevanceScore indicates the relevance score for search results.
+ //
+ // Required: false
+ RelevanceScore int `json:"relevanceScore,omitempty"`
+}
diff --git a/types/container/container.go b/types/container/container.go
new file mode 100644
index 000000000..744883d58
--- /dev/null
+++ b/types/container/container.go
@@ -0,0 +1,732 @@
+package container
+
+import (
+ "strconv"
+ "strings"
+
+ "github.com/docker/docker/api/types/container"
+ "github.com/docker/docker/api/types/network"
+ containerregistry "go.getarcane.app/types/containerregistry"
+)
+
+// Create is used to create a new container.
+type Create struct {
+ // Name of the container.
+ //
+ // Required: true
+ Name string `json:"name" binding:"required"`
+
+ // Image to use for the container.
+ //
+ // Required: true
+ Image string `json:"image" binding:"required"`
+
+ // Command to run in the container.
+ //
+ // Required: false
+ Command []string `json:"command,omitempty"`
+
+ // Entrypoint for the container.
+ //
+ // Required: false
+ Entrypoint []string `json:"entrypoint,omitempty"`
+
+ // WorkingDir is the working directory inside the container.
+ //
+ // Required: false
+ WorkingDir string `json:"workingDir,omitempty"`
+
+ // User to run the container as.
+ //
+ // Required: false
+ User string `json:"user,omitempty"`
+
+ // Environment variables for the container.
+ //
+ // Required: false
+ Environment []string `json:"environment,omitempty"`
+
+ // Ports is a map of port bindings.
+ //
+ // Required: false
+ Ports map[string]string `json:"ports,omitempty"`
+
+ // Volumes is a list of volume mounts.
+ //
+ // Required: false
+ Volumes []string `json:"volumes,omitempty"`
+
+ // Networks is a list of networks to connect to.
+ //
+ // Required: false
+ Networks []string `json:"networks,omitempty"`
+
+ // RestartPolicy for the container.
+ //
+ // Required: false
+ RestartPolicy string `json:"restartPolicy,omitempty"`
+
+ // Privileged indicates if the container runs in privileged mode.
+ //
+ // Required: false
+ Privileged bool `json:"privileged,omitempty"`
+
+ // AutoRemove indicates if the container should be removed when stopped.
+ //
+ // Required: false
+ AutoRemove bool `json:"autoRemove,omitempty"`
+
+ // Memory limit for the container in bytes.
+ //
+ // Required: false
+ Memory int64 `json:"memory,omitempty"`
+
+ // CPUs is the number of CPUs to allocate.
+ //
+ // Required: false
+ CPUs float64 `json:"cpus,omitempty"`
+
+ // Credentials for pulling images from private registries.
+ //
+ // Required: false
+ Credentials []containerregistry.Credential `json:"credentials,omitempty"`
+}
+
+// StatusCounts contains counts of containers by status.
+type StatusCounts struct {
+ // RunningContainers is the number of running containers.
+ //
+ // Required: true
+ RunningContainers int `json:"runningContainers"`
+
+ // StoppedContainers is the number of stopped containers.
+ //
+ // Required: true
+ StoppedContainers int `json:"stoppedContainers"`
+
+ // TotalContainers is the total number of containers.
+ //
+ // Required: true
+ TotalContainers int `json:"totalContainers"`
+}
+
+// ActionResult represents the result of a container action (start/stop/etc).
+type ActionResult struct {
+ // Started is a list of container IDs that were started.
+ //
+ // Required: false
+ Started []string `json:"started,omitempty"`
+
+ // Stopped is a list of container IDs that were stopped.
+ //
+ // Required: false
+ Stopped []string `json:"stopped,omitempty"`
+
+ // Failed is a list of container IDs that failed.
+ //
+ // Required: false
+ Failed []string `json:"failed,omitempty"`
+
+ // Success indicates if the overall action was successful.
+ //
+ // Required: true
+ Success bool `json:"success"`
+
+ // Errors is a list of error messages encountered.
+ //
+ // Required: false
+ Errors []string `json:"errors,omitempty"`
+}
+
+// Port represents a port binding for a container.
+type Port struct {
+ // IP address the port is bound to.
+ //
+ // Required: false
+ IP string `json:"ip,omitempty"`
+
+ // PrivatePort is the port inside the container.
+ //
+ // Required: true
+ PrivatePort int `json:"privatePort"`
+
+ // PublicPort is the port on the host.
+ //
+ // Required: false
+ PublicPort int `json:"publicPort,omitempty"`
+
+ // Type is the protocol type (tcp/udp).
+ //
+ // Required: true
+ Type string `json:"type"`
+}
+
+// Mount represents a volume mount for a container.
+type Mount struct {
+ // Type of the mount (bind, volume, tmpfs).
+ //
+ // Required: true
+ Type string `json:"type"`
+
+ // Name of the volume (for volume mounts).
+ //
+ // Required: false
+ Name string `json:"name,omitempty"`
+
+ // Source path on the host.
+ //
+ // Required: false
+ Source string `json:"source,omitempty"`
+
+ // Destination path in the container.
+ //
+ // Required: true
+ Destination string `json:"destination"`
+
+ // Driver is the volume driver (for volume mounts).
+ //
+ // Required: false
+ Driver string `json:"driver,omitempty"`
+
+ // Mode specifies mount permissions.
+ //
+ // Required: false
+ Mode string `json:"mode,omitempty"`
+
+ // RW indicates if the mount is read-write.
+ //
+ // Required: false
+ RW bool `json:"rw,omitempty"`
+
+ // Propagation mode for the mount.
+ //
+ // Required: false
+ Propagation string `json:"propagation,omitempty"`
+}
+
+// NetworkEndpoint represents network endpoint settings for a container.
+type NetworkEndpoint struct {
+ // IPAMConfig contains IP address management configuration.
+ //
+ // Required: false
+ IPAMConfig any `json:"ipamConfig,omitempty"`
+
+ // Links to other containers.
+ //
+ // Required: false
+ Links []string `json:"links,omitempty"`
+
+ // Aliases for the container on this network.
+ //
+ // Required: false
+ Aliases []string `json:"aliases,omitempty"`
+
+ // MacAddress of the container on this network.
+ //
+ // Required: false
+ MacAddress string `json:"macAddress,omitempty"`
+
+ // DriverOpts contains driver-specific options.
+ //
+ // Required: false
+ DriverOpts map[string]string `json:"driverOpts,omitempty"`
+
+ // GwPriority is the gateway priority.
+ //
+ // Required: false
+ GwPriority int `json:"gwPriority,omitempty"`
+
+ // NetworkID is the ID of the network.
+ //
+ // Required: false
+ NetworkID string `json:"networkId,omitempty"`
+
+ // EndpointID is the ID of this endpoint.
+ //
+ // Required: false
+ EndpointID string `json:"endpointId,omitempty"`
+
+ // Gateway address for the network.
+ //
+ // Required: false
+ Gateway string `json:"gateway,omitempty"`
+
+ // IPAddress assigned to the container.
+ //
+ // Required: false
+ IPAddress string `json:"ipAddress,omitempty"`
+
+ // IPPrefixLen is the IP prefix length.
+ //
+ // Required: false
+ IPPrefixLen int `json:"ipPrefixLen,omitempty"`
+
+ // IPv6Gateway address for the network.
+ //
+ // Required: false
+ IPv6Gateway string `json:"ipv6Gateway,omitempty"`
+
+ // GlobalIPv6Address assigned to the container.
+ //
+ // Required: false
+ GlobalIPv6Address string `json:"globalIPv6Address,omitempty"`
+
+ // GlobalIPv6PrefixLen is the IPv6 prefix length.
+ //
+ // Required: false
+ GlobalIPv6PrefixLen int `json:"globalIPv6PrefixLen,omitempty"`
+
+ // DNSNames are DNS names for this endpoint.
+ //
+ // Required: false
+ DNSNames []string `json:"dnsNames,omitempty"`
+}
+
+// NetworkSettings contains network configuration for a container.
+type NetworkSettings struct {
+ // Networks is a map of network name to endpoint settings.
+ //
+ // Required: true
+ Networks map[string]NetworkEndpoint `json:"networks"`
+}
+
+// State represents the state of a container.
+type State struct {
+ // Status is the current status of the container.
+ //
+ // Required: true
+ Status string `json:"status"`
+
+ // Running indicates if the container is running.
+ //
+ // Required: true
+ Running bool `json:"running"`
+
+ // ExitCode is the exit code of the container process.
+ //
+ // Required: false
+ ExitCode int `json:"exitCode,omitempty"`
+
+ // StartedAt is when the container was started.
+ //
+ // Required: false
+ StartedAt string `json:"startedAt,omitempty"`
+
+ // FinishedAt is when the container finished.
+ //
+ // Required: false
+ FinishedAt string `json:"finishedAt,omitempty"`
+}
+
+// Config represents configuration details for a container.
+type Config struct {
+ // Env is a list of environment variables.
+ //
+ // Required: false
+ Env []string `json:"env,omitempty"`
+
+ // Cmd is the command to run.
+ //
+ // Required: false
+ Cmd []string `json:"cmd,omitempty"`
+
+ // Entrypoint is the entrypoint for the container.
+ //
+ // Required: false
+ Entrypoint []string `json:"entrypoint,omitempty"`
+
+ // WorkingDir is the working directory.
+ //
+ // Required: false
+ WorkingDir string `json:"workingDir,omitempty"`
+
+ // User to run as.
+ //
+ // Required: false
+ User string `json:"user,omitempty"`
+}
+
+// HostConfig represents host configuration for a container.
+type HostConfig struct {
+ // NetworkMode for the container.
+ //
+ // Required: false
+ NetworkMode string `json:"networkMode,omitempty"`
+
+ // RestartPolicy for the container.
+ //
+ // Required: false
+ RestartPolicy string `json:"restartPolicy,omitempty"`
+
+ // Privileged indicates if the container runs in privileged mode.
+ //
+ // Required: false
+ Privileged bool `json:"privileged,omitempty"`
+
+ // AutoRemove indicates if the container is removed when stopped.
+ //
+ // Required: false
+ AutoRemove bool `json:"autoRemove,omitempty"`
+
+ // NanoCPUs is CPU allocation in nano CPUs.
+ //
+ // Required: false
+ NanoCPUs int64 `json:"nanoCpus,omitempty"`
+
+ // Memory limit in bytes.
+ //
+ // Required: false
+ Memory int64 `json:"memory,omitempty"`
+}
+
+// Summary represents a container summary.
+type Summary struct {
+ // ID is the unique identifier of the container.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // Names is a list of names for the container.
+ //
+ // Required: true
+ Names []string `json:"names"`
+
+ // Image used by the container.
+ //
+ // Required: true
+ Image string `json:"image"`
+
+ // ImageID is the ID of the image.
+ //
+ // Required: true
+ ImageID string `json:"imageId"`
+
+ // Command running in the container.
+ //
+ // Required: true
+ Command string `json:"command"`
+
+ // Created is the Unix timestamp when the container was created.
+ //
+ // Required: true
+ Created int64 `json:"created"`
+
+ // Ports exposed by the container.
+ //
+ // Required: true
+ Ports []Port `json:"ports"`
+
+ // Labels contains user-defined metadata.
+ //
+ // Required: true
+ Labels map[string]string `json:"labels"`
+
+ // State is the current state of the container.
+ //
+ // Required: true
+ State string `json:"state"`
+
+ // Status provides a human-readable status.
+ //
+ // Required: true
+ Status string `json:"status"`
+
+ // HostConfig contains host configuration.
+ //
+ // Required: true
+ HostConfig HostConfig `json:"hostConfig"`
+
+ // NetworkSettings contains network configuration.
+ //
+ // Required: true
+ NetworkSettings NetworkSettings `json:"networkSettings"`
+
+ // Mounts lists volume mounts.
+ //
+ // Required: true
+ Mounts []Mount `json:"mounts"`
+}
+
+// Details represents detailed container information.
+type Details struct {
+ // ID is the unique identifier of the container.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // Name of the container.
+ //
+ // Required: true
+ Name string `json:"name"`
+
+ // Image used by the container.
+ //
+ // Required: true
+ Image string `json:"image"`
+
+ // ImageID is the ID of the image.
+ //
+ // Required: true
+ ImageID string `json:"imageId"`
+
+ // Created is when the container was created.
+ //
+ // Required: true
+ Created string `json:"created"`
+
+ // State contains the container's current state.
+ //
+ // Required: true
+ State State `json:"state"`
+
+ // Config contains container configuration.
+ //
+ // Required: true
+ Config Config `json:"config"`
+
+ // HostConfig contains host-level configuration.
+ //
+ // Required: true
+ HostConfig HostConfig `json:"hostConfig"`
+
+ // NetworkSettings contains network configuration.
+ //
+ // Required: true
+ NetworkSettings NetworkSettings `json:"networkSettings"`
+
+ // Ports exposed by the container.
+ //
+ // Required: true
+ Ports []Port `json:"ports"`
+
+ // Mounts lists volume mounts.
+ //
+ // Required: true
+ Mounts []Mount `json:"mounts"`
+
+ // Labels contains user-defined metadata.
+ //
+ // Required: false
+ Labels map[string]string `json:"labels,omitempty"`
+}
+
+// Created represents a newly created container.
+type Created struct {
+ // ID is the unique identifier of the container.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // Name of the container.
+ //
+ // Required: true
+ Name string `json:"name"`
+
+ // Image used by the container.
+ //
+ // Required: true
+ Image string `json:"image"`
+
+ // Status of the container.
+ //
+ // Required: true
+ Status string `json:"status"`
+
+ // Created is when the container was created.
+ //
+ // Required: true
+ Created string `json:"created"`
+}
+
+// NewSummary creates a Summary from a docker container.Summary.
+func NewSummary(c container.Summary) Summary {
+ ports := make([]Port, 0, len(c.Ports))
+ for _, p := range c.Ports {
+ ports = append(ports, Port{
+ IP: p.IP,
+ PrivatePort: int(p.PrivatePort),
+ PublicPort: int(p.PublicPort),
+ Type: p.Type,
+ })
+ }
+
+ mounts := make([]Mount, 0, len(c.Mounts))
+ for _, m := range c.Mounts {
+ mounts = append(mounts, Mount{
+ Type: string(m.Type),
+ Name: m.Name,
+ Source: m.Source,
+ Destination: m.Destination,
+ Driver: m.Driver,
+ Mode: m.Mode,
+ RW: m.RW,
+ Propagation: string(m.Propagation),
+ })
+ }
+
+ networks := map[string]NetworkEndpoint{}
+ if c.NetworkSettings != nil && c.NetworkSettings.Networks != nil {
+ for name, n := range c.NetworkSettings.Networks {
+ networks[name] = mapEndpointSettings(n)
+ }
+ }
+
+ return Summary{
+ ID: c.ID,
+ Names: c.Names,
+ Image: c.Image,
+ ImageID: c.ImageID,
+ Command: c.Command,
+ Created: c.Created,
+ Ports: ports,
+ Labels: c.Labels,
+ State: c.State,
+ Status: c.Status,
+ HostConfig: HostConfig{
+ NetworkMode: c.HostConfig.NetworkMode,
+ },
+ NetworkSettings: NetworkSettings{
+ Networks: networks,
+ },
+ Mounts: mounts,
+ }
+}
+
+// NewDetails creates a Details from a docker container.InspectResponse.
+func NewDetails(c *container.InspectResponse) Details {
+ ports := make([]Port, 0)
+ if c.NetworkSettings != nil && c.NetworkSettings.Ports != nil {
+ for p, bindings := range c.NetworkSettings.Ports {
+ privatePort, _ := strconv.Atoi(p.Port())
+ typ := string(p.Proto())
+
+ // When no host bindings exist, still include the private port
+ if len(bindings) == 0 {
+ ports = append(ports, Port{
+ PrivatePort: privatePort,
+ Type: typ,
+ })
+ continue
+ }
+ for _, b := range bindings {
+ pub, _ := strconv.Atoi(b.HostPort)
+ ports = append(ports, Port{
+ IP: b.HostIP,
+ PrivatePort: privatePort,
+ PublicPort: pub,
+ Type: typ,
+ })
+ }
+ }
+ }
+
+ mounts := make([]Mount, 0, len(c.Mounts))
+ for _, m := range c.Mounts {
+ mounts = append(mounts, Mount{
+ Type: string(m.Type),
+ Name: m.Name,
+ Source: m.Source,
+ Destination: m.Destination,
+ Driver: m.Driver,
+ Mode: m.Mode,
+ RW: m.RW,
+ Propagation: string(m.Propagation),
+ })
+ }
+
+ networks := map[string]NetworkEndpoint{}
+ if c.NetworkSettings != nil && c.NetworkSettings.Networks != nil {
+ for name, n := range c.NetworkSettings.Networks {
+ networks[name] = mapEndpointSettings(n)
+ }
+ }
+
+ var host HostConfig
+ if c.HostConfig != nil {
+ host = HostConfig{
+ RestartPolicy: string(c.HostConfig.RestartPolicy.Name),
+ Privileged: c.HostConfig.Privileged,
+ AutoRemove: c.HostConfig.AutoRemove,
+ NanoCPUs: c.HostConfig.NanoCPUs,
+ Memory: c.HostConfig.Memory,
+ }
+ }
+
+ var cfg Config
+ labels := map[string]string{}
+ imageName := ""
+ if c.Config != nil {
+ cfg = Config{
+ Env: append([]string{}, c.Config.Env...),
+ Cmd: append([]string{}, c.Config.Cmd...),
+ Entrypoint: append([]string{}, c.Config.Entrypoint...),
+ WorkingDir: c.Config.WorkingDir,
+ User: c.Config.User,
+ }
+ imageName = c.Config.Image
+ if c.Config.Labels != nil {
+ for k, v := range c.Config.Labels {
+ labels[k] = v
+ }
+ }
+ }
+
+ name := strings.TrimPrefix(c.Name, "/")
+
+ state := State{}
+ if c.State != nil {
+ state = State{
+ Status: c.State.Status,
+ Running: c.State.Running,
+ ExitCode: c.State.ExitCode,
+ StartedAt: c.State.StartedAt,
+ FinishedAt: c.State.FinishedAt,
+ }
+ }
+
+ return Details{
+ ID: c.ID,
+ Name: name,
+ Image: imageName,
+ ImageID: c.Image,
+ Created: c.Created,
+ State: state,
+ Config: cfg,
+ HostConfig: host,
+ NetworkSettings: NetworkSettings{
+ Networks: networks,
+ },
+ Ports: ports,
+ Mounts: mounts,
+ Labels: labels,
+ }
+}
+
+func mapEndpointSettings(n *network.EndpointSettings) NetworkEndpoint {
+ if n == nil {
+ return NetworkEndpoint{}
+ }
+
+ var driverOpts map[string]string
+ if n.DriverOpts != nil {
+ driverOpts = n.DriverOpts
+ }
+
+ return NetworkEndpoint{
+ IPAMConfig: n.IPAMConfig,
+ Links: n.Links,
+ Aliases: n.Aliases,
+ MacAddress: n.MacAddress,
+ DriverOpts: driverOpts,
+ GwPriority: n.GwPriority,
+ NetworkID: n.NetworkID,
+ EndpointID: n.EndpointID,
+ Gateway: n.Gateway,
+ IPAddress: n.IPAddress,
+ IPPrefixLen: n.IPPrefixLen,
+ IPv6Gateway: n.IPv6Gateway,
+ GlobalIPv6Address: n.GlobalIPv6Address,
+ GlobalIPv6PrefixLen: n.GlobalIPv6PrefixLen,
+ DNSNames: n.DNSNames,
+ }
+}
diff --git a/types/containerregistry/container_registry.go b/types/containerregistry/container_registry.go
new file mode 100644
index 000000000..2e68fdcfc
--- /dev/null
+++ b/types/containerregistry/container_registry.go
@@ -0,0 +1,121 @@
+package containerregistry
+
+import "time"
+
+type Response struct {
+ // ID of the container registry.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // URL of the container registry.
+ //
+ // Required: true
+ URL string `json:"url"`
+
+ // Username for authentication with the container registry.
+ //
+ // Required: true
+ Username string `json:"username"`
+
+ // Description of the container registry.
+ //
+ // Required: false
+ Description *string `json:"description,omitempty"`
+
+ // Insecure indicates if the registry uses an insecure connection (HTTP).
+ //
+ // Required: true
+ Insecure bool `json:"insecure"`
+
+ // Enabled indicates if the registry is enabled.
+ //
+ // Required: true
+ Enabled bool `json:"enabled"`
+
+ // CreatedAt is the date and time at which the registry was created.
+ //
+ // Required: true
+ CreatedAt time.Time `json:"createdAt"`
+
+ // UpdatedAt is the date and time at which the registry was last updated.
+ //
+ // Required: true
+ UpdatedAt time.Time `json:"updatedAt"`
+}
+
+type Sync struct {
+ // ID of the container registry.
+ //
+ // Required: true
+ ID string `json:"id" binding:"required"`
+
+ // URL of the container registry.
+ //
+ // Required: true
+ URL string `json:"url" binding:"required"`
+
+ // Username for authentication with the container registry.
+ //
+ // Required: true
+ Username string `json:"username" binding:"required"`
+
+ // Token for authentication with the container registry.
+ //
+ // Required: true
+ Token string `json:"token" binding:"required"`
+
+ // Description of the container registry.
+ //
+ // Required: false
+ Description *string `json:"description,omitempty"`
+
+ // Insecure indicates if the registry uses an insecure connection (HTTP).
+ //
+ // Required: true
+ Insecure bool `json:"insecure"`
+
+ // Enabled indicates if the registry is enabled.
+ //
+ // Required: true
+ Enabled bool `json:"enabled"`
+
+ // CreatedAt is the date and time at which the registry was created.
+ //
+ // Required: true
+ CreatedAt time.Time `json:"createdAt"`
+
+ // UpdatedAt is the date and time at which the registry was last updated.
+ //
+ // Required: true
+ UpdatedAt time.Time `json:"updatedAt"`
+}
+
+type Credential struct {
+ // URL of the container registry.
+ //
+ // Required: true
+ URL string `json:"url" binding:"required"`
+
+ // Username for authentication with the container registry.
+ //
+ // Required: true
+ Username string `json:"username" binding:"required"`
+
+ // Token for authentication with the container registry.
+ //
+ // Required: true
+ Token string `json:"token" binding:"required"`
+
+ // Enabled indicates if the credential is enabled.
+ //
+ // Required: true
+ Enabled bool `json:"enabled"`
+}
+
+type SyncRequest struct {
+ // Registries is a list of container registries to sync.
+ //
+ // Required: true
+ Registries []Sync `json:"registries" binding:"required"`
+}
diff --git a/types/dockerinfo/docker_info.go b/types/dockerinfo/docker_info.go
new file mode 100644
index 000000000..5bccc7c5f
--- /dev/null
+++ b/types/dockerinfo/docker_info.go
@@ -0,0 +1,45 @@
+package dockerinfo
+
+import "github.com/docker/docker/api/types/system"
+
+type Info struct {
+ // Success indicates if the Docker daemon information was successfully retrieved.
+ //
+ // Required: true
+ Success bool `json:"success"`
+
+ // APIVersion is the API version of the Docker daemon.
+ //
+ // Required: true
+ APIVersion string `json:"apiVersion"`
+
+ // GitCommit is the Git commit hash of the Docker daemon.
+ //
+ // Required: true
+ GitCommit string `json:"gitCommit"`
+
+ // GoVersion is the Go version used to build the Docker daemon.
+ //
+ // Required: true
+ GoVersion string `json:"goVersion"`
+
+ // Os is the operating system the Docker daemon is running on.
+ //
+ // Required: true
+ Os string `json:"os"`
+
+ // Arch is the architecture the Docker daemon is running on.
+ //
+ // Required: true
+ Arch string `json:"arch"`
+
+ // BuildTime is the build time of the Docker daemon.
+ //
+ // Required: true
+ BuildTime string `json:"buildTime"`
+
+ // Embedded system.Info from the Docker daemon.
+ //
+ // Required: true
+ system.Info
+}
diff --git a/types/env/env.go b/types/env/env.go
new file mode 100644
index 000000000..241ccd814
--- /dev/null
+++ b/types/env/env.go
@@ -0,0 +1,10 @@
+package env
+
+type Variable struct {
+ Key string `json:"key"`
+ Value string `json:"value"`
+}
+
+type Summary struct {
+ Variables []Variable `json:"variables"`
+}
diff --git a/types/environment/environment.go b/types/environment/environment.go
new file mode 100644
index 000000000..6e2e49f5c
--- /dev/null
+++ b/types/environment/environment.go
@@ -0,0 +1,94 @@
+package environment
+
+type Create struct {
+ // ApiUrl is the URL of the environment API.
+ //
+ // Required: true
+ ApiUrl string `json:"apiUrl" binding:"required,url"`
+
+ // Name of the environment.
+ //
+ // Required: false
+ Name *string `json:"name,omitempty"`
+
+ // Enabled indicates if the environment is enabled.
+ //
+ // Required: false
+ Enabled *bool `json:"enabled,omitempty"`
+
+ // AccessToken for authentication with the environment.
+ //
+ // Required: false
+ AccessToken *string `json:"accessToken,omitempty"`
+
+ // BootstrapToken for initial setup of the environment.
+ //
+ // Required: false
+ BootstrapToken *string `json:"bootstrapToken,omitempty"`
+}
+
+type Update struct {
+ // ApiUrl is the URL of the environment API.
+ //
+ // Required: false
+ ApiUrl *string `json:"apiUrl,omitempty" binding:"omitempty,url"`
+
+ // Name of the environment.
+ //
+ // Required: false
+ Name *string `json:"name,omitempty"`
+
+ // Enabled indicates if the environment is enabled.
+ //
+ // Required: false
+ Enabled *bool `json:"enabled,omitempty"`
+
+ // AccessToken for authentication with the environment.
+ //
+ // Required: false
+ AccessToken *string `json:"accessToken,omitempty"`
+
+ // BootstrapToken for initial setup of the environment.
+ //
+ // Required: false
+ BootstrapToken *string `json:"bootstrapToken,omitempty"`
+}
+
+type Test struct {
+ // Status of the environment test.
+ //
+ // Required: true
+ Status string `json:"status"`
+
+ // Message providing additional details about the test result.
+ //
+ // Required: false
+ Message *string `json:"message,omitempty"`
+}
+
+type Response struct {
+ // ID of the environment.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // Name of the environment.
+ //
+ // Required: false
+ Name string `json:"name,omitempty"`
+
+ // ApiUrl is the URL of the environment API.
+ //
+ // Required: true
+ ApiUrl string `json:"apiUrl"`
+
+ // Status of the environment.
+ //
+ // Required: true
+ Status string `json:"status"`
+
+ // Enabled indicates if the environment is enabled.
+ //
+ // Required: true
+ Enabled bool `json:"enabled"`
+}
diff --git a/types/event/event.go b/types/event/event.go
new file mode 100644
index 000000000..5d59b9ae7
--- /dev/null
+++ b/types/event/event.go
@@ -0,0 +1,174 @@
+package event
+
+import "time"
+
+type Response struct {
+ // ID of the event.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // Type of the event.
+ //
+ // Required: true
+ Type string `json:"type"`
+
+ // Severity level of the event.
+ //
+ // Required: true
+ Severity string `json:"severity"`
+
+ // Title of the event.
+ //
+ // Required: true
+ Title string `json:"title"`
+
+ // Description of the event.
+ //
+ // Required: false
+ Description string `json:"description,omitempty"`
+
+ // ResourceType is the type of the resource associated with the event.
+ //
+ // Required: false
+ ResourceType *string `json:"resourceType,omitempty"`
+
+ // ResourceID is the ID of the resource associated with the event.
+ //
+ // Required: false
+ ResourceID *string `json:"resourceId,omitempty"`
+
+ // ResourceName is the name of the resource associated with the event.
+ //
+ // Required: false
+ ResourceName *string `json:"resourceName,omitempty"`
+
+ // UserID is the ID of the user who triggered the event.
+ //
+ // Required: false
+ UserID *string `json:"userId,omitempty"`
+
+ // Username is the username of the user who triggered the event.
+ //
+ // Required: false
+ Username *string `json:"username,omitempty"`
+
+ // EnvironmentID is the ID of the environment associated with the event.
+ //
+ // Required: false
+ EnvironmentID *string `json:"environmentId,omitempty"`
+
+ // Metadata contains additional key-value data associated with the event.
+ //
+ // Required: false
+ Metadata map[string]interface{} `json:"metadata,omitempty"`
+
+ // Timestamp is when the event occurred.
+ //
+ // Required: true
+ Timestamp time.Time `json:"timestamp"`
+
+ // CreatedAt is the date and time at which the event was created.
+ //
+ // Required: true
+ CreatedAt time.Time `json:"createdAt"`
+
+ // UpdatedAt is the date and time at which the event was last updated.
+ //
+ // Required: false
+ UpdatedAt *time.Time `json:"updatedAt,omitempty"`
+}
+
+type Create struct {
+ // Type of the event.
+ //
+ // Required: true
+ Type string `json:"type" binding:"required"`
+
+ // Severity level of the event.
+ //
+ // Required: false
+ Severity string `json:"severity,omitempty"`
+
+ // Title of the event.
+ //
+ // Required: true
+ Title string `json:"title" binding:"required"`
+
+ // Description of the event.
+ //
+ // Required: false
+ Description string `json:"description,omitempty"`
+
+ // ResourceType is the type of the resource associated with the event.
+ //
+ // Required: false
+ ResourceType *string `json:"resourceType,omitempty"`
+
+ // ResourceID is the ID of the resource associated with the event.
+ //
+ // Required: false
+ ResourceID *string `json:"resourceId,omitempty"`
+
+ // ResourceName is the name of the resource associated with the event.
+ //
+ // Required: false
+ ResourceName *string `json:"resourceName,omitempty"`
+
+ // UserID is the ID of the user who triggered the event.
+ //
+ // Required: false
+ UserID *string `json:"userId,omitempty"`
+
+ // Username is the username of the user who triggered the event.
+ //
+ // Required: false
+ Username *string `json:"username,omitempty"`
+
+ // EnvironmentID is the ID of the environment associated with the event.
+ //
+ // Required: false
+ EnvironmentID *string `json:"environmentId,omitempty"`
+
+ // Metadata contains additional key-value data associated with the event.
+ //
+ // Required: false
+ Metadata map[string]interface{} `json:"metadata,omitempty"`
+}
+
+type ListReponse struct {
+ // Events is a list of events.
+ //
+ // Required: true
+ Events []Response `json:"events"`
+
+ // Total number of events.
+ //
+ // Required: true
+ Total int `json:"total"`
+
+ // Page number of the current result set.
+ //
+ // Required: true
+ Page int `json:"page"`
+
+ // PageSize is the number of events per page.
+ //
+ // Required: true
+ PageSize int `json:"pageSize"`
+
+ // TotalPages is the total number of pages.
+ //
+ // Required: true
+ TotalPages int `json:"totalPages"`
+
+ // HasNext indicates if there is a next page.
+ //
+ // Required: true
+ HasNext bool `json:"hasNext"`
+
+ // HasPrevious indicates if there is a previous page.
+ //
+ // Required: true
+ HasPrevious bool `json:"hasPrevious"`
+}
diff --git a/types/go.mod b/types/go.mod
new file mode 100644
index 000000000..d3acffba0
--- /dev/null
+++ b/types/go.mod
@@ -0,0 +1,29 @@
+module go.getarcane.app/types
+
+go 1.25.4
+
+require (
+ github.com/compose-spec/compose-go/v2 v2.10.0
+ github.com/docker/docker v28.5.2+incompatible
+)
+
+require (
+ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
+ github.com/distribution/reference v0.6.0 // indirect
+ github.com/docker/go-connections v0.6.0 // indirect
+ github.com/docker/go-units v0.5.0 // indirect
+ github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
+ github.com/google/go-cmp v0.7.0 // indirect
+ github.com/mattn/go-shellwords v1.0.12 // indirect
+ github.com/moby/docker-image-spec v1.3.1 // indirect
+ github.com/opencontainers/go-digest v1.0.0 // indirect
+ github.com/opencontainers/image-spec v1.1.1 // indirect
+ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
+ github.com/sirupsen/logrus v1.9.3 // indirect
+ github.com/stretchr/testify v1.11.1 // indirect
+ github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
+ go.yaml.in/yaml/v4 v4.0.0-rc.3 // indirect
+ golang.org/x/sync v0.18.0 // indirect
+ golang.org/x/sys v0.38.0 // indirect
+ gotest.tools/v3 v3.5.2 // indirect
+)
diff --git a/types/go.sum b/types/go.sum
new file mode 100644
index 000000000..505aa866c
--- /dev/null
+++ b/types/go.sum
@@ -0,0 +1,40 @@
+github.com/compose-spec/compose-go/v2 v2.10.0 h1:K2C5LQ3KXvkYpy5N/SG6kIYB90iiAirA9btoTh/gB0Y=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
+github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
+github.com/docker/docker v28.5.2+incompatible h1:DBX0Y0zAjZbSrm1uzOkdr1onVghKaftjlSWt4AFexzM=
+github.com/docker/docker v28.5.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
+github.com/docker/go-connections v0.6.0 h1:LlMG9azAe1TqfR7sO+NJttz1gy6KO7VJBh+pMmjSD94=
+github.com/docker/go-connections v0.6.0/go.mod h1:AahvXYshr6JgfUJGdDCs2b5EZG/vmaMAntpSFH5BFKE=
+github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
+github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
+github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
+github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
+github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
+github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
+github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
+github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
+github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
+github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
+github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
+github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
+github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
+github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
+github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc=
+github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
+go.yaml.in/yaml/v4 v4.0.0-rc.3 h1:3h1fjsh1CTAPjW7q/EMe+C8shx5d8ctzZTrLcs/j8Go=
+golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
+golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
+gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
diff --git a/types/image/image.go b/types/image/image.go
new file mode 100644
index 000000000..a16825d4a
--- /dev/null
+++ b/types/image/image.go
@@ -0,0 +1,378 @@
+package image
+
+import (
+ "strings"
+ "time"
+
+ "github.com/docker/docker/api/types/image"
+ containerregistry "go.getarcane.app/types/containerregistry"
+)
+
+type UpdateInfo struct {
+ // HasUpdate indicates if an update is available for the image.
+ //
+ // Required: true
+ HasUpdate bool `json:"hasUpdate"`
+
+ // UpdateType describes the type of update (e.g., major, minor, patch).
+ //
+ // Required: true
+ UpdateType string `json:"updateType"`
+
+ // CurrentVersion is the current version of the image.
+ //
+ // Required: true
+ CurrentVersion string `json:"currentVersion"`
+
+ // LatestVersion is the latest available version of the image.
+ //
+ // Required: true
+ LatestVersion string `json:"latestVersion"`
+
+ // CurrentDigest is the digest (hash) of the current image.
+ //
+ // Required: true
+ CurrentDigest string `json:"currentDigest"`
+
+ // LatestDigest is the digest (hash) of the latest available image.
+ //
+ // Required: true
+ LatestDigest string `json:"latestDigest"`
+
+ // CheckTime is the time when the update check was performed.
+ //
+ // Required: true
+ CheckTime time.Time `json:"checkTime"`
+
+ // ResponseTimeMs is the response time in milliseconds.
+ //
+ // Required: true
+ ResponseTimeMs int `json:"responseTimeMs"`
+
+ // Error contains any error message from the update check.
+ //
+ // Required: true
+ Error string `json:"error"`
+
+ // AuthMethod is the authentication method used.
+ //
+ // Required: false
+ AuthMethod string `json:"authMethod,omitempty"`
+
+ // AuthUsername is the username used for authentication.
+ //
+ // Required: false
+ AuthUsername string `json:"authUsername,omitempty"`
+
+ // AuthRegistry is the registry used for authentication.
+ //
+ // Required: false
+ AuthRegistry string `json:"authRegistry,omitempty"`
+
+ // UsedCredential indicates if credentials were used for the update check.
+ //
+ // Required: false
+ UsedCredential bool `json:"usedCredential,omitempty"`
+}
+
+type Summary struct {
+ // ID is the unique identifier of the image.
+ //
+ // Required: true
+ ID string `json:"id" sortable:"true"`
+
+ // RepoTags is a list of tags referring to this image.
+ //
+ // Required: true
+ RepoTags []string `json:"repoTags"`
+
+ // RepoDigests is a list of content-addressable digests of the image.
+ //
+ // Required: true
+ RepoDigests []string `json:"repoDigests"`
+
+ // Created is the Unix timestamp when the image was created.
+ //
+ // Required: true
+ Created int64 `json:"created" sortable:"true"`
+
+ // Size is the total size of the image including all layers.
+ //
+ // Required: true
+ Size int64 `json:"size" sortable:"true"`
+
+ // VirtualSize is the virtual size of the image.
+ //
+ // Required: true
+ VirtualSize int64 `json:"virtualSize"`
+
+ // Labels contains user-defined metadata for the image.
+ //
+ // Required: true
+ Labels map[string]interface{} `json:"labels"`
+
+ // InUse indicates if the image is currently in use by a container.
+ //
+ // Required: true
+ InUse bool `json:"inUse" sortable:"true"`
+
+ // Repo is the repository name of the image.
+ //
+ // Required: true
+ Repo string `json:"repo" sortable:"true"`
+
+ // Tag is the tag of the image.
+ //
+ // Required: true
+ Tag string `json:"tag" sortable:"true"`
+
+ // UpdateInfo contains information about available updates for the image.
+ //
+ // Required: false
+ UpdateInfo *UpdateInfo `json:"updateInfo,omitempty"`
+}
+
+type PruneReport struct {
+ // ImagesDeleted is a list of image IDs that were deleted.
+ //
+ // Required: true
+ ImagesDeleted []string `json:"imagesDeleted"`
+
+ // SpaceReclaimed is the amount of space reclaimed in bytes.
+ //
+ // Required: true
+ SpaceReclaimed int64 `json:"spaceReclaimed"`
+}
+
+// NewPruneReport creates a PruneReport from a Docker image prune report.
+// It extracts deleted and untagged image IDs from the Docker API response,
+// combining both types into a single list and converting space reclaimed to int64.
+func NewPruneReport(src image.PruneReport) PruneReport {
+ out := PruneReport{
+ ImagesDeleted: make([]string, 0, len(src.ImagesDeleted)),
+ SpaceReclaimed: int64(src.SpaceReclaimed),
+ }
+ for _, d := range src.ImagesDeleted {
+ if d.Deleted != "" {
+ out.ImagesDeleted = append(out.ImagesDeleted, d.Deleted)
+ } else if d.Untagged != "" {
+ out.ImagesDeleted = append(out.ImagesDeleted, d.Untagged)
+ }
+ }
+ return out
+}
+
+type UsageCounts struct {
+ // Inuse is the number of images currently in use.
+ //
+ // Required: true
+ Inuse int `json:"imagesInuse"`
+
+ // Unused is the number of images not in use.
+ //
+ // Required: true
+ Unused int `json:"imagesUnused"`
+
+ // Total is the total number of images.
+ //
+ // Required: true
+ Total int `json:"totalImages"`
+
+ // TotalSize is the total size of all images in bytes.
+ //
+ // Required: true
+ TotalSize int64 `json:"totalImageSize"`
+}
+
+type LoadResult struct {
+ // Stream contains the output stream from the load operation.
+ //
+ // Required: true
+ Stream string `json:"stream"`
+}
+
+type DetailSummary struct {
+ // ID is the unique identifier of the image.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // RepoTags is a list of tags referring to this image.
+ //
+ // Required: true
+ RepoTags []string `json:"repoTags"`
+
+ // RepoDigests is a list of content-addressable digests of the image.
+ //
+ // Required: true
+ RepoDigests []string `json:"repoDigests"`
+
+ // Comment is a comment associated with the image.
+ //
+ // Required: true
+ Comment string `json:"comment"`
+
+ // Created is the creation timestamp of the image.
+ //
+ // Required: true
+ Created string `json:"created"`
+
+ // Author is the author of the image.
+ //
+ // Required: true
+ Author string `json:"author"`
+
+ // Config contains the configuration of the image.
+ //
+ // Required: true
+ Config struct {
+ // ExposedPorts are the ports exposed by the image.
+ ExposedPorts map[string]struct{} `json:"exposedPorts,omitempty"`
+ // Env are the environment variables set in the image.
+ Env []string `json:"env,omitempty"`
+ // Cmd is the default command to run in the container.
+ Cmd []string `json:"cmd,omitempty"`
+ // Volumes are the volumes defined in the image.
+ Volumes map[string]struct{} `json:"volumes,omitempty"`
+ // WorkingDir is the working directory in the container.
+ WorkingDir string `json:"workingDir,omitempty"`
+ // ArgsEscaped indicates if the arguments are escaped.
+ ArgsEscaped bool `json:"argsEscaped,omitempty"`
+ } `json:"config"`
+
+ // Architecture is the architecture for which the image was built.
+ //
+ // Required: true
+ Architecture string `json:"architecture"`
+
+ // Os is the operating system for which the image was built.
+ //
+ // Required: true
+ Os string `json:"os"`
+
+ // Size is the total size of the image.
+ //
+ // Required: true
+ Size int64 `json:"size"`
+
+ // GraphDriver contains information about the graph driver.
+ //
+ // Required: true
+ GraphDriver struct {
+ // Data contains driver-specific data.
+ Data interface{} `json:"data"`
+ // Name is the name of the graph driver.
+ Name string `json:"name"`
+ } `json:"graphDriver"`
+
+ // RootFs contains information about the root filesystem.
+ //
+ // Required: true
+ RootFs struct {
+ // Type is the type of the root filesystem.
+ Type string `json:"type"`
+ // Layers are the layers of the image.
+ Layers []string `json:"layers"`
+ } `json:"rootFs"`
+
+ // Metadata contains metadata about the image.
+ //
+ // Required: true
+ Metadata struct {
+ // LastTagTime is the time when the image was last tagged.
+ LastTagTime string `json:"lastTagTime"`
+ } `json:"metadata"`
+
+ // Descriptor is the OCI descriptor of the image.
+ //
+ // Required: true
+ Descriptor struct {
+ // MediaType is the media type of the descriptor.
+ MediaType string `json:"mediaType"`
+ // Digest is the digest of the descriptor.
+ Digest string `json:"digest"`
+ // Size is the size of the descriptor.
+ Size int64 `json:"size"`
+ } `json:"descriptor"`
+}
+
+// PullOptions contains options for pulling an image.
+type PullOptions struct {
+ // ImageName is the name of the image to pull.
+ //
+ // Required: true
+ ImageName string `json:"imageName" binding:"required"`
+
+ // Credentials for authenticating with private registries.
+ //
+ // Required: false
+ Credentials []containerregistry.Credential `json:"credentials,omitempty"`
+}
+
+// NewDetailSummary creates a DetailSummary from a Docker image inspect response.
+// It converts the Docker API types to the application's DetailSummary type,
+// handling nested structs and converting exposed ports from Docker's nat.PortSet
+// to string keys. The descriptor is derived from the first repo digest if available.
+func NewDetailSummary(src *image.InspectResponse) DetailSummary {
+ var out DetailSummary
+
+ out.ID = src.ID
+ out.RepoTags = append(out.RepoTags, src.RepoTags...)
+ out.RepoDigests = append(out.RepoDigests, src.RepoDigests...)
+ out.Comment = src.Comment
+ out.Created = src.Created
+ out.Author = src.Author
+
+ if src.Config != nil {
+ if len(src.Config.ExposedPorts) > 0 {
+ out.Config.ExposedPorts = make(map[string]struct{}, len(src.Config.ExposedPorts))
+ for p := range src.Config.ExposedPorts {
+ out.Config.ExposedPorts[string(p)] = struct{}{}
+ }
+ }
+ if len(src.Config.Env) > 0 {
+ out.Config.Env = append(out.Config.Env, src.Config.Env...)
+ }
+ if len(src.Config.Cmd) > 0 {
+ out.Config.Cmd = append(out.Config.Cmd, src.Config.Cmd...)
+ }
+ if len(src.Config.Volumes) > 0 {
+ out.Config.Volumes = make(map[string]struct{}, len(src.Config.Volumes))
+ for v := range src.Config.Volumes {
+ out.Config.Volumes[v] = struct{}{}
+ }
+ }
+ out.Config.WorkingDir = src.Config.WorkingDir
+ out.Config.ArgsEscaped = src.Config.ArgsEscaped //nolint:staticcheck // Required for Docker Windows image compatibility
+ }
+
+ out.Architecture = src.Architecture
+ out.Os = src.Os
+ out.Size = src.Size
+
+ out.GraphDriver.Name = src.GraphDriver.Name
+ if src.GraphDriver.Data != nil {
+ out.GraphDriver.Data = src.GraphDriver.Data
+ }
+
+ out.RootFs.Type = src.RootFS.Type
+ if len(src.RootFS.Layers) > 0 {
+ out.RootFs.Layers = append(out.RootFs.Layers, src.RootFS.Layers...)
+ }
+
+ if !src.Metadata.LastTagTime.IsZero() {
+ out.Metadata.LastTagTime = src.Metadata.LastTagTime.Format(time.RFC3339Nano)
+ }
+
+ // Best-effort descriptor from first digest
+ out.Descriptor.MediaType = "application/vnd.oci.image.index.v1+json"
+ out.Descriptor.Size = src.Size
+ if len(src.RepoDigests) > 0 {
+ parts := strings.SplitN(src.RepoDigests[0], "@", 2)
+ if len(parts) == 2 {
+ out.Descriptor.Digest = parts[1]
+ }
+ }
+
+ return out
+}
diff --git a/types/imageupdate/image_update.go b/types/imageupdate/image_update.go
new file mode 100644
index 000000000..ace436262
--- /dev/null
+++ b/types/imageupdate/image_update.go
@@ -0,0 +1,110 @@
+package imageupdate
+
+import (
+ "time"
+
+ containerregistry "go.getarcane.app/types/containerregistry"
+)
+
+type Response struct {
+ // HasUpdate indicates if an update is available for the image.
+ //
+ // Required: true
+ HasUpdate bool `json:"hasUpdate"`
+
+ // UpdateType describes the type of update (e.g., major, minor, patch).
+ //
+ // Required: true
+ UpdateType string `json:"updateType"`
+
+ // CurrentVersion is the current version of the image.
+ //
+ // Required: true
+ CurrentVersion string `json:"currentVersion"`
+
+ // LatestVersion is the latest available version of the image.
+ //
+ // Required: false
+ LatestVersion string `json:"latestVersion,omitempty"`
+
+ // CurrentDigest is the digest (hash) of the current image.
+ //
+ // Required: false
+ CurrentDigest string `json:"currentDigest,omitempty"`
+
+ // LatestDigest is the digest (hash) of the latest available image.
+ //
+ // Required: false
+ LatestDigest string `json:"latestDigest,omitempty"`
+
+ // CheckTime is the time when the update check was performed.
+ //
+ // Required: true
+ CheckTime time.Time `json:"checkTime"`
+
+ // ResponseTimeMs is the response time in milliseconds.
+ //
+ // Required: true
+ ResponseTimeMs int `json:"responseTimeMs"`
+
+ // Error contains any error message from the update check.
+ //
+ // Required: false
+ Error string `json:"error,omitempty"`
+
+ // AuthMethod is the authentication method used ("none" | "anonymous" | "credential" | "unknown").
+ //
+ // Required: false
+ AuthMethod string `json:"authMethod,omitempty"`
+
+ // AuthUsername is the username used for authentication (for credential method).
+ //
+ // Required: false
+ AuthUsername string `json:"authUsername,omitempty"`
+
+ // AuthRegistry is the registry host used for authentication.
+ //
+ // Required: false
+ AuthRegistry string `json:"authRegistry,omitempty"`
+
+ // UsedCredential indicates if credentials were used for the update check.
+ //
+ // Required: false
+ UsedCredential bool `json:"usedCredential,omitempty"`
+}
+
+type Summary struct {
+ // TotalImages is the total number of images checked.
+ //
+ // Required: true
+ TotalImages int `json:"totalImages"`
+
+ // ImagesWithUpdates is the number of images with available updates.
+ //
+ // Required: true
+ ImagesWithUpdates int `json:"imagesWithUpdates"`
+
+ // DigestUpdates is the number of images with digest updates.
+ //
+ // Required: true
+ DigestUpdates int `json:"digestUpdates"`
+
+ // ErrorsCount is the number of errors encountered during the check.
+ //
+ // Required: true
+ ErrorsCount int `json:"errorsCount"`
+}
+
+type BatchImageUpdateRequest struct {
+ // ImageRefs is a list of image references to check for updates.
+ //
+ // Required: true
+ ImageRefs []string `json:"imageRefs" binding:"required"`
+
+ // Credentials is a list of container registry credentials for authentication.
+ //
+ // Required: false
+ Credentials []containerregistry.Credential `json:"credentials,omitempty"`
+}
+
+type BatchResponse map[string]*Response
diff --git a/types/meta/meta.go b/types/meta/meta.go
new file mode 100644
index 000000000..032972f65
--- /dev/null
+++ b/types/meta/meta.go
@@ -0,0 +1,29 @@
+package meta
+
+// Metadata represents metadata about a configuration or setting.
+type Metadata struct {
+ // Key is the identifier for the metadata.
+ //
+ // Required: true
+ Key string `json:"key"`
+
+ // Label is the human-readable label for the metadata.
+ //
+ // Required: true
+ Label string `json:"label"`
+
+ // Type is the data type of the metadata value.
+ //
+ // Required: true
+ Type string `json:"type"`
+
+ // Keywords is a list of keywords associated with the metadata.
+ //
+ // Required: false
+ Keywords []string `json:"keywords,omitempty"`
+
+ // Description provides additional information about the metadata.
+ //
+ // Required: false
+ Description string `json:"description,omitempty"`
+}
diff --git a/types/meta/template_meta.go b/types/meta/template_meta.go
new file mode 100644
index 000000000..e74db9fbc
--- /dev/null
+++ b/types/meta/template_meta.go
@@ -0,0 +1,39 @@
+package meta
+
+// Template represents metadata about a template.
+type Template struct {
+ // Version of the template.
+ //
+ // Required: false
+ Version *string `json:"version,omitempty"`
+
+ // Author of the template.
+ //
+ // Required: false
+ Author *string `json:"author,omitempty"`
+
+ // Tags is a list of tags associated with the template.
+ //
+ // Required: false
+ Tags []string `json:"tags,omitempty"`
+
+ // RemoteURL is the URL to the remote template file.
+ //
+ // Required: false
+ RemoteURL *string `json:"remoteUrl,omitempty"`
+
+ // EnvURL is the URL to the environment file.
+ //
+ // Required: false
+ EnvURL *string `json:"envUrl,omitempty"`
+
+ // DocumentationURL is the URL to the template documentation.
+ //
+ // Required: false
+ DocumentationURL *string `json:"documentationUrl,omitempty"`
+
+ // UpdatedAt is the date and time when the template was last updated.
+ //
+ // Required: false
+ UpdatedAt *string `json:"updatedAt,omitempty"`
+}
diff --git a/types/network/network.go b/types/network/network.go
new file mode 100644
index 000000000..35cd7c6d8
--- /dev/null
+++ b/types/network/network.go
@@ -0,0 +1,175 @@
+package network
+
+import (
+ "time"
+
+ "github.com/docker/docker/api/types/network"
+)
+
+type Summary struct {
+ // ID is the unique identifier of the network.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // Name of the network.
+ //
+ // Required: true
+ Name string `json:"name"`
+
+ // Driver is the network driver used.
+ //
+ // Required: true
+ Driver string `json:"driver"`
+
+ // Scope of the network (local, global, etc).
+ //
+ // Required: true
+ Scope string `json:"scope"`
+
+ // Created is the time when the network was created.
+ //
+ // Required: true
+ Created time.Time `json:"created"`
+
+ // Options contains driver-specific options.
+ //
+ // Required: true
+ Options map[string]string `json:"options"`
+
+ // Labels contains user-defined metadata for the network.
+ //
+ // Required: true
+ Labels map[string]string `json:"labels"`
+
+ // InUse indicates if the network is currently in use by a container.
+ //
+ // Required: true
+ InUse bool `json:"inUse"`
+
+ // IsDefault indicates if this is a default network.
+ //
+ // Required: true
+ IsDefault bool `json:"isDefault"`
+}
+
+type UsageCounts struct {
+ // Inuse is the number of networks currently in use.
+ //
+ // Required: true
+ Inuse int `json:"networksInuse"`
+
+ // Unused is the number of networks not in use.
+ //
+ // Required: true
+ Unused int `json:"networksUnused"`
+
+ // Total is the total number of networks.
+ //
+ // Required: true
+ Total int `json:"totalNetworks"`
+}
+
+type Inspect struct {
+ // ID is the unique identifier of the network.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // Name of the network.
+ //
+ // Required: true
+ Name string `json:"name"`
+
+ // Driver is the network driver used.
+ //
+ // Required: true
+ Driver string `json:"driver"`
+
+ // Scope of the network (local, global, etc).
+ //
+ // Required: true
+ Scope string `json:"scope"`
+
+ // Created is the time when the network was created.
+ //
+ // Required: true
+ Created time.Time `json:"created"`
+
+ // Options contains driver-specific options.
+ //
+ // Required: true
+ Options map[string]string `json:"options"`
+
+ // Labels contains user-defined metadata for the network.
+ //
+ // Required: true
+ Labels map[string]string `json:"labels"`
+
+ // Containers is a map of containers connected to this network.
+ //
+ // Required: true
+ Containers map[string]network.EndpointResource `json:"containers"`
+
+ // IPAM contains IP address management configuration.
+ //
+ // Required: true
+ IPAM network.IPAM `json:"ipam"`
+
+ // Internal indicates if the network is internal.
+ //
+ // Required: true
+ Internal bool `json:"internal"`
+
+ // Attachable indicates if the network is attachable.
+ //
+ // Required: true
+ Attachable bool `json:"attachable"`
+
+ // Ingress indicates if the network is an ingress network.
+ //
+ // Required: true
+ Ingress bool `json:"ingress"`
+}
+
+type CreateResponse struct {
+ // ID is the unique identifier of the created network.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // Warning contains any warning messages from the network creation.
+ //
+ // Required: false
+ Warning string `json:"warning,omitempty"`
+}
+
+type PruneReport struct {
+ // NetworksDeleted is a list of network IDs that were deleted.
+ //
+ // Required: true
+ NetworksDeleted []string `json:"networksDeleted"`
+
+ // SpaceReclaimed is the amount of space reclaimed in bytes.
+ //
+ // Required: true
+ SpaceReclaimed uint64 `json:"spaceReclaimed"`
+}
+
+// NewSummary creates a Summary from a docker network.Summary, calculating InUse and IsDefault fields.
+func NewSummary(s network.Summary) Summary {
+ return Summary{
+ ID: s.ID,
+ Name: s.Name,
+ Driver: s.Driver,
+ Scope: s.Scope,
+ Created: s.Created,
+ Options: s.Options,
+ Labels: s.Labels,
+ // InUse is set to true if the network has any connected containers, false otherwise.
+ InUse: len(s.Containers) > 0,
+ // IsDefault is set to true if the network is one of the default Docker networks
+ // (bridge, host, or none), false otherwise.
+ IsDefault: s.Name == "bridge" || s.Name == "host" || s.Name == "none",
+ }
+}
diff --git a/types/notification/notification.go b/types/notification/notification.go
new file mode 100644
index 000000000..c92351668
--- /dev/null
+++ b/types/notification/notification.go
@@ -0,0 +1,102 @@
+package notification
+
+import "go.getarcane.app/types/base"
+
+// Provider is the type for notification provider identifiers.
+type Provider string
+
+const (
+ // NotificationProviderDiscord is the builtin Discord notification provider.
+ NotificationProviderDiscord Provider = "discord"
+
+ // NotificationProviderEmail is the builtin Email notification provider.
+ NotificationProviderEmail Provider = "email"
+)
+
+type Update struct {
+ // Provider is the notification provider type.
+ //
+ // Required: true
+ Provider Provider `json:"provider" binding:"required"`
+
+ // Enabled indicates if the notification provider is enabled.
+ //
+ // Required: true
+ Enabled bool `json:"enabled"`
+
+ // Config contains the provider-specific configuration.
+ //
+ // Required: true
+ Config base.JsonObject `json:"config" binding:"required"`
+}
+
+type Response struct {
+ // ID is the unique identifier of the notification settings.
+ //
+ // Required: true
+ ID uint `json:"id"`
+
+ // Provider is the notification provider type.
+ //
+ // Required: true
+ Provider Provider `json:"provider"`
+
+ // Enabled indicates if the notification provider is enabled.
+ //
+ // Required: true
+ Enabled bool `json:"enabled"`
+
+ // Config contains the provider-specific configuration.
+ //
+ // Required: true
+ Config base.JsonObject `json:"config"`
+}
+
+type AppriseUpdate struct {
+ // APIURL is the URL of the Apprise API endpoint.
+ //
+ // Required: false
+ APIURL string `json:"apiUrl"`
+
+ // Enabled indicates if Apprise is enabled.
+ //
+ // Required: true
+ Enabled bool `json:"enabled"`
+
+ // ImageUpdateTag is the tag to use for image update notifications.
+ //
+ // Required: false
+ ImageUpdateTag string `json:"imageUpdateTag"`
+
+ // ContainerUpdateTag is the tag to use for container update notifications.
+ //
+ // Required: false
+ ContainerUpdateTag string `json:"containerUpdateTag"`
+}
+
+type AppriseResponse struct {
+ // ID is the unique identifier of the Apprise settings.
+ //
+ // Required: true
+ ID uint `json:"id"`
+
+ // APIURL is the URL of the Apprise API endpoint.
+ //
+ // Required: false
+ APIURL string `json:"apiUrl"`
+
+ // Enabled indicates if Apprise is enabled.
+ //
+ // Required: true
+ Enabled bool `json:"enabled"`
+
+ // ImageUpdateTag is the tag to use for image update notifications.
+ //
+ // Required: false
+ ImageUpdateTag string `json:"imageUpdateTag"`
+
+ // ContainerUpdateTag is the tag to use for container update notifications.
+ //
+ // Required: false
+ ContainerUpdateTag string `json:"containerUpdateTag"`
+}
diff --git a/types/project/project.go b/types/project/project.go
new file mode 100644
index 000000000..4cf5e2fc8
--- /dev/null
+++ b/types/project/project.go
@@ -0,0 +1,281 @@
+package project
+
+import (
+ composetypes "github.com/compose-spec/compose-go/v2/types"
+ "go.getarcane.app/types/containerregistry"
+)
+
+// IncludeFile represents an included file within a project.
+type IncludeFile struct {
+ // Path is the absolute path to the include file.
+ //
+ // Required: true
+ Path string `json:"path"`
+
+ // RelativePath is the path to the include file relative to the project.
+ //
+ // Required: true
+ RelativePath string `json:"relativePath"`
+
+ // Content is the file content.
+ //
+ // Required: true
+ Content string `json:"content"`
+}
+
+// Create is used to create a new project.
+type Create struct {
+ // Name of the project.
+ //
+ // Required: true
+ Name string `json:"name" binding:"required"`
+
+ // ComposeContent is the Docker Compose file content.
+ //
+ // Required: true
+ ComposeContent string `json:"composeContent" binding:"required"`
+
+ // EnvContent is the environment file content.
+ //
+ // Required: false
+ EnvContent *string `json:"envContent,omitempty"`
+}
+
+// Update is used to update a project.
+type Update struct {
+ // Name of the project.
+ //
+ // Required: false
+ Name *string `json:"name,omitempty"`
+
+ // ComposeContent is the Docker Compose file content.
+ //
+ // Required: false
+ ComposeContent *string `json:"composeContent,omitempty"`
+
+ // EnvContent is the environment file content.
+ //
+ // Required: false
+ EnvContent *string `json:"envContent,omitempty"`
+}
+
+// UpdateIncludeFile is used to update an include file within a project.
+type UpdateIncludeFile struct {
+ // RelativePath is the path to the include file relative to the project.
+ //
+ // Required: true
+ RelativePath string `json:"relativePath" binding:"required"`
+
+ // Content is the file content.
+ //
+ // Required: true
+ Content string `json:"content" binding:"required"`
+}
+
+// RuntimeService contains live container status information for a service.
+type RuntimeService struct {
+ // Name is the service name from the compose file.
+ //
+ // Required: true
+ Name string `json:"name"`
+
+ // Image is the Docker image used by the service.
+ //
+ // Required: true
+ Image string `json:"image"`
+
+ // Status is the current status of the container (running, stopped, etc.).
+ //
+ // Required: true
+ Status string `json:"status"`
+
+ // ContainerID is the Docker container ID.
+ //
+ // Required: false
+ ContainerID string `json:"containerId,omitempty"`
+
+ // ContainerName is the Docker container name.
+ //
+ // Required: false
+ ContainerName string `json:"containerName,omitempty"`
+
+ // Ports is a list of port mappings for the container.
+ //
+ // Required: false
+ Ports []string `json:"ports,omitempty"`
+
+ // Health is the health status of the container.
+ //
+ // Required: false
+ Health *string `json:"health,omitempty"`
+}
+
+// CreateReponse is the response when a project is created.
+type CreateReponse struct {
+ // ID is the unique identifier of the project.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // Name of the project.
+ //
+ // Required: true
+ Name string `json:"name"`
+
+ // DirName is the directory name where the project is stored.
+ //
+ // Required: false
+ DirName string `json:"dirName,omitempty"`
+
+ // Path is the file path to the project.
+ //
+ // Required: true
+ Path string `json:"path"`
+
+ // Status is the current status of the project.
+ //
+ // Required: true
+ Status string `json:"status"`
+
+ // StatusReason provides additional information about the status.
+ //
+ // Required: false
+ StatusReason *string `json:"statusReason,omitempty"`
+
+ // ServiceCount is the total number of services in the project.
+ //
+ // Required: true
+ ServiceCount int `json:"serviceCount"`
+
+ // RunningCount is the number of running services in the project.
+ //
+ // Required: true
+ RunningCount int `json:"runningCount"`
+
+ // CreatedAt is the date and time when the project was created.
+ //
+ // Required: true
+ CreatedAt string `json:"createdAt"`
+
+ // UpdatedAt is the date and time when the project was last updated.
+ //
+ // Required: true
+ UpdatedAt string `json:"updatedAt"`
+}
+
+// Details contains detailed information about a project.
+type Details struct {
+ // ID is the unique identifier of the project.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // Name of the project.
+ //
+ // Required: true
+ Name string `json:"name"`
+
+ // DirName is the directory name where the project is stored.
+ //
+ // Required: false
+ DirName string `json:"dirName,omitempty"`
+
+ // Path is the file path to the project.
+ //
+ // Required: true
+ Path string `json:"path"`
+
+ // ComposeContent is the Docker Compose file content.
+ //
+ // Required: false
+ ComposeContent string `json:"composeContent,omitempty"`
+
+ // EnvContent is the environment file content.
+ //
+ // Required: false
+ EnvContent string `json:"envContent,omitempty"`
+
+ // IncludeFiles is a list of included files in the project.
+ //
+ // Required: false
+ IncludeFiles []IncludeFile `json:"includeFiles,omitempty"`
+
+ // Status is the current status of the project.
+ //
+ // Required: true
+ Status string `json:"status"`
+
+ // StatusReason provides additional information about the status.
+ //
+ // Required: false
+ StatusReason *string `json:"statusReason,omitempty"`
+
+ // ServiceCount is the total number of services in the project.
+ //
+ // Required: true
+ ServiceCount int `json:"serviceCount"`
+
+ // RunningCount is the number of running services in the project.
+ //
+ // Required: true
+ RunningCount int `json:"runningCount"`
+
+ // CreatedAt is the date and time when the project was created.
+ //
+ // Required: true
+ CreatedAt string `json:"createdAt"`
+
+ // UpdatedAt is the date and time when the project was last updated.
+ //
+ // Required: true
+ UpdatedAt string `json:"updatedAt"`
+
+ // Services is a list of services defined in the Docker Compose file.
+ //
+ // Required: false
+ Services []composetypes.ServiceConfig `json:"services,omitempty"`
+
+ // RuntimeServices contains live container status information for each service.
+ //
+ // Required: false
+ RuntimeServices []RuntimeService `json:"runtimeServices,omitempty"`
+}
+
+// Destroy is used to destroy a project.
+type Destroy struct {
+ // RemoveFiles indicates if project files should be removed.
+ //
+ // Required: false
+ RemoveFiles bool `json:"removeFiles,omitempty"`
+
+ // RemoveVolumes indicates if project volumes should be removed.
+ //
+ // Required: false
+ RemoveVolumes bool `json:"removeVolumes,omitempty"`
+}
+
+// StatusCounts contains counts of projects by status.
+type StatusCounts struct {
+ // RunningProjects is the number of running projects.
+ //
+ // Required: true
+ RunningProjects int `json:"runningProjects"`
+
+ // StoppedProjects is the number of stopped projects.
+ //
+ // Required: true
+ StoppedProjects int `json:"stoppedProjects"`
+
+ // TotalProjects is the total number of projects.
+ //
+ // Required: true
+ TotalProjects int `json:"totalProjects"`
+}
+
+// ImagePullRequest is used to pull images for a project.
+type ImagePullRequest struct {
+ // Credentials is a list of container registry credentials for pulling images.
+ //
+ // Required: false
+ Credentials []containerregistry.Credential `json:"credentials,omitempty"`
+}
diff --git a/types/search/search.go b/types/search/search.go
new file mode 100644
index 000000000..3489a873f
--- /dev/null
+++ b/types/search/search.go
@@ -0,0 +1,29 @@
+package search
+
+import "go.getarcane.app/types/category"
+
+// Request represents a search request.
+type Request struct {
+ // Query is the search query string.
+ //
+ // Required: true
+ Query string `json:"query" binding:"required,min=1"`
+}
+
+// Response represents the results of a search.
+type Response struct {
+ // Results is a list of categories matching the search query.
+ //
+ // Required: true
+ Results []category.Category `json:"results"`
+
+ // Query is the search query that was executed.
+ //
+ // Required: true
+ Query string `json:"query"`
+
+ // Count is the number of results returned.
+ //
+ // Required: true
+ Count int `json:"count"`
+}
diff --git a/types/settings/settings.go b/types/settings/settings.go
new file mode 100644
index 000000000..b16f168b7
--- /dev/null
+++ b/types/settings/settings.go
@@ -0,0 +1,193 @@
+package settings
+
+// PublicSetting represents a publicly accessible setting.
+type PublicSetting struct {
+ // Key is the identifier of the setting.
+ //
+ // Required: true
+ Key string `json:"key"`
+
+ // Type is the data type of the setting value.
+ //
+ // Required: true
+ Type string `json:"type"`
+
+ // Value is the setting value.
+ //
+ // Required: true
+ Value string `json:"value"`
+}
+
+// SettingDto represents a setting with visibility information.
+type SettingDto struct {
+ // Embedded PublicSetting fields.
+ PublicSetting
+
+ // IsPublic indicates if the setting is publicly accessible.
+ //
+ // Required: true
+ IsPublic bool `json:"isPublic"`
+}
+
+// Update is used to update application settings.
+type Update struct {
+ // ProjectsDirectory is the directory path where projects are stored.
+ //
+ // Required: false
+ ProjectsDirectory *string `json:"projectsDirectory,omitempty"`
+
+ // DiskUsagePath is the path to monitor for disk usage.
+ //
+ // Required: false
+ DiskUsagePath *string `json:"diskUsagePath,omitempty"`
+
+ // AutoUpdate indicates if automatic updates are enabled.
+ //
+ // Required: false
+ AutoUpdate *string `json:"autoUpdate,omitempty"`
+
+ // AutoUpdateInterval is the interval for checking automatic updates.
+ //
+ // Required: false
+ AutoUpdateInterval *string `json:"autoUpdateInterval,omitempty"`
+
+ // PollingEnabled indicates if polling is enabled.
+ //
+ // Required: false
+ PollingEnabled *string `json:"pollingEnabled,omitempty"`
+
+ // PollingInterval is the interval for polling operations.
+ //
+ // Required: false
+ PollingInterval *string `json:"pollingInterval,omitempty"`
+
+ // EnvironmentHealthInterval is the interval for checking environment health.
+ //
+ // Required: false
+ EnvironmentHealthInterval *string `json:"environmentHealthInterval,omitempty"`
+
+ // PruneMode is the Docker prune mode ("all" or "dangling").
+ //
+ // Required: false
+ PruneMode *string `json:"dockerPruneMode,omitempty" binding:"omitempty,oneof=all dangling"`
+
+ // MaxImageUploadSize is the maximum size for image uploads.
+ //
+ // Required: false
+ MaxImageUploadSize *string `json:"maxImageUploadSize,omitempty"`
+
+ // BaseServerURL is the base URL of the server.
+ //
+ // Required: false
+ BaseServerURL *string `json:"baseServerUrl,omitempty"`
+
+ // EnableGravatar indicates if Gravatar is enabled for user avatars.
+ //
+ // Required: false
+ EnableGravatar *string `json:"enableGravatar,omitempty"`
+
+ // DefaultShell is the default shell used for container execution.
+ //
+ // Required: false
+ DefaultShell *string `json:"defaultShell,omitempty"`
+
+ // DockerHost is the Docker host connection string.
+ //
+ // Required: false
+ DockerHost *string `json:"dockerHost,omitempty"`
+
+ // AccentColor is the UI accent color.
+ //
+ // Required: false
+ AccentColor *string `json:"accentColor,omitempty"`
+
+ // AuthLocalEnabled indicates if local authentication is enabled.
+ //
+ // Required: false
+ AuthLocalEnabled *string `json:"authLocalEnabled,omitempty"`
+
+ // OidcEnabled indicates if OIDC authentication is enabled.
+ //
+ // Required: false
+ OidcEnabled *string `json:"oidcEnabled,omitempty"`
+
+ // OidcMergeAccounts indicates if OIDC accounts should be merged with local accounts.
+ //
+ // Required: false
+ OidcMergeAccounts *string `json:"oidcMergeAccounts,omitempty"`
+
+ // AuthSessionTimeout is the session timeout duration.
+ //
+ // Required: false
+ AuthSessionTimeout *string `json:"authSessionTimeout,omitempty"`
+
+ // AuthPasswordPolicy is the password policy rules.
+ //
+ // Required: false
+ AuthPasswordPolicy *string `json:"authPasswordPolicy,omitempty"`
+
+ // AuthOidcConfig is deprecated and will be removed in a future release.
+ //
+ // Required: false
+ AuthOidcConfig *string `json:"authOidcConfig,omitempty"`
+
+ // OidcClientId is the OIDC client identifier.
+ //
+ // Required: false
+ OidcClientId *string `json:"oidcClientId,omitempty"`
+
+ // OidcClientSecret is the OIDC client secret.
+ //
+ // Required: false
+ OidcClientSecret *string `json:"oidcClientSecret,omitempty"`
+
+ // OidcIssuerUrl is the OIDC issuer URL.
+ //
+ // Required: false
+ OidcIssuerUrl *string `json:"oidcIssuerUrl,omitempty"`
+
+ // OidcScopes is the list of OIDC scopes to request.
+ //
+ // Required: false
+ OidcScopes *string `json:"oidcScopes,omitempty"`
+
+ // OidcAdminClaim is the OIDC claim name used to identify administrators.
+ //
+ // Required: false
+ OidcAdminClaim *string `json:"oidcAdminClaim,omitempty"`
+
+ // OidcAdminValue is the OIDC claim value that identifies administrators.
+ //
+ // Required: false
+ OidcAdminValue *string `json:"oidcAdminValue,omitempty"`
+
+ // OnboardingCompleted indicates if the onboarding process is complete.
+ //
+ // Required: false
+ OnboardingCompleted *string `json:"onboardingCompleted,omitempty"`
+
+ // OnboardingSteps tracks the completed onboarding steps.
+ //
+ // Required: false
+ OnboardingSteps *string `json:"onboardingSteps,omitempty"`
+
+ // MobileNavigationMode is the navigation mode for mobile devices.
+ //
+ // Required: false
+ MobileNavigationMode *string `json:"mobileNavigationMode,omitempty"`
+
+ // MobileNavigationShowLabels indicates if labels should be shown in mobile navigation.
+ //
+ // Required: false
+ MobileNavigationShowLabels *string `json:"mobileNavigationShowLabels,omitempty"`
+
+ // SidebarHoverExpansion indicates if the sidebar expands on hover.
+ //
+ // Required: false
+ SidebarHoverExpansion *string `json:"sidebarHoverExpansion,omitempty"`
+
+ // GlassEffectEnabled indicates if glass morphism effect is enabled in the UI.
+ //
+ // Required: false
+ GlassEffectEnabled *string `json:"glassEffectEnabled,omitempty"`
+}
diff --git a/types/system/prune.go b/types/system/prune.go
new file mode 100644
index 000000000..5da50da44
--- /dev/null
+++ b/types/system/prune.go
@@ -0,0 +1,72 @@
+package system
+
+// PruneAllRequest is used to request pruning of Docker system resources.
+type PruneAllRequest struct {
+ // Containers indicates if containers should be pruned.
+ //
+ // Required: true
+ Containers bool `json:"containers"`
+
+ // Images indicates if images should be pruned.
+ //
+ // Required: true
+ Images bool `json:"images"`
+
+ // Volumes indicates if volumes should be pruned.
+ //
+ // Required: true
+ Volumes bool `json:"volumes"`
+
+ // Networks indicates if networks should be pruned.
+ //
+ // Required: true
+ Networks bool `json:"networks"`
+
+ // BuildCache indicates if build cache should be pruned.
+ //
+ // Required: true
+ BuildCache bool `json:"buildCache"`
+
+ // Dangling indicates if only dangling resources should be pruned.
+ //
+ // Required: true
+ Dangling bool `json:"dangling"`
+}
+
+// PruneAllResult is the result of a prune operation on Docker system resources.
+type PruneAllResult struct {
+ // ContainersPruned is a list of container IDs that were pruned.
+ //
+ // Required: false
+ ContainersPruned []string `json:"containersPruned,omitempty"`
+
+ // ImagesDeleted is a list of image IDs that were deleted.
+ //
+ // Required: false
+ ImagesDeleted []string `json:"imagesDeleted,omitempty"`
+
+ // VolumesDeleted is a list of volume IDs that were deleted.
+ //
+ // Required: false
+ VolumesDeleted []string `json:"volumesDeleted,omitempty"`
+
+ // NetworksDeleted is a list of network IDs that were deleted.
+ //
+ // Required: false
+ NetworksDeleted []string `json:"networksDeleted,omitempty"`
+
+ // SpaceReclaimed is the amount of space reclaimed in bytes.
+ //
+ // Required: true
+ SpaceReclaimed uint64 `json:"spaceReclaimed"`
+
+ // Success indicates if the prune operation was successful.
+ //
+ // Required: true
+ Success bool `json:"success"`
+
+ // Errors is a list of any errors encountered during the prune operation.
+ //
+ // Required: false
+ Errors []string `json:"errors,omitempty"`
+}
diff --git a/types/template/template.go b/types/template/template.go
new file mode 100644
index 000000000..7ad21e2f6
--- /dev/null
+++ b/types/template/template.go
@@ -0,0 +1,185 @@
+package template
+
+import (
+ "go.getarcane.app/types/env"
+ "go.getarcane.app/types/meta"
+)
+
+// BaseTemplate contains common fields shared by all template types.
+type BaseTemplate struct {
+ // ID is the unique identifier of the template.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // Name of the template.
+ //
+ // Required: true
+ Name string `json:"name"`
+
+ // Description of the template.
+ //
+ // Required: true
+ Description string `json:"description"`
+}
+
+// RemoteTemplate represents a template from a remote registry.
+type RemoteTemplate struct {
+ BaseTemplate
+
+ // Version of the template.
+ //
+ // Required: true
+ Version string `json:"version"`
+
+ // Author of the template.
+ //
+ // Required: true
+ Author string `json:"author"`
+
+ // ComposeURL is the URL to the Docker Compose file.
+ //
+ // Required: true
+ ComposeURL string `json:"compose_url"`
+
+ // EnvURL is the URL to the environment file.
+ //
+ // Required: true
+ EnvURL string `json:"env_url"`
+
+ // DocumentationURL is the URL to the template documentation.
+ //
+ // Required: true
+ DocumentationURL string `json:"documentation_url"`
+
+ // Tags is a list of tags associated with the template.
+ //
+ // Required: true
+ Tags []string `json:"tags"`
+}
+
+// BaseRegistry contains common fields shared by all registry types.
+type BaseRegistry struct {
+ // Name of the registry.
+ //
+ // Required: true
+ Name string `json:"name"`
+
+ // Description of the registry.
+ //
+ // Required: true
+ Description string `json:"description"`
+
+ // URL of the registry.
+ //
+ // Required: true
+ URL string `json:"url"`
+}
+
+// RemoteRegistry represents a remote template registry configuration.
+type RemoteRegistry struct {
+ BaseRegistry
+
+ // Schema is the JSON schema reference for the registry.
+ //
+ // Required: false
+ Schema string `json:"$schema,omitempty"`
+
+ // Version of the registry.
+ //
+ // Required: true
+ Version string `json:"version"`
+
+ // Author of the registry.
+ //
+ // Required: true
+ Author string `json:"author"`
+
+ // Templates is a list of templates available in the registry.
+ //
+ // Required: true
+ Templates []RemoteTemplate `json:"templates"`
+}
+
+// Registry represents a local registry configuration.
+type Registry struct {
+ BaseRegistry
+
+ // ID is the unique identifier of the registry.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // Enabled indicates if the registry is enabled.
+ //
+ // Required: true
+ Enabled bool `json:"enabled"`
+}
+
+// TemplateContent contains a template with its associated content and metadata.
+type TemplateContent struct {
+ // Template is the template information.
+ //
+ // Required: true
+ Template Template `json:"template"`
+
+ // Content is the Docker Compose file content.
+ //
+ // Required: true
+ Content string `json:"content"`
+
+ // EnvContent is the environment file content.
+ //
+ // Required: true
+ EnvContent string `json:"envContent"`
+
+ // Services is a list of service names defined in the template.
+ //
+ // Required: true
+ Services []string `json:"services"`
+
+ // EnvVariables is a list of environment variables used in the template.
+ //
+ // Required: true
+ EnvVariables []env.Variable `json:"envVariables"`
+}
+
+// Template represents a Docker Compose template.
+type Template struct {
+ BaseTemplate
+
+ // Content is the Docker Compose file content.
+ //
+ // Required: true
+ Content string `json:"content"`
+
+ // EnvContent is the environment file content.
+ //
+ // Required: false
+ EnvContent *string `json:"envContent,omitempty"`
+
+ // IsCustom indicates if this is a user-created custom template.
+ //
+ // Required: true
+ IsCustom bool `json:"isCustom"`
+
+ // IsRemote indicates if this template is from a remote registry.
+ //
+ // Required: true
+ IsRemote bool `json:"isRemote"`
+
+ // RegistryID is the ID of the registry this template belongs to.
+ //
+ // Required: false
+ RegistryID *string `json:"registryId,omitempty"`
+
+ // Registry is the registry information if the template is from a registry.
+ //
+ // Required: false
+ Registry *Registry `json:"registry,omitempty"`
+
+ // Metadata contains additional metadata about the template.
+ //
+ // Required: false
+ Metadata *meta.Template `json:"metadata,omitempty"`
+}
diff --git a/types/types.go b/types/types.go
new file mode 100644
index 000000000..ab1254f4c
--- /dev/null
+++ b/types/types.go
@@ -0,0 +1 @@
+package types
diff --git a/types/updater/updater.go b/types/updater/updater.go
new file mode 100644
index 000000000..74283357a
--- /dev/null
+++ b/types/updater/updater.go
@@ -0,0 +1,116 @@
+package updater
+
+type Options struct {
+ // Type filters updates by resource type ("image" | "container" | "project")
+ Type string `json:"type,omitempty"`
+
+ // ResourceIds limits updates to specific resources
+ ResourceIds []string `json:"resourceIds,omitempty"`
+
+ // ForceUpdate forces updates even if up to date
+ ForceUpdate bool `json:"forceUpdate,omitempty"`
+
+ // DryRun performs a dry run without applying updates
+ DryRun bool `json:"dryRun,omitempty"`
+}
+
+// ResourceResult represents the result of an update operation on a single resource.
+type ResourceResult struct {
+ // ResourceID is the unique identifier of the resource.
+ //
+ // Required: true
+ ResourceID string `json:"resourceId"`
+
+ // ResourceName is the name of the resource.
+ //
+ // Required: false
+ ResourceName string `json:"resourceName,omitempty"`
+
+ // ResourceType is the type of the resource ("image" | "container" | "project").
+ //
+ // Required: true
+ ResourceType string `json:"resourceType"`
+
+ // Status is the current status ("checked" | "updated" | "skipped" | "failed" | "up_to_date" | "update_available").
+ //
+ // Required: true
+ Status string `json:"status"`
+
+ // UpdateAvailable indicates if an update is available.
+ //
+ // Required: false
+ UpdateAvailable bool `json:"updateAvailable,omitempty"`
+
+ // UpdateApplied indicates if an update was applied.
+ //
+ // Required: false
+ UpdateApplied bool `json:"updateApplied,omitempty"`
+
+ // OldImages is a map of old image references.
+ //
+ // Required: false
+ OldImages map[string]string `json:"oldImages,omitempty"`
+
+ // NewImages is a map of new image references.
+ //
+ // Required: false
+ NewImages map[string]string `json:"newImages,omitempty"`
+
+ // Error contains any error message encountered during the update.
+ //
+ // Required: false
+ Error string `json:"error,omitempty"`
+
+ // Details contains additional details about the update operation.
+ //
+ // Required: false
+ Details map[string]interface{} `json:"details,omitempty"`
+}
+
+// Result represents the complete result of an update operation.
+type Result struct {
+ // Success indicates if the overall update operation was successful.
+ //
+ // Required: false
+ Success bool `json:"success,omitempty"`
+
+ // Checked is the number of resources checked.
+ //
+ // Required: true
+ Checked int `json:"checked"`
+
+ // Updated is the number of resources updated.
+ //
+ // Required: true
+ Updated int `json:"updated"`
+
+ // Skipped is the number of resources skipped.
+ //
+ // Required: true
+ Skipped int `json:"skipped"`
+
+ // Failed is the number of resources that failed to update.
+ //
+ // Required: true
+ Failed int `json:"failed"`
+
+ // StartTime is the time when the update operation started.
+ //
+ // Required: false
+ StartTime string `json:"startTime,omitempty"`
+
+ // EndTime is the time when the update operation ended.
+ //
+ // Required: false
+ EndTime string `json:"endTime,omitempty"`
+
+ // Duration is the total duration of the update operation.
+ //
+ // Required: true
+ Duration string `json:"duration"`
+
+ // Items is a list of individual resource results.
+ //
+ // Required: true
+ Items []ResourceResult `json:"items"`
+}
diff --git a/types/user/user.go b/types/user/user.go
new file mode 100644
index 000000000..3164b290c
--- /dev/null
+++ b/types/user/user.go
@@ -0,0 +1,112 @@
+package user
+
+type Create struct {
+ // Username of the user.
+ //
+ // Required: true
+ Username string `json:"username" binding:"required"`
+
+ // Password of the user.
+ //
+ // Required: true
+ Password string `json:"password" binding:"required"`
+
+ // DisplayName of the user.
+ //
+ // Required: false
+ DisplayName *string `json:"displayName,omitempty"`
+
+ // Email address of the user.
+ //
+ // Required: false
+ Email *string `json:"email,omitempty"`
+
+ // Roles assigned to the user.
+ //
+ // Required: false
+ Roles []string `json:"roles,omitempty"`
+
+ // Locale of the user.
+ //
+ // Required: false
+ Locale *string `json:"locale,omitempty"`
+}
+
+type Update struct {
+ // DisplayName of the user.
+ //
+ // Required: false
+ DisplayName *string `json:"displayName,omitempty"`
+
+ // Email address of the user.
+ //
+ // Required: false
+ Email *string `json:"email,omitempty"`
+
+ // Roles assigned to the user.
+ //
+ // Required: false
+ Roles []string `json:"roles,omitempty"`
+
+ // Locale of the user.
+ //
+ // Required: false
+ Locale *string `json:"locale,omitempty"`
+
+ // Password of the user.
+ //
+ // Required: false
+ Password *string `json:"password,omitempty"`
+}
+
+type Response struct {
+ // ID of the user.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // Username of the user.
+ //
+ // Required: true
+ Username string `json:"username"`
+
+ // DisplayName of the user.
+ //
+ // Required: false
+ DisplayName *string `json:"displayName,omitempty"`
+
+ // Email address of the user.
+ //
+ // Required: false
+ Email *string `json:"email,omitempty"`
+
+ // Roles assigned to the user.
+ //
+ // Required: true
+ Roles []string `json:"roles"`
+
+ // OidcSubjectId of the user.
+ //
+ // Required: false
+ OidcSubjectId *string `json:"oidcSubjectId,omitempty"`
+
+ // Locale of the user.
+ //
+ // Required: false
+ Locale *string `json:"locale,omitempty"`
+
+ // CreatedAt is the date and time at which the user was created.
+ //
+ // Required: false
+ CreatedAt string `json:"createdAt,omitempty"`
+
+ // UpdatedAt is the date and time at which the user was last updated.
+ //
+ // Required: false
+ UpdatedAt string `json:"updatedAt,omitempty"`
+
+ // RequiresPasswordChange indicates if the user is required to change their password.
+ //
+ // Required: true
+ RequiresPasswordChange bool `json:"requiresPasswordChange"`
+}
diff --git a/types/version/version.go b/types/version/version.go
new file mode 100644
index 000000000..ea6a7b188
--- /dev/null
+++ b/types/version/version.go
@@ -0,0 +1,53 @@
+package version
+
+type Info struct {
+ // CurrentVersion is the current version string.
+ //
+ // Required: true
+ CurrentVersion string `json:"currentVersion"`
+
+ // CurrentTag is the current tag.
+ //
+ // Required: false
+ CurrentTag string `json:"currentTag,omitempty"`
+
+ // CurrentDigest is the current digest (hash) of the version.
+ //
+ // Required: false
+ CurrentDigest string `json:"currentDigest,omitempty"`
+
+ // Revision is the revision identifier (e.g., commit hash).
+ //
+ // Required: true
+ Revision string `json:"revision"`
+
+ // DisplayVersion is the version string formatted for display.
+ //
+ // Required: true
+ DisplayVersion string `json:"displayVersion"`
+
+ // IsSemverVersion indicates if the current version follows semantic versioning.
+ //
+ // Required: true
+ IsSemverVersion bool `json:"isSemverVersion"`
+
+ // NewestVersion is the newest available version string.
+ //
+ // Required: false
+ NewestVersion string `json:"newestVersion,omitempty"`
+
+ // NewestDigest is the digest (hash) of the newest available version.
+ //
+ // Required: false
+ NewestDigest string `json:"newestDigest,omitempty"`
+
+ // UpdateAvailable indicates if an update is available.
+ //
+ // Required: true
+ UpdateAvailable bool `json:"updateAvailable"`
+
+ // ReleaseURL is the URL to the release page.
+ //
+ // Required: false
+ ReleaseURL string `json:"releaseUrl,omitempty"`
+}
diff --git a/types/volume/volume.go b/types/volume/volume.go
new file mode 100644
index 000000000..f22b2f667
--- /dev/null
+++ b/types/volume/volume.go
@@ -0,0 +1,139 @@
+package volume
+
+import "github.com/docker/docker/api/types/volume"
+
+// Volume represents a Docker volume.
+type Volume struct {
+ // ID is the unique identifier of the volume.
+ //
+ // Required: true
+ ID string `json:"id"`
+
+ // Name of the volume.
+ //
+ // Required: true
+ Name string `json:"name"`
+
+ // Driver is the volume driver used.
+ //
+ // Required: true
+ Driver string `json:"driver"`
+
+ // Mountpoint is the path where the volume is mounted.
+ //
+ // Required: true
+ Mountpoint string `json:"mountpoint"`
+
+ // Scope of the volume (local, global, etc).
+ //
+ // Required: true
+ Scope string `json:"scope"`
+
+ // Options contains driver-specific options.
+ //
+ // Required: true
+ Options map[string]string `json:"options"`
+
+ // Labels contains user-defined metadata for the volume.
+ //
+ // Required: true
+ Labels map[string]string `json:"labels"`
+
+ // CreatedAt is the time when the volume was created.
+ //
+ // Required: true
+ CreatedAt string `json:"createdAt"`
+
+ // InUse indicates if the volume is currently in use by a container.
+ //
+ // Required: true
+ InUse bool `json:"inUse"`
+
+ // UsageData contains size and reference count information.
+ //
+ // Required: false
+ UsageData *volume.UsageData `json:"usageData,omitempty"`
+
+ // Containers is a list of container IDs using this volume.
+ //
+ // Required: true
+ Containers []string `json:"containers"`
+}
+
+// UsageCounts contains counts of volumes by usage status.
+type UsageCounts struct {
+ // Inuse is the number of volumes currently in use.
+ //
+ // Required: true
+ Inuse int `json:"volumesInuse"`
+
+ // Unused is the number of volumes not in use.
+ //
+ // Required: true
+ Unused int `json:"volumesUnused"`
+
+ // Total is the total number of volumes.
+ //
+ // Required: true
+ Total int `json:"totalVolumes"`
+}
+
+// PruneReport is the result of a volume prune operation.
+type PruneReport struct {
+ // VolumesDeleted is a list of volume names that were deleted.
+ //
+ // Required: true
+ VolumesDeleted []string `json:"volumesDeleted"`
+
+ // SpaceReclaimed is the amount of space reclaimed in bytes.
+ //
+ // Required: true
+ SpaceReclaimed uint64 `json:"spaceReclaimed"`
+}
+
+// Create is used to create a new volume.
+type Create struct {
+ // Name of the volume.
+ //
+ // Required: true
+ Name string `json:"name" binding:"required"`
+
+ // Driver is the volume driver to use.
+ //
+ // Required: false
+ Driver string `json:"driver"`
+
+ // Labels contains user-defined metadata for the volume.
+ //
+ // Required: false
+ Labels map[string]string `json:"labels"`
+
+ // Options contains driver-specific options.
+ //
+ // Required: false
+ Options map[string]string `json:"options"`
+}
+
+// NewSummary creates a Volume from a docker volume.Volume, calculating InUse
+// based on whether the volume has a reference count of 1 or more.
+//
+// InUse is set to true if the volume's UsageData.RefCount is >= 1, false otherwise.
+func NewSummary(v volume.Volume) Volume {
+ dto := Volume{
+ ID: v.Name,
+ Name: v.Name,
+ Driver: v.Driver,
+ Mountpoint: v.Mountpoint,
+ Scope: v.Scope,
+ Options: v.Options,
+ Labels: v.Labels,
+ CreatedAt: v.CreatedAt,
+ Containers: make([]string, 0),
+ }
+
+ if v.UsageData != nil {
+ dto.InUse = v.UsageData.RefCount >= 1
+ }
+
+ return dto
+}