detached 6ec8608

chore(docs): remove stale planning docs

commit
6ec8608cc91b0cfc7de1422904f30145503348a4
author
brice · · 2026-03-02 06:29 UTC
parent
3ee469f
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +0 -836
D docs/DEPENDENCY_INJECTION.md +0 -162
@@ -1,162 +0,0 @@
1-# Dependency Injection Architecture (Phase 7)
2-
3-## Overview
4-
5-Phase 7 implements complete dependency injection wiring for the DDD architecture, enabling proper inversion of control and testability across all layers.
6-
7-## Architecture
8-
9-### Dependency Flow (Correct Inversion)
10-
11-```
12-UI Layer (interfaces/tui)
13- ↓ depends on
14-Application Layer (commands, handlers, services)
15- ↓ depends on
16-Domain Layer (aggregates, ports, value objects)
17- ↑ no dependencies
18-Infrastructure Layer (adapters) implements domain ports
19-```
20-
21-## Wiring in cmd/archup/main.go
22-
23-### 1. Infrastructure Adapters (Lowest Layer)
24-
25-All adapters are created first and implement domain ports:
26-
27-```go
28-// Filesystem operations
29-fsAdapter := &filesystem.LocalFileSystem{}
30-
31-// Command execution
32-shellExec := executor.NewShellExecutor(slogAdapter)
33-chrootExec := executor.NewChrootExecutor(slogAdapter)
34-scriptExec := executor.NewScriptExecutor(fsAdapter, shellExec, config.DefaultInstallDir)
35-
36-// Persistence
37-repoAdapter, err := persistence.NewFileRepository(config.DefaultConfigPath)
38-
39-// Logging
40-slogAdapter := infralogger.NewSlogAdapter(oldLog.Slog())
41-```
42-
43-### 2. Command Handlers (Application Layer)
44-
45-Handlers are injected with port dependencies only (never concrete implementations):
46-
47-```go
48-preflightHandler := apphandlers.NewPreflightHandler(fsAdapter, shellExec, slogAdapter)
49-partitionHandler := apphandlers.NewPartitionHandler(shellExec, slogAdapter)
50-baseHandler := apphandlers.NewInstallBaseHandler(fsAdapter, shellExec, chrootExec, slogAdapter)
51-configHandler := apphandlers.NewConfigureSystemHandler(chrootExec, slogAdapter)
52-bootloaderHandler := apphandlers.NewBootloaderHandler(chrootExec, slogAdapter)
53-reposHandler := apphandlers.NewReposHandler(chrootExec, slogAdapter)
54-postInstallHandler := apphandlers.NewPostInstallHandler(chrootExec, scriptExec, slogAdapter)
55-```
56-
57-### 3. Installation Service
58-
59-The main orchestrator receives all handlers and coordinates the installation:
60-
61-```go
62-installService := services.NewInstallationService(
63- repoAdapter,
64- slogAdapter,
65- preflightHandler,
66- partitionHandler,
67- baseHandler,
68- configHandler,
69- bootloaderHandler,
70- reposHandler,
71- postInstallHandler,
72-)
73-```
74-
75-### 4. TUI Application
76-
77-The user interface receives the service and tracker, with no direct access to domain/infrastructure:
78-
79-```go
80-tuiApp := tui.NewApp(installService, installService.Tracker(), slogAdapter)
81-```
82-
83-## Constructor Signatures (Phase 7 Requirements)
84-
85-### ShellExecutor
86-```go
87-func NewShellExecutor(logger ports.Logger) *ShellExecutor
88-```
89-- Requires: Logger for command execution logging
90-
91-### ChrootExecutor
92-```go
93-func NewChrootExecutor(logger ports.Logger) *ChrootExecutor
94-```
95-- Requires: Logger for chroot operation logging
96-
97-### ScriptExecutor
98-```go
99-func NewScriptExecutor(fs ports.FileSystem, cmdExec ports.CommandExecutor, scriptDir string) *ScriptExecutor
100-```
101-- Requires: FileSystem for script validation
102-- Requires: CommandExecutor for optional command execution
103-- Requires: Script directory path
104-
105-### Logger Adapter
106-```go
107-func NewSlogAdapter(logger *slog.Logger) *SlogAdapter
108-```
109-- Requires: Pre-configured `*slog.Logger` instance
110-- No error return (file operations handled by caller)
111-
112-### FileRepository
113-```go
114-func NewFileRepository(basePath string) (*FileRepository, error)
115-```
116-- Requires: Base path for state persistence
117-- Returns: error if directory creation fails
118-
119-## Port Implementations
120-
121-All infrastructure adapters implement domain ports exactly:
122-
123-| Port | Adapter | Location |
124-|------|---------|----------|
125-| `FileSystem` | `LocalFileSystem` | `internal/infrastructure/filesystem/local.go` |
126-| `CommandExecutor` | `ShellExecutor` | `internal/infrastructure/executor/shell.go` |
127-| `ChrootExecutor` | `ChrootExecutor` | `internal/infrastructure/executor/chroot.go` |
128-| `ScriptExecutor` | `ScriptExecutor` | `internal/infrastructure/executor/script.go` |
129-| `Logger` | `SlogAdapter` | `internal/infrastructure/logger/slog_adapter.go` |
130-| `InstallationRepository` | `FileRepository` | `internal/infrastructure/persistence/file_repository.go` |
131-
132-## Testing with Mocks
133-
134-All ports have auto-generated mocks via mockgen:
135-
136-```bash
137-go generate ./internal/domain/ports
138-```
139-
140-Mocks enable unit testing of handlers without infrastructure:
141-
142-```go
143-ctrl := gomock.NewController(t)
144-defer ctrl.Finish()
145-mockFS := mocks.NewMockFileSystem(ctrl)
146-mockExec := mocks.NewMockCommandExecutor(ctrl)
147-
148-handler := NewPreflightHandler(mockFS, mockExec, mockLogger)
149-// Test with mocks
150-```
151-
152-## Deferred to Phase 8
153-
154-HTTP client support for timezone API and file downloads will be added during Phase 8 (Incremental Migration) when migrating the system configuration and post-installation phases.
155-
156-## Key Principles
157-
158-1. **Dependency Inversion**: Handlers depend on abstractions (ports), not concrete types
159-2. **Single Responsibility**: Each adapter implements exactly one port interface
160-3. **Constructor Injection**: All dependencies passed via constructors, never globals
161-4. **Port Segregation**: Handlers receive only the ports they need
162-5. **Testability**: Mocks enable testing without infrastructure dependencies
@@ -1,162 +0,0 @@
1-# Dependency Injection Architecture (Phase 7)
2-
3-## Overview
4-
5-Phase 7 implements complete dependency injection wiring for the DDD architecture, enabling proper inversion of control and testability across all layers.
6-
7-## Architecture
8-
9-### Dependency Flow (Correct Inversion)
10-
11-```
12-UI Layer (interfaces/tui)
13- ↓ depends on
14-Application Layer (commands, handlers, services)
15- ↓ depends on
16-Domain Layer (aggregates, ports, value objects)
17- ↑ no dependencies
18-Infrastructure Layer (adapters) implements domain ports
19-```
20-
21-## Wiring in cmd/archup/main.go
22-
23-### 1. Infrastructure Adapters (Lowest Layer)
24-
25-All adapters are created first and implement domain ports:
26-
27-```go
28-// Filesystem operations
29-fsAdapter := &filesystem.LocalFileSystem{}
30-
31-// Command execution
32-shellExec := executor.NewShellExecutor(slogAdapter)
33-chrootExec := executor.NewChrootExecutor(slogAdapter)
34-scriptExec := executor.NewScriptExecutor(fsAdapter, shellExec, config.DefaultInstallDir)
35-
36-// Persistence
37-repoAdapter, err := persistence.NewFileRepository(config.DefaultConfigPath)
38-
39-// Logging
40-slogAdapter := infralogger.NewSlogAdapter(oldLog.Slog())
41-```
42-
43-### 2. Command Handlers (Application Layer)
44-
45-Handlers are injected with port dependencies only (never concrete implementations):
46-
47-```go
48-preflightHandler := apphandlers.NewPreflightHandler(fsAdapter, shellExec, slogAdapter)
49-partitionHandler := apphandlers.NewPartitionHandler(shellExec, slogAdapter)
50-baseHandler := apphandlers.NewInstallBaseHandler(fsAdapter, shellExec, chrootExec, slogAdapter)
51-configHandler := apphandlers.NewConfigureSystemHandler(chrootExec, slogAdapter)
52-bootloaderHandler := apphandlers.NewBootloaderHandler(chrootExec, slogAdapter)
53-reposHandler := apphandlers.NewReposHandler(chrootExec, slogAdapter)
54-postInstallHandler := apphandlers.NewPostInstallHandler(chrootExec, scriptExec, slogAdapter)
55-```
56-
57-### 3. Installation Service
58-
59-The main orchestrator receives all handlers and coordinates the installation:
60-
61-```go
62-installService := services.NewInstallationService(
63- repoAdapter,
64- slogAdapter,
65- preflightHandler,
66- partitionHandler,
67- baseHandler,
68- configHandler,
69- bootloaderHandler,
70- reposHandler,
71- postInstallHandler,
72-)
73-```
74-
75-### 4. TUI Application
76-
77-The user interface receives the service and tracker, with no direct access to domain/infrastructure:
78-
79-```go
80-tuiApp := tui.NewApp(installService, installService.Tracker(), slogAdapter)
81-```
82-
83-## Constructor Signatures (Phase 7 Requirements)
84-
85-### ShellExecutor
86-```go
87-func NewShellExecutor(logger ports.Logger) *ShellExecutor
88-```
89-- Requires: Logger for command execution logging
90-
91-### ChrootExecutor
92-```go
93-func NewChrootExecutor(logger ports.Logger) *ChrootExecutor
94-```
95-- Requires: Logger for chroot operation logging
96-
97-### ScriptExecutor
98-```go
99-func NewScriptExecutor(fs ports.FileSystem, cmdExec ports.CommandExecutor, scriptDir string) *ScriptExecutor
100-```
101-- Requires: FileSystem for script validation
102-- Requires: CommandExecutor for optional command execution
103-- Requires: Script directory path
104-
105-### Logger Adapter
106-```go
107-func NewSlogAdapter(logger *slog.Logger) *SlogAdapter
108-```
109-- Requires: Pre-configured `*slog.Logger` instance
110-- No error return (file operations handled by caller)
111-
112-### FileRepository
113-```go
114-func NewFileRepository(basePath string) (*FileRepository, error)
115-```
116-- Requires: Base path for state persistence
117-- Returns: error if directory creation fails
118-
119-## Port Implementations
120-
121-All infrastructure adapters implement domain ports exactly:
122-
123-| Port | Adapter | Location |
124-|------|---------|----------|
125-| `FileSystem` | `LocalFileSystem` | `internal/infrastructure/filesystem/local.go` |
126-| `CommandExecutor` | `ShellExecutor` | `internal/infrastructure/executor/shell.go` |
127-| `ChrootExecutor` | `ChrootExecutor` | `internal/infrastructure/executor/chroot.go` |
128-| `ScriptExecutor` | `ScriptExecutor` | `internal/infrastructure/executor/script.go` |
129-| `Logger` | `SlogAdapter` | `internal/infrastructure/logger/slog_adapter.go` |
130-| `InstallationRepository` | `FileRepository` | `internal/infrastructure/persistence/file_repository.go` |
131-
132-## Testing with Mocks
133-
134-All ports have auto-generated mocks via mockgen:
135-
136-```bash
137-go generate ./internal/domain/ports
138-```
139-
140-Mocks enable unit testing of handlers without infrastructure:
141-
142-```go
143-ctrl := gomock.NewController(t)
144-defer ctrl.Finish()
145-mockFS := mocks.NewMockFileSystem(ctrl)
146-mockExec := mocks.NewMockCommandExecutor(ctrl)
147-
148-handler := NewPreflightHandler(mockFS, mockExec, mockLogger)
149-// Test with mocks
150-```
151-
152-## Deferred to Phase 8
153-
154-HTTP client support for timezone API and file downloads will be added during Phase 8 (Incremental Migration) when migrating the system configuration and post-installation phases.
155-
156-## Key Principles
157-
158-1. **Dependency Inversion**: Handlers depend on abstractions (ports), not concrete types
159-2. **Single Responsibility**: Each adapter implements exactly one port interface
160-3. **Constructor Injection**: All dependencies passed via constructors, never globals
161-4. **Port Segregation**: Handlers receive only the ports they need
162-5. **Testability**: Mocks enable testing without infrastructure dependencies
D docs/architecture.md +0 -400
@@ -1,400 +0,0 @@
1-# ArchUp Architecture - Domain-Driven Design (DDD)
2-
3-## Overview
4-
5-ArchUp has been restructured using Domain-Driven Design (DDD) principles to achieve:
6-- Better testability (domain logic tested without infrastructure)
7-- Clear separation of concerns (business logic isolated from infrastructure)
8-- Improved maintainability (easy to extend without modifying existing code)
9-- Reduced coupling (dependencies point inward)
10-
11-## Core Principles
12-
13-1. **Business logic ONLY in domain** - NO external dependencies (no OS, HTTP, DB, etc.)
14-2. **Domain defines interfaces (Ports)** - Infrastructure implements them (Adapters)
15-3. **Dependencies point INWARD** - Everything depends on domain, domain depends on nothing
16-
17-## Dependency Flow
18-
19-```
20-┌─────────────────────────────────────┐
21-│ User Interface (TUI/CLI) │ ← Entry points
22-├─────────────────────────────────────┤
23-│ Application Layer │ ← Use cases (commands, handlers, services)
24-├─────────────────────────────────────┤
25-│ Domain Layer │ ← Business logic (entities, value objects, rules)
26-├─────────────────────────────────────┤
27-│ Infrastructure Layer │ ← Adapters implementing domain ports
28-└─────────────────────────────────────┘
29-```
30-
31-Dependencies: UI → App → Domain ← Infrastructure
32-
33-## Directory Structure
34-
35-### `/internal/domain/` - Pure Business Logic
36-
37-**NO external dependencies allowed** (except: `context`, `errors`, `fmt`, `time`, `strings`, `github.com/google/uuid`)
38-
39-#### `domain/installation/`
40-- **installation.go** - Installation aggregate root (entity) managing lifecycle
41-- **state.go** - State enum and transition validation
42-- **events.go** - Domain events (InstallationStarted, PhaseCompleted, etc.)
43-- **errors.go** - Domain-specific error types
44-
45-#### `domain/system/`
46-- **config.go** - SystemConfig value object (hostname, locale, timezone, keymap)
47-- **validation.go** - System validation rules
48-- **cpu.go** - CPU detection value object (vendor, microcode)
49-
50-#### `domain/disk/`
51-- **disk.go** - Disk entity (device, size, partitions)
52-- **partition.go** - Partition value object (device, size, filesystem, mount point)
53-- **encryption.go** - Encryption value object (none/LUKS/LUKS-LVM, password requirements)
54-- **layout.go** - Partition layout rules and validation
55-
56-#### `domain/bootloader/`
57-- **bootloader.go** - Bootloader value object (type, configuration)
58-- **limine.go** - Limine-specific configuration and rules
59-
60-#### `domain/user/`
61-- **user.go** - User entity (username, groups, shell)
62-- **credentials.go** - Credentials value object (password hashing, validation)
63-- **validation.go** - User validation rules (username format, password strength)
64-
65-#### `domain/packages/`
66-- **package.go** - Package value object
67-- **repository.go** - Repository configuration (Arch Linux, AUR, Chaotic-AUR)
68-- **kernel.go** - Kernel choice value object (linux, linux-zen, linux-lts, etc.)
69-
70-#### `domain/ports/` - Hexagonal Architecture Ports
71-**ALL infrastructure interactions via these interfaces**
72-
73-- **filesystem.go** - FileSystem port (Read, Write, Chmod, MkdirAll, etc.)
74-- **executor.go** - CommandExecutor, ChrootExecutor, ScriptExecutor ports
75-- **repository.go** - InstallationRepository port (Save, Load)
76-- **downloader.go** - HTTPClient port (Get, Post)
77-- **logger.go** - Logger port (Info, Warn, Error, Debug)
78-
79-### `/internal/application/` - Use Case Orchestration
80-
81-Glues together domain logic with infrastructure adapters. **Imports domain/** but not **infrastructure/**.
82-
83-#### `application/commands/`
84-Plain data structures (DTOs) representing user intents:
85-- **preflight.go** - PreflightCommand
86-- **partition.go** - PartitionDiskCommand
87-- **install_base.go** - InstallBaseCommand
88-- **configure_system.go** - ConfigureSystemCommand
89-- **install_bootloader.go** - InstallBootloaderCommand
90-- **setup_repos.go** - SetupRepositoriesCommand
91-- **post_install.go** - PostInstallCommand
92-
93-#### `application/handlers/`
94-Command handlers implementing use cases. Each handler:
95-1. Receives a command (DTO)
96-2. Uses ports to gather system info
97-3. Creates domain objects with validation
98-4. Calls domain methods
99-5. Returns result (DTO)
100-
101-- **preflight_handler.go** - Handles PreflightCommand
102-- **partition_handler.go** - Handles PartitionDiskCommand
103-- **install_base_handler.go** - Handles InstallBaseCommand
104-- **configure_system_handler.go** - Handles ConfigureSystemCommand
105-- **bootloader_handler.go** - Handles InstallBootloaderCommand
106-- **repos_handler.go** - Handles SetupRepositoriesCommand
107-- **post_install_handler.go** - Handles PostInstallCommand
108-
109-#### `application/services/`
110-Application services coordinating the overall installation:
111-- **installation_service.go** - Main orchestrator managing all handlers and state
112-- **progress_tracker.go** - Progress tracking with event publishing
113-
114-#### `application/dto/`
115-Data Transfer Objects for communication across boundaries:
116-- **installation_status.go** - InstallationStatus, PhaseStatus
117-- **progress_update.go** - ProgressUpdate for UI subscribers
118-
119-### `/internal/infrastructure/` - Adapters (External System Implementation)
120-
121-Implements domain ports. **Imports domain/** but NOT **application/**.
122-
123-#### `infrastructure/filesystem/`
124-Filesystem port adapters:
125-- **local.go** - LocalFileSystem (implements domain.FileSystem)
126-- **mock.go** - MockFileSystem (for testing)
127-
128-#### `infrastructure/executor/`
129-Command execution adapters:
130-- **shell.go** - ShellExecutor (implements domain.CommandExecutor)
131-- **chroot.go** - ChrootExecutor (implements domain.ChrootExecutor)
132-- **script.go** - ScriptExecutor for mandatory shell scripts
133-- **mock.go** - MockExecutor (for testing)
134-
135-#### `infrastructure/persistence/`
136-Data persistence adapters:
137-- **file_repository.go** - FileRepository (implements domain.InstallationRepository)
138-- **config_file.go** - Config file loader/saver (shell-compatible format)
139-
140-#### `infrastructure/http/`
141-HTTP client adapters:
142-- **client.go** - HTTPClient (implements domain.Downloader)
143-- **mock.go** - MockHTTPClient (for testing)
144-
145-#### `infrastructure/logger/`
146-Logging adapters:
147-- **slog_adapter.go** - SlogAdapter (implements domain.Logger, wraps Go's slog)
148-
149-### `/internal/interfaces/` - Entry Points (Thin Layer)
150-
151-UI/CLI layer. **Imports application/** but minimal domain access.
152-
153-#### `interfaces/tui/`
154-BubbleTea terminal UI application:
155-- **app.go** - Main TUI application
156- - **wizard/** - Post-boot wizard TUI (desktop setup)
157-
158-#### `interfaces/tui/models/`
159-BubbleTea models (UI state only, no business logic):
160-- **form.go** - Form input model
161-- **installation.go** - Installation progress model
162-- **progress.go** - Progress display model
163-
164-#### `interfaces/tui/views/`
165-Pure presentation layer (rendering):
166-- **form_view.go** - Form rendering
167-- **progress_view.go** - Progress rendering
168-- **summary_view.go** - Summary rendering
169-
170-#### `interfaces/tui/handlers/`
171-UI event handlers (delegate to application services):
172-- **form_handler.go** - Form submission handler
173-- **install_handler.go** - Installation event handler
174-
175-#### `interfaces/cli/` (Future)
176-CLI commands (e.g., using Cobra):
177-- **root.go** - Root command
178-- **install.go** - Install command
179-
180-### `/cmd/archup/`
181-Application entry point with dependency injection:
182-- **main.go** - Wire all dependencies (adapters, handlers, services, TUI)
183-
184-### Wizard Flow (post-boot)
185-
186-- Welcome → Compositor → SDDM → Optional → Confirm → Install → Monitors → Apply Config → Complete
187-- Config outputs:
188- - Hyprland: `~/.config/hypr/archup.conf`, `~/.config/hypr/archup-monitors.conf`
189- - Niri: `~/.config/niri/archup.kdl`, `~/.config/niri/archup-monitors.kdl`
190- - Waybar: `~/.config/waybar/config`, `~/.config/waybar/style.css`
191- - Locks: `~/.config/hypr/hyprlock.conf`, `~/.config/hypr/hypridle.conf`
192-
193-## Architecture Patterns
194-
195-### 1. Aggregate Root (Installation)
196-
197-The `Installation` aggregate manages the entire installation lifecycle:
198-```
199-Installation (aggregate root)
200-├── state: InstallationState
201-├── config: InstallationConfig (value object)
202-├── system: SystemConfig (value object)
203-├── disk: Disk (entity with partitions)
204-├── user: User (entity)
205-└── ...
206-```
207-
208-### 2. Value Objects
209-
210-Immutable, validated objects representing concepts:
211-- `SystemConfig` - hostname, timezone, locale
212-- `Encryption` - encryption type and password requirements
213-- `Credentials` - user password (hashed)
214-- `Kernel` - kernel choice
215-
216-### 3. Ports (Interfaces)
217-
218-Domain defines what external systems must provide:
219-```go
220-// domain/ports/filesystem.go
221-type FileSystem interface {
222- ReadFile(path string) ([]byte, error)
223- WriteFile(path string, data []byte, perm os.FileMode) error
224- Chmod(path string, perm os.FileMode) error
225- MkdirAll(path string, perm os.FileMode) error
226-}
227-```
228-
229-### 4. Adapters
230-
231-Infrastructure implements ports:
232-```go
233-// infrastructure/filesystem/local.go
234-type LocalFileSystem struct{}
235-
236-func (fs *LocalFileSystem) ReadFile(path string) ([]byte, error) {
237- return os.ReadFile(path)
238-}
239-// ... implements domain.FileSystem
240-```
241-
242-### 5. Command Handler Pattern
243-
244-Each use case has:
245-1. **Command** (DTO): Input data
246-2. **Handler**: Orchestrates domain + infrastructure
247-3. **Result** (DTO): Output data
248-
249-```go
250-// Define command
251-cmd := commands.PreflightCommand{
252- MountPoint: "/mnt",
253-}
254-
255-// Execute via handler
256-result, err := handler.Handle(ctx, cmd)
257-```
258-
259-## Testing Strategy
260-
261-### Domain Tests
262-- **Where**: `internal/domain/*/` with `_test.go` files
263-- **What**: Pure unit tests of business rules
264-- **How**: No mocks, no external dependencies
265-- **Speed**: Fast (milliseconds)
266-
267-```go
268-func TestSystemConfig_Validation(t *testing.T) {
269- cfg, err := domain.NewSystemConfig("hostname", "UTC", "en_US.UTF-8", "us")
270- assert.NoError(t, err)
271- assert.Equal(t, "hostname", cfg.Hostname())
272-}
273-```
274-
275-### Application Tests
276-- **Where**: `internal/application/*/` with `_test.go` files
277-- **What**: Handler logic with mocked ports
278-- **How**: Use mock implementations (infrastructure/*/mock.go)
279-- **Speed**: Fast (milliseconds)
280-
281-```go
282-func TestPreflightHandler_Handle(t *testing.T) {
283- mockFS := &filesystem.MockFileSystem{}
284- mockExec := &executor.MockExecutor{}
285- handler := handlers.NewPreflightHandler(mockFS, mockExec, logger)
286-
287- result, err := handler.Handle(ctx, cmd)
288- assert.NoError(t, err)
289-}
290-```
291-
292-### Integration Tests
293-- **Where**: `test/integration/` or similar
294-- **What**: Full end-to-end scenarios
295-- **How**: Real adapters in VM environment
296-- **Speed**: Slow (minutes), run before commit
297-
298-```go
299-func TestFullInstallation(t *testing.T) {
300- // End-to-end test in VM
301- // Uses real filesystem, chroot, pacstrap, etc.
302-}
303-```
304-
305-## Migration Checklist
306-
307-For each phase migrated from shell scripts:
308-
309-1. **Extract business rules** → domain layer
310-2. **Create value objects** with validation
311-3. **Define port interfaces** needed
312-4. **Create command DTO** for input
313-5. **Implement handler** in application layer
314-6. **Create adapters** implementing ports
315-7. **Write domain tests** (pure unit tests)
316-8. **Write application tests** (with mocks)
317-9. **Write integration tests** (in VM)
318-10. **Update TUI** to use handler
319-11. **Test in VM** to verify functionality
320-12. **Document changes**
321-
322-## Development Workflow
323-
324-### Adding a New Feature
325-
326-1. Define domain rules in `domain/*/`
327-2. Create command in `application/commands/`
328-3. Create handler in `application/handlers/`
329-4. Implement adapters in `infrastructure/*/`
330-5. Add UI in `interfaces/tui/`
331-6. Wire in `cmd/archup/main.go`
332-
333-### Fixing a Bug
334-
335-1. Write failing test at appropriate layer
336-2. Fix in domain (if business logic) or adapter (if infrastructure)
337-3. Verify tests pass
338-4. Test in VM if infrastructure-related
339-
340-### Changing Infrastructure
341-
342-1. Create new adapter implementing port
343-2. Update `cmd/archup/main.go` wiring
344-3. Existing domain and application code unchanged
345-4. No need to modify business logic
346-
347-## Important Files
348-
349-- **DDD_REFACTORING_PLAN.md** - Complete refactoring plan with detailed phases
350-- **docs/script-migration.md** - Shell scripts categorization and migration strategy
351-- **internal/domain/ports/** - All port interfaces (critical!)
352-- **cmd/archup/main.go** - Dependency injection wiring
353-
354-## References
355-
356-- Eric Evans - Domain-Driven Design (DDD book)
357-- Hexagonal Architecture (Ports & Adapters)
358-- Clean Architecture by Robert C. Martin
359-- Project DDD Plan: `DDD_REFACTORING_PLAN.md`
360-- Shell Scripts Audit: `docs/script-migration.md`
361-
362-## Key Rules
363-
364-### Domain Layer
365-- ✅ Pure business logic
366-- ✅ Validation of invariants
367-- ✅ Value objects (immutable)
368-- ✅ Entities with identity
369-- ❌ NO external dependencies
370-- ❌ NO file system access
371-- ❌ NO HTTP calls
372-- ❌ NO database access
373-
374-### Application Layer
375-- ✅ Orchestrates domain + infrastructure
376-- ✅ Implements use cases
377-- ✅ Delegates to ports
378-- ✅ Returns DTOs
379-- ❌ NO business logic
380-- ❌ NO direct infrastructure calls
381-- ❌ NO direct UI logic
382-
383-### Infrastructure Layer
384-- ✅ Implements ports
385-- ✅ Handles external systems
386-- ✅ Contains adapters
387-- ❌ NO business logic
388-- ❌ NO use case orchestration
389-
390-### Interfaces Layer
391-- ✅ Handles user input/output
392-- ✅ Delegates to application services
393-- ✅ Pure presentation
394-- ❌ NO business logic
395-- ❌ NO infrastructure details
396-
397----
398-
399-**Status**: Phase 2 Complete - Directory structure established
400-**Next**: Phase 3 - Define Domain Layer with entities and value objects
@@ -1,400 +0,0 @@
1-# ArchUp Architecture - Domain-Driven Design (DDD)
2-
3-## Overview
4-
5-ArchUp has been restructured using Domain-Driven Design (DDD) principles to achieve:
6-- Better testability (domain logic tested without infrastructure)
7-- Clear separation of concerns (business logic isolated from infrastructure)
8-- Improved maintainability (easy to extend without modifying existing code)
9-- Reduced coupling (dependencies point inward)
10-
11-## Core Principles
12-
13-1. **Business logic ONLY in domain** - NO external dependencies (no OS, HTTP, DB, etc.)
14-2. **Domain defines interfaces (Ports)** - Infrastructure implements them (Adapters)
15-3. **Dependencies point INWARD** - Everything depends on domain, domain depends on nothing
16-
17-## Dependency Flow
18-
19-```
20-┌─────────────────────────────────────┐
21-│ User Interface (TUI/CLI) │ ← Entry points
22-├─────────────────────────────────────┤
23-│ Application Layer │ ← Use cases (commands, handlers, services)
24-├─────────────────────────────────────┤
25-│ Domain Layer │ ← Business logic (entities, value objects, rules)
26-├─────────────────────────────────────┤
27-│ Infrastructure Layer │ ← Adapters implementing domain ports
28-└─────────────────────────────────────┘
29-```
30-
31-Dependencies: UI → App → Domain ← Infrastructure
32-
33-## Directory Structure
34-
35-### `/internal/domain/` - Pure Business Logic
36-
37-**NO external dependencies allowed** (except: `context`, `errors`, `fmt`, `time`, `strings`, `github.com/google/uuid`)
38-
39-#### `domain/installation/`
40-- **installation.go** - Installation aggregate root (entity) managing lifecycle
41-- **state.go** - State enum and transition validation
42-- **events.go** - Domain events (InstallationStarted, PhaseCompleted, etc.)
43-- **errors.go** - Domain-specific error types
44-
45-#### `domain/system/`
46-- **config.go** - SystemConfig value object (hostname, locale, timezone, keymap)
47-- **validation.go** - System validation rules
48-- **cpu.go** - CPU detection value object (vendor, microcode)
49-
50-#### `domain/disk/`
51-- **disk.go** - Disk entity (device, size, partitions)
52-- **partition.go** - Partition value object (device, size, filesystem, mount point)
53-- **encryption.go** - Encryption value object (none/LUKS/LUKS-LVM, password requirements)
54-- **layout.go** - Partition layout rules and validation
55-
56-#### `domain/bootloader/`
57-- **bootloader.go** - Bootloader value object (type, configuration)
58-- **limine.go** - Limine-specific configuration and rules
59-
60-#### `domain/user/`
61-- **user.go** - User entity (username, groups, shell)
62-- **credentials.go** - Credentials value object (password hashing, validation)
63-- **validation.go** - User validation rules (username format, password strength)
64-
65-#### `domain/packages/`
66-- **package.go** - Package value object
67-- **repository.go** - Repository configuration (Arch Linux, AUR, Chaotic-AUR)
68-- **kernel.go** - Kernel choice value object (linux, linux-zen, linux-lts, etc.)
69-
70-#### `domain/ports/` - Hexagonal Architecture Ports
71-**ALL infrastructure interactions via these interfaces**
72-
73-- **filesystem.go** - FileSystem port (Read, Write, Chmod, MkdirAll, etc.)
74-- **executor.go** - CommandExecutor, ChrootExecutor, ScriptExecutor ports
75-- **repository.go** - InstallationRepository port (Save, Load)
76-- **downloader.go** - HTTPClient port (Get, Post)
77-- **logger.go** - Logger port (Info, Warn, Error, Debug)
78-
79-### `/internal/application/` - Use Case Orchestration
80-
81-Glues together domain logic with infrastructure adapters. **Imports domain/** but not **infrastructure/**.
82-
83-#### `application/commands/`
84-Plain data structures (DTOs) representing user intents:
85-- **preflight.go** - PreflightCommand
86-- **partition.go** - PartitionDiskCommand
87-- **install_base.go** - InstallBaseCommand
88-- **configure_system.go** - ConfigureSystemCommand
89-- **install_bootloader.go** - InstallBootloaderCommand
90-- **setup_repos.go** - SetupRepositoriesCommand
91-- **post_install.go** - PostInstallCommand
92-
93-#### `application/handlers/`
94-Command handlers implementing use cases. Each handler:
95-1. Receives a command (DTO)
96-2. Uses ports to gather system info
97-3. Creates domain objects with validation
98-4. Calls domain methods
99-5. Returns result (DTO)
100-
101-- **preflight_handler.go** - Handles PreflightCommand
102-- **partition_handler.go** - Handles PartitionDiskCommand
103-- **install_base_handler.go** - Handles InstallBaseCommand
104-- **configure_system_handler.go** - Handles ConfigureSystemCommand
105-- **bootloader_handler.go** - Handles InstallBootloaderCommand
106-- **repos_handler.go** - Handles SetupRepositoriesCommand
107-- **post_install_handler.go** - Handles PostInstallCommand
108-
109-#### `application/services/`
110-Application services coordinating the overall installation:
111-- **installation_service.go** - Main orchestrator managing all handlers and state
112-- **progress_tracker.go** - Progress tracking with event publishing
113-
114-#### `application/dto/`
115-Data Transfer Objects for communication across boundaries:
116-- **installation_status.go** - InstallationStatus, PhaseStatus
117-- **progress_update.go** - ProgressUpdate for UI subscribers
118-
119-### `/internal/infrastructure/` - Adapters (External System Implementation)
120-
121-Implements domain ports. **Imports domain/** but NOT **application/**.
122-
123-#### `infrastructure/filesystem/`
124-Filesystem port adapters:
125-- **local.go** - LocalFileSystem (implements domain.FileSystem)
126-- **mock.go** - MockFileSystem (for testing)
127-
128-#### `infrastructure/executor/`
129-Command execution adapters:
130-- **shell.go** - ShellExecutor (implements domain.CommandExecutor)
131-- **chroot.go** - ChrootExecutor (implements domain.ChrootExecutor)
132-- **script.go** - ScriptExecutor for mandatory shell scripts
133-- **mock.go** - MockExecutor (for testing)
134-
135-#### `infrastructure/persistence/`
136-Data persistence adapters:
137-- **file_repository.go** - FileRepository (implements domain.InstallationRepository)
138-- **config_file.go** - Config file loader/saver (shell-compatible format)
139-
140-#### `infrastructure/http/`
141-HTTP client adapters:
142-- **client.go** - HTTPClient (implements domain.Downloader)
143-- **mock.go** - MockHTTPClient (for testing)
144-
145-#### `infrastructure/logger/`
146-Logging adapters:
147-- **slog_adapter.go** - SlogAdapter (implements domain.Logger, wraps Go's slog)
148-
149-### `/internal/interfaces/` - Entry Points (Thin Layer)
150-
151-UI/CLI layer. **Imports application/** but minimal domain access.
152-
153-#### `interfaces/tui/`
154-BubbleTea terminal UI application:
155-- **app.go** - Main TUI application
156- - **wizard/** - Post-boot wizard TUI (desktop setup)
157-
158-#### `interfaces/tui/models/`
159-BubbleTea models (UI state only, no business logic):
160-- **form.go** - Form input model
161-- **installation.go** - Installation progress model
162-- **progress.go** - Progress display model
163-
164-#### `interfaces/tui/views/`
165-Pure presentation layer (rendering):
166-- **form_view.go** - Form rendering
167-- **progress_view.go** - Progress rendering
168-- **summary_view.go** - Summary rendering
169-
170-#### `interfaces/tui/handlers/`
171-UI event handlers (delegate to application services):
172-- **form_handler.go** - Form submission handler
173-- **install_handler.go** - Installation event handler
174-
175-#### `interfaces/cli/` (Future)
176-CLI commands (e.g., using Cobra):
177-- **root.go** - Root command
178-- **install.go** - Install command
179-
180-### `/cmd/archup/`
181-Application entry point with dependency injection:
182-- **main.go** - Wire all dependencies (adapters, handlers, services, TUI)
183-
184-### Wizard Flow (post-boot)
185-
186-- Welcome → Compositor → SDDM → Optional → Confirm → Install → Monitors → Apply Config → Complete
187-- Config outputs:
188- - Hyprland: `~/.config/hypr/archup.conf`, `~/.config/hypr/archup-monitors.conf`
189- - Niri: `~/.config/niri/archup.kdl`, `~/.config/niri/archup-monitors.kdl`
190- - Waybar: `~/.config/waybar/config`, `~/.config/waybar/style.css`
191- - Locks: `~/.config/hypr/hyprlock.conf`, `~/.config/hypr/hypridle.conf`
192-
193-## Architecture Patterns
194-
195-### 1. Aggregate Root (Installation)
196-
197-The `Installation` aggregate manages the entire installation lifecycle:
198-```
199-Installation (aggregate root)
200-├── state: InstallationState
201-├── config: InstallationConfig (value object)
202-├── system: SystemConfig (value object)
203-├── disk: Disk (entity with partitions)
204-├── user: User (entity)
205-└── ...
206-```
207-
208-### 2. Value Objects
209-
210-Immutable, validated objects representing concepts:
211-- `SystemConfig` - hostname, timezone, locale
212-- `Encryption` - encryption type and password requirements
213-- `Credentials` - user password (hashed)
214-- `Kernel` - kernel choice
215-
216-### 3. Ports (Interfaces)
217-
218-Domain defines what external systems must provide:
219-```go
220-// domain/ports/filesystem.go
221-type FileSystem interface {
222- ReadFile(path string) ([]byte, error)
223- WriteFile(path string, data []byte, perm os.FileMode) error
224- Chmod(path string, perm os.FileMode) error
225- MkdirAll(path string, perm os.FileMode) error
226-}
227-```
228-
229-### 4. Adapters
230-
231-Infrastructure implements ports:
232-```go
233-// infrastructure/filesystem/local.go
234-type LocalFileSystem struct{}
235-
236-func (fs *LocalFileSystem) ReadFile(path string) ([]byte, error) {
237- return os.ReadFile(path)
238-}
239-// ... implements domain.FileSystem
240-```
241-
242-### 5. Command Handler Pattern
243-
244-Each use case has:
245-1. **Command** (DTO): Input data
246-2. **Handler**: Orchestrates domain + infrastructure
247-3. **Result** (DTO): Output data
248-
249-```go
250-// Define command
251-cmd := commands.PreflightCommand{
252- MountPoint: "/mnt",
253-}
254-
255-// Execute via handler
256-result, err := handler.Handle(ctx, cmd)
257-```
258-
259-## Testing Strategy
260-
261-### Domain Tests
262-- **Where**: `internal/domain/*/` with `_test.go` files
263-- **What**: Pure unit tests of business rules
264-- **How**: No mocks, no external dependencies
265-- **Speed**: Fast (milliseconds)
266-
267-```go
268-func TestSystemConfig_Validation(t *testing.T) {
269- cfg, err := domain.NewSystemConfig("hostname", "UTC", "en_US.UTF-8", "us")
270- assert.NoError(t, err)
271- assert.Equal(t, "hostname", cfg.Hostname())
272-}
273-```
274-
275-### Application Tests
276-- **Where**: `internal/application/*/` with `_test.go` files
277-- **What**: Handler logic with mocked ports
278-- **How**: Use mock implementations (infrastructure/*/mock.go)
279-- **Speed**: Fast (milliseconds)
280-
281-```go
282-func TestPreflightHandler_Handle(t *testing.T) {
283- mockFS := &filesystem.MockFileSystem{}
284- mockExec := &executor.MockExecutor{}
285- handler := handlers.NewPreflightHandler(mockFS, mockExec, logger)
286-
287- result, err := handler.Handle(ctx, cmd)
288- assert.NoError(t, err)
289-}
290-```
291-
292-### Integration Tests
293-- **Where**: `test/integration/` or similar
294-- **What**: Full end-to-end scenarios
295-- **How**: Real adapters in VM environment
296-- **Speed**: Slow (minutes), run before commit
297-
298-```go
299-func TestFullInstallation(t *testing.T) {
300- // End-to-end test in VM
301- // Uses real filesystem, chroot, pacstrap, etc.
302-}
303-```
304-
305-## Migration Checklist
306-
307-For each phase migrated from shell scripts:
308-
309-1. **Extract business rules** → domain layer
310-2. **Create value objects** with validation
311-3. **Define port interfaces** needed
312-4. **Create command DTO** for input
313-5. **Implement handler** in application layer
314-6. **Create adapters** implementing ports
315-7. **Write domain tests** (pure unit tests)
316-8. **Write application tests** (with mocks)
317-9. **Write integration tests** (in VM)
318-10. **Update TUI** to use handler
319-11. **Test in VM** to verify functionality
320-12. **Document changes**
321-
322-## Development Workflow
323-
324-### Adding a New Feature
325-
326-1. Define domain rules in `domain/*/`
327-2. Create command in `application/commands/`
328-3. Create handler in `application/handlers/`
329-4. Implement adapters in `infrastructure/*/`
330-5. Add UI in `interfaces/tui/`
331-6. Wire in `cmd/archup/main.go`
332-
333-### Fixing a Bug
334-
335-1. Write failing test at appropriate layer
336-2. Fix in domain (if business logic) or adapter (if infrastructure)
337-3. Verify tests pass
338-4. Test in VM if infrastructure-related
339-
340-### Changing Infrastructure
341-
342-1. Create new adapter implementing port
343-2. Update `cmd/archup/main.go` wiring
344-3. Existing domain and application code unchanged
345-4. No need to modify business logic
346-
347-## Important Files
348-
349-- **DDD_REFACTORING_PLAN.md** - Complete refactoring plan with detailed phases
350-- **docs/script-migration.md** - Shell scripts categorization and migration strategy
351-- **internal/domain/ports/** - All port interfaces (critical!)
352-- **cmd/archup/main.go** - Dependency injection wiring
353-
354-## References
355-
356-- Eric Evans - Domain-Driven Design (DDD book)
357-- Hexagonal Architecture (Ports & Adapters)
358-- Clean Architecture by Robert C. Martin
359-- Project DDD Plan: `DDD_REFACTORING_PLAN.md`
360-- Shell Scripts Audit: `docs/script-migration.md`
361-
362-## Key Rules
363-
364-### Domain Layer
365-- ✅ Pure business logic
366-- ✅ Validation of invariants
367-- ✅ Value objects (immutable)
368-- ✅ Entities with identity
369-- ❌ NO external dependencies
370-- ❌ NO file system access
371-- ❌ NO HTTP calls
372-- ❌ NO database access
373-
374-### Application Layer
375-- ✅ Orchestrates domain + infrastructure
376-- ✅ Implements use cases
377-- ✅ Delegates to ports
378-- ✅ Returns DTOs
379-- ❌ NO business logic
380-- ❌ NO direct infrastructure calls
381-- ❌ NO direct UI logic
382-
383-### Infrastructure Layer
384-- ✅ Implements ports
385-- ✅ Handles external systems
386-- ✅ Contains adapters
387-- ❌ NO business logic
388-- ❌ NO use case orchestration
389-
390-### Interfaces Layer
391-- ✅ Handles user input/output
392-- ✅ Delegates to application services
393-- ✅ Pure presentation
394-- ❌ NO business logic
395-- ❌ NO infrastructure details
396-
397----
398-
399-**Status**: Phase 2 Complete - Directory structure established
400-**Next**: Phase 3 - Define Domain Layer with entities and value objects
D docs/script-migration.md +0 -274
@@ -1,274 +0,0 @@
1-# Shell Scripts Audit and Migration Plan
2-
3-**Audit Date:** October 31, 2025
4-**Phase:** 1 - Script Categorization for DDD Refactoring
5-**Total Scripts Found:** 54 files (50 .sh scripts, 1 .service file)
6-
7-## Summary
8-
9-This document categorizes all shell scripts in the `install/` directory for the transition from phase-based shell scripting to Domain-Driven Design (DDD) Go application.
10-
11-### Categories
12-
13-- **MANDATORY**: Scripts actively referenced in Go code - must be preserved and executed
14-- **INTEGRATION**: Scripts used by installation phases - will be wrapped by handlers
15-- **HELPER**: Utility scripts providing infrastructure functions - will be adapted to ports
16-- **CONFIG_TEMPLATE**: Configuration file templates - will be migrated to domain objects
17-- **DEPRECATED**: Legacy scripts for removal after migration
18-
19----
20-
21-## Directory-by-Directory Analysis
22-
23-### `install/bootstrap.sh` (Root Level)
24-- **Status**: MANDATORY
25-- **Purpose**: Main entry point for installation
26-- **Used By**: CLI entry point
27-- **Notes**: Will become dependency injection container
28-
29-### `install/base/` (Base System Installation)
30-**Purpose**: Core Arch Linux system installation via pacstrap
31-
32-| Script | Status | Used By | Notes |
33-|--------|--------|---------|-------|
34-| `all.sh` | INTEGRATION | BaseInstallationHandler | Orchestrates base installation |
35-| `pacstrap.sh` | INTEGRATION | all.sh | Runs pacstrap with package list |
36-| `kernel.sh` | INTEGRATION | all.sh | Selects and installs kernel variant |
37-| `amd-cpu.sh` | INTEGRATION | all.sh | Conditional AMD P-State setup |
38-| `enable-multilib.sh` | INTEGRATION | all.sh | Enables 32-bit support |
39-| `cachyos-repo.sh` | INTEGRATION | all.sh | Optional CachyOS repo setup |
40-| `pacman.sh` | INTEGRATION | all.sh | Pacman configuration |
41-| `fstab.sh` | INTEGRATION | all.sh | Generates /etc/fstab |
42-
43-**Migration Strategy**: Extract domain logic to `domain/packages/` value objects, wrap script execution in `infrastructure/executor/script_executor.go`
44-
45----
46-
47-### `install/boot/` (Bootloader Installation)
48-**Purpose**: EFI and bootloader setup
49-
50-| Script | Status | Used By | Notes |
51-|--------|--------|---------|-------|
52-| `all.sh` | INTEGRATION | BootloaderHandler | Orchestrates bootloader setup |
53-| `limine.sh` | INTEGRATION | all.sh | Limine bootloader installation |
54-
55-**Migration Strategy**: Extract bootloader configuration to `domain/bootloader/`, create `infrastructure/executor/bootloader_executor.go`
56-
57----
58-
59-### `install/config/` (System Configuration)
60-**Purpose**: Hostname, locale, timezone, users, network
61-
62-| Script | Status | Used By | Notes |
63-|--------|--------|---------|-------|
64-| `all.sh` | INTEGRATION | ConfigurationHandler | Orchestrates system config |
65-| `system.sh` | INTEGRATION | all.sh | Sets hostname, locale, timezone |
66-| `user.sh` | INTEGRATION | all.sh | Creates user, sets passwords |
67-| `network.sh` | INTEGRATION | all.sh | NetworkManager setup |
68-| `zram.sh` | INTEGRATION | all.sh | zRAM swap configuration |
69-
70-**Migration Strategy**: Extract system config to `domain/system/config.go`, user management to `domain/user/`, create infrastructure adapters
71-
72----
73-
74-### `install/configs/` (Configuration Templates)
75-**Purpose**: Template files for system configuration
76-
77-| File | Status | Category | Destination |
78-|------|--------|----------|-------------|
79-| `limine.conf.template` | CONFIG_TEMPLATE | Bootloader | `domain/bootloader/limine_config.go` (embedded) |
80-| `chaotic-aur.conf` | CONFIG_TEMPLATE | Repository | `domain/packages/repository_config.go` (embedded) |
81-| `shell/starship.toml` | CONFIG_TEMPLATE | Shell | `infrastructure/persistence/shell_templates/` |
82-| `shell/shell` | CONFIG_TEMPLATE | Shell | `infrastructure/persistence/shell_templates/` |
83-| `shell/init` | CONFIG_TEMPLATE | Shell | `infrastructure/persistence/shell_templates/` |
84-| `shell/aliases` | CONFIG_TEMPLATE | Shell | `infrastructure/persistence/shell_templates/` |
85-| `shell/envs` | CONFIG_TEMPLATE | Shell | `infrastructure/persistence/shell_templates/` |
86-| `shell/rc` | CONFIG_TEMPLATE | Shell | `infrastructure/persistence/shell_templates/` |
87-| `shell/bashrc` | CONFIG_TEMPLATE | Shell | `infrastructure/persistence/shell_templates/` |
88-
89-**Migration Strategy**: Load templates as embedded resources or at runtime, manage as value objects in domain layer
90-
91----
92-
93-### `install/helpers/` (Helper Utilities)
94-**Purpose**: Utility functions used across scripts
95-
96-| Script | Status | Used By | Purpose |
97-|--------|--------|---------|---------|
98-| `all.sh` | HELPER | Entry point | Loads all helpers |
99-| `logging.sh` | HELPER | All scripts | Logging functions |
100-| `errors.sh` | HELPER | All scripts | Error handling, cleanup |
101-| `config.sh` | HELPER | All scripts | Config file loading |
102-| `chroot.sh` | HELPER | Config, Boot, Repos | Chroot execution wrapper |
103-| `download.sh` | HELPER | Most scripts | HTTP download functions |
104-| `cleanup.sh` | HELPER | Error handling | System cleanup on failure |
105-| `multilib.sh` | HELPER | Config | Multilib detection/setup |
106-| `presentation.sh` | HELPER | All scripts | UI output (colors, formatting) |
107-
108-**Migration Strategy**:
109-- `logging.sh` → `infrastructure/logger/shell_adapter.go` (wraps Go logger)
110-- `errors.sh` → `domain/*/errors.go` (domain error types)
111-- `config.sh` → `infrastructure/persistence/config_loader.go`
112-- `chroot.sh` → `infrastructure/executor/chroot_executor.go`
113-- `download.sh` → `infrastructure/http/client.go`
114-- `cleanup.sh` → `infrastructure/executor/cleanup_executor.go`
115-- `multilib.sh` → `domain/packages/multilib_detector.go`
116-- `presentation.sh` → `interfaces/tui/` (TUI layer)
117-
118----
119-
120-### `install/partitioning/` (Disk Partitioning)
121-**Purpose**: Disk detection, partitioning, formatting, mounting
122-
123-| Script | Status | Used By | Notes |
124-|--------|--------|---------|-------|
125-| `all.sh` | INTEGRATION | PartitioningHandler | Orchestrates partitioning workflow |
126-| `detect-disk.sh` | INTEGRATION | all.sh | Disk detection and validation |
127-| `partition.sh` | INTEGRATION | all.sh | Partition table creation |
128-| `format.sh` | INTEGRATION | all.sh | Filesystem creation (ext4, FAT) |
129-| `mount.sh` | INTEGRATION | all.sh | Mount partition hierarchy |
130-
131-**Migration Strategy**: Extract disk logic to `domain/disk/`, create `infrastructure/executor/partitioning_executor.go`
132-
133----
134-
135-### `install/post-boot/` (Post-Boot Setup)
136-**Status**: ✅ **MANDATORY** - ALL SCRIPTS
137-
138-| Script | Status | Used By | Notes |
139-|--------|--------|---------|-------|
140-| `all.sh` | MANDATORY | Service | Main entry point |
141-| `snapper.sh` | MANDATORY | all.sh | Snapshot configuration |
142-| `ufw.sh` | MANDATORY | all.sh | Firewall setup |
143-| `ssh-keygen.sh` | MANDATORY | all.sh | SSH key generation |
144-| `archup-cli.sh` | MANDATORY | all.sh | CLI tool installation |
145-| `blesh.sh` | MANDATORY | all.sh | BLE shell integration |
146-| `archup-first-boot.service` | MANDATORY | Systemd | First-boot systemd service |
147-
148-**Current References in Go Code**:
149-- `internal/config/config.go`: `PostBootScripts` array and `PostBootServiceTemplate` constant
150-- `internal/postboot/setup.go`: Downloads scripts and enables service
151-
152-**Migration Strategy**:
153-- Create `install/mandatory/post-boot/` directory
154-- Keep scripts unchanged (shell-compatible)
155-- Create wrapper in `infrastructure/executor/postboot_executor.go`
156-- Validate scripts exist before execution
157-- Set environment variables in domain layer
158-
159----
160-
161-### `install/post-install/` (Post-Installation Tasks)
162-**Purpose**: System finalization, themes, hooks, verification
163-
164-| Script | Status | Used By | Notes |
165-|--------|--------|---------|-------|
166-| `all.sh` | INTEGRATION | PostInstallHandler | Orchestrates post-install tasks |
167-| `verify.sh` | INTEGRATION | all.sh | Installation verification |
168-| `unmount.sh` | INTEGRATION | all.sh | Unmount filesystems |
169-| `post-boot-setup.sh` | INTEGRATION | all.sh | Configures post-boot service |
170-| `boot-logo.sh` | INTEGRATION | all.sh | Boot splash image setup |
171-| `plymouth.sh` | INTEGRATION | all.sh | Plymouth theme setup |
172-| `snapper.sh` | INTEGRATION | all.sh | Snapshot initialization |
173-| `shell-config.sh` | INTEGRATION | all.sh | Shell initialization |
174-| `pacman.sh` | INTEGRATION | all.sh | Pacman hooks and config |
175-| `hooks.sh` | INTEGRATION | all.sh | Pacman hook installation |
176-
177-**Migration Strategy**: Extract post-install logic to domain, wrap script execution in handler
178-
179----
180-
181-### `install/preflight/` (Pre-Flight Checks)
182-**Purpose**: System validation before installation
183-
184-| Script | Status | Used By | Notes |
185-|--------|--------|---------|-------|
186-| `all.sh` | INTEGRATION | PreflightHandler | Orchestrates all checks |
187-| `begin.sh` | INTEGRATION | all.sh | Entry point, setup |
188-| `guards.sh` | INTEGRATION | all.sh | Root/UEFI/disk validation |
189-| `detect-environment.sh` | INTEGRATION | all.sh | Environment detection |
190-| `identify.sh` | INTEGRATION | all.sh | System identification (CPU, GPU, etc.) |
191-
192-**Migration Strategy**: Extract validation rules to `domain/installation/`, wrap in PreflightHandler
193-
194----
195-
196-### `install/repos/` (Repository Configuration)
197-**Purpose**: AUR and additional repository setup
198-
199-| Script | Status | Used By | Notes |
200-|--------|--------|---------|-------|
201-| `all.sh` | INTEGRATION | RepositoriesHandler | Orchestrates repo setup |
202-| `multilib.sh` | INTEGRATION | all.sh | Enables multilib repository |
203-| `aur.sh` | INTEGRATION | all.sh | AUR helper installation |
204-| `chaotic.sh` | INTEGRATION | all.sh | Chaotic-AUR setup |
205-
206-**Migration Strategy**: Extract repo config to `domain/packages/repository.go`, wrap in RepositoriesHandler
207-
208----
209-
210-## Script Classification Summary
211-
212-### By Status
213-
214-| Status | Count | Subdirectories | Action |
215-|--------|-------|-----------------|--------|
216-| **MANDATORY** | 7 | post-boot/ | Move to `install/mandatory/` - Keep unchanged |
217-| **INTEGRATION** | 44 | base/, boot/, config/, partitioning/, post-install/, preflight/, repos/ | Wrap with Go handlers |
218-| **HELPER** | 9 | helpers/ | Adapt logic to Go ports/adapters |
219-| **CONFIG_TEMPLATE** | 9+ | configs/ | Embed in Go or manage as resources |
220-| **DEPRECATED** | 0 | - | None identified for immediate removal |
221-
222-### Total Impact
223-- **Total Shell Scripts**: 54 files
224-- **Lines to Preserve**: ~7 MANDATORY scripts
225-- **Lines to Refactor**: ~47 INTEGRATION + HELPER scripts
226-- **Expected Go LOC**: ~3000-4000 across domain, application, infrastructure layers
227-
228----
229-
230-## Implementation Plan
231-
232-### Phase 1.5: Directory Organization
233-
234-1. ✅ Created `docs/script-migration.md` (this file)
235-2. Create `install/mandatory/` directory
236-3. Create `install/deprecated/` directory
237-4. Move post-boot scripts to `install/mandatory/post-boot/`
238-5. Update references in `internal/postboot/setup.go` to use new path
239-6. Commit changes
240-
241-### Phase 2+: Script Wrapping
242-
243-For each domain/phase:
244-1. Create Go domain entities with validation
245-2. Create command + handler in application layer
246-3. Create infrastructure adapter wrapping shell scripts
247-4. Write tests
248-5. Update TUI to use new handler
249-6. Update shell script paths if moved
250-
251----
252-
253-## References
254-
255-- DDD Architecture Plan: `/home/brice/dev/projects/archup/DDD_REFACTORING_PLAN.md`
256-- Current Config: `/home/brice/dev/projects/archup/internal/config/config.go`
257-- Post-Boot Setup: `/home/brice/dev/projects/archup/internal/postboot/setup.go`
258-- Original Project: `/home/brice/dev/clone/omarchy` (for reference)
259-
260----
261-
262-## Notes
263-
264-- All INTEGRATION scripts will be wrapped by Go handlers - no direct execution from Go code
265-- MANDATORY scripts remain unchanged to maintain compatibility with first-boot service
266-- HELPER scripts are utility functions - their logic will be adapted to Go but scripts can be deprecated
267-- CONFIG_TEMPLATE files will be embedded or loaded from `infrastructure/` layer
268-- No breaking changes to post-boot service execution
269-- Shell script config format must remain compatible (backward compatibility)
270-
271----
272-
273-**Status**: ✅ Phase 1 Audit Complete
274-**Next Step**: Create directory structure and move mandatory scripts
@@ -1,274 +0,0 @@
1-# Shell Scripts Audit and Migration Plan
2-
3-**Audit Date:** October 31, 2025
4-**Phase:** 1 - Script Categorization for DDD Refactoring
5-**Total Scripts Found:** 54 files (50 .sh scripts, 1 .service file)
6-
7-## Summary
8-
9-This document categorizes all shell scripts in the `install/` directory for the transition from phase-based shell scripting to Domain-Driven Design (DDD) Go application.
10-
11-### Categories
12-
13-- **MANDATORY**: Scripts actively referenced in Go code - must be preserved and executed
14-- **INTEGRATION**: Scripts used by installation phases - will be wrapped by handlers
15-- **HELPER**: Utility scripts providing infrastructure functions - will be adapted to ports
16-- **CONFIG_TEMPLATE**: Configuration file templates - will be migrated to domain objects
17-- **DEPRECATED**: Legacy scripts for removal after migration
18-
19----
20-
21-## Directory-by-Directory Analysis
22-
23-### `install/bootstrap.sh` (Root Level)
24-- **Status**: MANDATORY
25-- **Purpose**: Main entry point for installation
26-- **Used By**: CLI entry point
27-- **Notes**: Will become dependency injection container
28-
29-### `install/base/` (Base System Installation)
30-**Purpose**: Core Arch Linux system installation via pacstrap
31-
32-| Script | Status | Used By | Notes |
33-|--------|--------|---------|-------|
34-| `all.sh` | INTEGRATION | BaseInstallationHandler | Orchestrates base installation |
35-| `pacstrap.sh` | INTEGRATION | all.sh | Runs pacstrap with package list |
36-| `kernel.sh` | INTEGRATION | all.sh | Selects and installs kernel variant |
37-| `amd-cpu.sh` | INTEGRATION | all.sh | Conditional AMD P-State setup |
38-| `enable-multilib.sh` | INTEGRATION | all.sh | Enables 32-bit support |
39-| `cachyos-repo.sh` | INTEGRATION | all.sh | Optional CachyOS repo setup |
40-| `pacman.sh` | INTEGRATION | all.sh | Pacman configuration |
41-| `fstab.sh` | INTEGRATION | all.sh | Generates /etc/fstab |
42-
43-**Migration Strategy**: Extract domain logic to `domain/packages/` value objects, wrap script execution in `infrastructure/executor/script_executor.go`
44-
45----
46-
47-### `install/boot/` (Bootloader Installation)
48-**Purpose**: EFI and bootloader setup
49-
50-| Script | Status | Used By | Notes |
51-|--------|--------|---------|-------|
52-| `all.sh` | INTEGRATION | BootloaderHandler | Orchestrates bootloader setup |
53-| `limine.sh` | INTEGRATION | all.sh | Limine bootloader installation |
54-
55-**Migration Strategy**: Extract bootloader configuration to `domain/bootloader/`, create `infrastructure/executor/bootloader_executor.go`
56-
57----
58-
59-### `install/config/` (System Configuration)
60-**Purpose**: Hostname, locale, timezone, users, network
61-
62-| Script | Status | Used By | Notes |
63-|--------|--------|---------|-------|
64-| `all.sh` | INTEGRATION | ConfigurationHandler | Orchestrates system config |
65-| `system.sh` | INTEGRATION | all.sh | Sets hostname, locale, timezone |
66-| `user.sh` | INTEGRATION | all.sh | Creates user, sets passwords |
67-| `network.sh` | INTEGRATION | all.sh | NetworkManager setup |
68-| `zram.sh` | INTEGRATION | all.sh | zRAM swap configuration |
69-
70-**Migration Strategy**: Extract system config to `domain/system/config.go`, user management to `domain/user/`, create infrastructure adapters
71-
72----
73-
74-### `install/configs/` (Configuration Templates)
75-**Purpose**: Template files for system configuration
76-
77-| File | Status | Category | Destination |
78-|------|--------|----------|-------------|
79-| `limine.conf.template` | CONFIG_TEMPLATE | Bootloader | `domain/bootloader/limine_config.go` (embedded) |
80-| `chaotic-aur.conf` | CONFIG_TEMPLATE | Repository | `domain/packages/repository_config.go` (embedded) |
81-| `shell/starship.toml` | CONFIG_TEMPLATE | Shell | `infrastructure/persistence/shell_templates/` |
82-| `shell/shell` | CONFIG_TEMPLATE | Shell | `infrastructure/persistence/shell_templates/` |
83-| `shell/init` | CONFIG_TEMPLATE | Shell | `infrastructure/persistence/shell_templates/` |
84-| `shell/aliases` | CONFIG_TEMPLATE | Shell | `infrastructure/persistence/shell_templates/` |
85-| `shell/envs` | CONFIG_TEMPLATE | Shell | `infrastructure/persistence/shell_templates/` |
86-| `shell/rc` | CONFIG_TEMPLATE | Shell | `infrastructure/persistence/shell_templates/` |
87-| `shell/bashrc` | CONFIG_TEMPLATE | Shell | `infrastructure/persistence/shell_templates/` |
88-
89-**Migration Strategy**: Load templates as embedded resources or at runtime, manage as value objects in domain layer
90-
91----
92-
93-### `install/helpers/` (Helper Utilities)
94-**Purpose**: Utility functions used across scripts
95-
96-| Script | Status | Used By | Purpose |
97-|--------|--------|---------|---------|
98-| `all.sh` | HELPER | Entry point | Loads all helpers |
99-| `logging.sh` | HELPER | All scripts | Logging functions |
100-| `errors.sh` | HELPER | All scripts | Error handling, cleanup |
101-| `config.sh` | HELPER | All scripts | Config file loading |
102-| `chroot.sh` | HELPER | Config, Boot, Repos | Chroot execution wrapper |
103-| `download.sh` | HELPER | Most scripts | HTTP download functions |
104-| `cleanup.sh` | HELPER | Error handling | System cleanup on failure |
105-| `multilib.sh` | HELPER | Config | Multilib detection/setup |
106-| `presentation.sh` | HELPER | All scripts | UI output (colors, formatting) |
107-
108-**Migration Strategy**:
109-- `logging.sh` → `infrastructure/logger/shell_adapter.go` (wraps Go logger)
110-- `errors.sh` → `domain/*/errors.go` (domain error types)
111-- `config.sh` → `infrastructure/persistence/config_loader.go`
112-- `chroot.sh` → `infrastructure/executor/chroot_executor.go`
113-- `download.sh` → `infrastructure/http/client.go`
114-- `cleanup.sh` → `infrastructure/executor/cleanup_executor.go`
115-- `multilib.sh` → `domain/packages/multilib_detector.go`
116-- `presentation.sh` → `interfaces/tui/` (TUI layer)
117-
118----
119-
120-### `install/partitioning/` (Disk Partitioning)
121-**Purpose**: Disk detection, partitioning, formatting, mounting
122-
123-| Script | Status | Used By | Notes |
124-|--------|--------|---------|-------|
125-| `all.sh` | INTEGRATION | PartitioningHandler | Orchestrates partitioning workflow |
126-| `detect-disk.sh` | INTEGRATION | all.sh | Disk detection and validation |
127-| `partition.sh` | INTEGRATION | all.sh | Partition table creation |
128-| `format.sh` | INTEGRATION | all.sh | Filesystem creation (ext4, FAT) |
129-| `mount.sh` | INTEGRATION | all.sh | Mount partition hierarchy |
130-
131-**Migration Strategy**: Extract disk logic to `domain/disk/`, create `infrastructure/executor/partitioning_executor.go`
132-
133----
134-
135-### `install/post-boot/` (Post-Boot Setup)
136-**Status**: ✅ **MANDATORY** - ALL SCRIPTS
137-
138-| Script | Status | Used By | Notes |
139-|--------|--------|---------|-------|
140-| `all.sh` | MANDATORY | Service | Main entry point |
141-| `snapper.sh` | MANDATORY | all.sh | Snapshot configuration |
142-| `ufw.sh` | MANDATORY | all.sh | Firewall setup |
143-| `ssh-keygen.sh` | MANDATORY | all.sh | SSH key generation |
144-| `archup-cli.sh` | MANDATORY | all.sh | CLI tool installation |
145-| `blesh.sh` | MANDATORY | all.sh | BLE shell integration |
146-| `archup-first-boot.service` | MANDATORY | Systemd | First-boot systemd service |
147-
148-**Current References in Go Code**:
149-- `internal/config/config.go`: `PostBootScripts` array and `PostBootServiceTemplate` constant
150-- `internal/postboot/setup.go`: Downloads scripts and enables service
151-
152-**Migration Strategy**:
153-- Create `install/mandatory/post-boot/` directory
154-- Keep scripts unchanged (shell-compatible)
155-- Create wrapper in `infrastructure/executor/postboot_executor.go`
156-- Validate scripts exist before execution
157-- Set environment variables in domain layer
158-
159----
160-
161-### `install/post-install/` (Post-Installation Tasks)
162-**Purpose**: System finalization, themes, hooks, verification
163-
164-| Script | Status | Used By | Notes |
165-|--------|--------|---------|-------|
166-| `all.sh` | INTEGRATION | PostInstallHandler | Orchestrates post-install tasks |
167-| `verify.sh` | INTEGRATION | all.sh | Installation verification |
168-| `unmount.sh` | INTEGRATION | all.sh | Unmount filesystems |
169-| `post-boot-setup.sh` | INTEGRATION | all.sh | Configures post-boot service |
170-| `boot-logo.sh` | INTEGRATION | all.sh | Boot splash image setup |
171-| `plymouth.sh` | INTEGRATION | all.sh | Plymouth theme setup |
172-| `snapper.sh` | INTEGRATION | all.sh | Snapshot initialization |
173-| `shell-config.sh` | INTEGRATION | all.sh | Shell initialization |
174-| `pacman.sh` | INTEGRATION | all.sh | Pacman hooks and config |
175-| `hooks.sh` | INTEGRATION | all.sh | Pacman hook installation |
176-
177-**Migration Strategy**: Extract post-install logic to domain, wrap script execution in handler
178-
179----
180-
181-### `install/preflight/` (Pre-Flight Checks)
182-**Purpose**: System validation before installation
183-
184-| Script | Status | Used By | Notes |
185-|--------|--------|---------|-------|
186-| `all.sh` | INTEGRATION | PreflightHandler | Orchestrates all checks |
187-| `begin.sh` | INTEGRATION | all.sh | Entry point, setup |
188-| `guards.sh` | INTEGRATION | all.sh | Root/UEFI/disk validation |
189-| `detect-environment.sh` | INTEGRATION | all.sh | Environment detection |
190-| `identify.sh` | INTEGRATION | all.sh | System identification (CPU, GPU, etc.) |
191-
192-**Migration Strategy**: Extract validation rules to `domain/installation/`, wrap in PreflightHandler
193-
194----
195-
196-### `install/repos/` (Repository Configuration)
197-**Purpose**: AUR and additional repository setup
198-
199-| Script | Status | Used By | Notes |
200-|--------|--------|---------|-------|
201-| `all.sh` | INTEGRATION | RepositoriesHandler | Orchestrates repo setup |
202-| `multilib.sh` | INTEGRATION | all.sh | Enables multilib repository |
203-| `aur.sh` | INTEGRATION | all.sh | AUR helper installation |
204-| `chaotic.sh` | INTEGRATION | all.sh | Chaotic-AUR setup |
205-
206-**Migration Strategy**: Extract repo config to `domain/packages/repository.go`, wrap in RepositoriesHandler
207-
208----
209-
210-## Script Classification Summary
211-
212-### By Status
213-
214-| Status | Count | Subdirectories | Action |
215-|--------|-------|-----------------|--------|
216-| **MANDATORY** | 7 | post-boot/ | Move to `install/mandatory/` - Keep unchanged |
217-| **INTEGRATION** | 44 | base/, boot/, config/, partitioning/, post-install/, preflight/, repos/ | Wrap with Go handlers |
218-| **HELPER** | 9 | helpers/ | Adapt logic to Go ports/adapters |
219-| **CONFIG_TEMPLATE** | 9+ | configs/ | Embed in Go or manage as resources |
220-| **DEPRECATED** | 0 | - | None identified for immediate removal |
221-
222-### Total Impact
223-- **Total Shell Scripts**: 54 files
224-- **Lines to Preserve**: ~7 MANDATORY scripts
225-- **Lines to Refactor**: ~47 INTEGRATION + HELPER scripts
226-- **Expected Go LOC**: ~3000-4000 across domain, application, infrastructure layers
227-
228----
229-
230-## Implementation Plan
231-
232-### Phase 1.5: Directory Organization
233-
234-1. ✅ Created `docs/script-migration.md` (this file)
235-2. Create `install/mandatory/` directory
236-3. Create `install/deprecated/` directory
237-4. Move post-boot scripts to `install/mandatory/post-boot/`
238-5. Update references in `internal/postboot/setup.go` to use new path
239-6. Commit changes
240-
241-### Phase 2+: Script Wrapping
242-
243-For each domain/phase:
244-1. Create Go domain entities with validation
245-2. Create command + handler in application layer
246-3. Create infrastructure adapter wrapping shell scripts
247-4. Write tests
248-5. Update TUI to use new handler
249-6. Update shell script paths if moved
250-
251----
252-
253-## References
254-
255-- DDD Architecture Plan: `/home/brice/dev/projects/archup/DDD_REFACTORING_PLAN.md`
256-- Current Config: `/home/brice/dev/projects/archup/internal/config/config.go`
257-- Post-Boot Setup: `/home/brice/dev/projects/archup/internal/postboot/setup.go`
258-- Original Project: `/home/brice/dev/clone/omarchy` (for reference)
259-
260----
261-
262-## Notes
263-
264-- All INTEGRATION scripts will be wrapped by Go handlers - no direct execution from Go code
265-- MANDATORY scripts remain unchanged to maintain compatibility with first-boot service
266-- HELPER scripts are utility functions - their logic will be adapted to Go but scripts can be deprecated
267-- CONFIG_TEMPLATE files will be embedded or loaded from `infrastructure/` layer
268-- No breaking changes to post-boot service execution
269-- Shell script config format must remain compatible (backward compatibility)
270-
271----
272-
273-**Status**: ✅ Phase 1 Audit Complete
274-**Next Step**: Create directory structure and move mandatory scripts

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 0

    ↑↓ moveenter openesc close