v0.1 bf7c821

data-model.md RawHistoryFolder

Data Model: Project Initialization

Date: 2025-01-09
Context: Data structures for dumber project initialization

Core Entities

1. Go Module Configuration

Purpose: Represents the initialized Go module and its metadata

Structure:

type ModuleConfig struct {
    Name         string `validate:"required"`           // "dumber"
    Version      string `validate:"required,semver"`    // "v0.1.0"
    GoVersion    string `validate:"required"`           // Go version requirement
    Dependencies []Dependency `validate:"dive"`
}

type Dependency struct {
    ImportPath string `validate:"required,uri"`        // e.g. "github.com/spf13/cobra"
    Version    string `validate:"required"`            // "@latest" or specific version
    Type       DependencyType `validate:"required"`    // runtime, dev, tool
}

type DependencyType int
const (
    RuntimeDep DependencyType = iota  // Core application dependencies
    DevDep                           // Development/testing tools  
    ToolDep                          // CLI tools (sqlc, wails)
)

Validation Rules:

  • Module name must be valid Go identifier
  • Version must follow semantic versioning
  • All dependency paths must be valid import paths
  • No circular dependencies allowed

2. Project Structure

Purpose: Defines the directory layout and file organization

Structure:

type ProjectStructure struct {
    RootPath     string `validate:"required,dir"`
    Directories  []Directory `validate:"dive"`
    ConfigFiles  []ConfigFile `validate:"dive"`
    InitialFiles []InitialFile `validate:"dive"`
}

type Directory struct {
    Path        string `validate:"required"`           // relative to root
    Purpose     string `validate:"required"`           // description
    Required    bool                                   // must be created
}

type ConfigFile struct {
    Path        string `validate:"required"`           // relative to root
    Template    string `validate:"required"`           // template name
    Variables   map[string]string                      // template variables
}

type InitialFile struct {
    Path     string `validate:"required"`              // relative to root
    Content  string                                    // file content
    Type     FileType `validate:"required"`           // go, sql, yaml, etc.
}

3. Dependency Installation Status

Purpose: Tracks installation progress and success/failure states

Structure:

type InstallationStatus struct {
    ModuleName   string `validate:"required"`
    Dependencies []DependencyStatus `validate:"dive"`
    Tools        []ToolStatus `validate:"dive"`
    Overall      StatusType `validate:"required"`
    Timestamp    time.Time `validate:"required"`
    Errors       []InstallError
}

type DependencyStatus struct {
    ImportPath   string `validate:"required"`
    Version      string
    Status       StatusType `validate:"required"`
    InstallTime  time.Duration                        // how long to install
    Error        *InstallError
}

type ToolStatus struct {
    Name         string `validate:"required"`          // "sqlc", "wails"
    Command      string `validate:"required"`          // installation command
    Status       StatusType `validate:"required"`
    Version      string                                // installed version
    Error        *InstallError
}

type StatusType int
const (
    NotStarted StatusType = iota
    InProgress
    Success
    Failed
    Skipped
)

type InstallError struct {
    Message     string `validate:"required"`
    Code        int
    Suggestion  string                                 // helpful hint for user
}

State Transitions

Module Initialization Flow

Empty Directory → Module Init → Dependency Resolution → Tool Installation → Verification → Complete
                     ↓              ↓                      ↓                ↓
                  [go.mod]      [go.mod updated]      [tools available]  [build succeeds]

Dependency Installation States

NotStarted → InProgress → Success
             ↓
             Failed (with retry option)

Relationships

  1. ModuleConfig contains multiple Dependencies
  2. ProjectStructure defines where ConfigFiles are placed
  3. InstallationStatus tracks the progress of ModuleConfig setup
  4. Each Directory in ProjectStructure serves specific Dependencies

Validation Constraints

Business Rules

  1. Module name uniqueness: No conflicts with existing Go modules in workspace
  2. Dependency compatibility: All dependencies must support the same Go version
  3. Tool availability: Required tools (sqlc, wails) must be installable
  4. Directory permissions: All target directories must be writable
  5. Disk space: Adequate space for dependencies and generated files

Technical Constraints

  1. Go version: Must support generics (Go 1.18+)
  2. CGO requirement: SQLite driver requires CGO_ENABLED=1
  3. System dependencies: Wails requires WebKit2GTK development headers
  4. Network access: Dependency download requires internet connectivity

Integration Points

With CLI Commands

  • dumber init → Creates ModuleConfig and ProjectStructure
  • dumber deps install → Updates InstallationStatus
  • dumber deps verify → Validates all Dependencies

With Configuration Files

  • go.mod: Generated from ModuleConfig
  • sqlc.yaml: Generated from database Dependencies
  • wails.json: Generated from Wails Dependencies

With Testing Framework

  • Integration tests validate each StatusType transition
  • Contract tests verify ConfigFile template generation
  • Unit tests cover Dependency validation logic

This data model supports the initialization phase while preparing for the next development phases (CLI implementation, database setup, browser integration).

source
1# Data Model: Project Initialization
2
3**Date**: 2025-01-09  
4**Context**: Data structures for dumber project initialization
5
6## Core Entities
7
8### 1. Go Module Configuration
9**Purpose**: Represents the initialized Go module and its metadata
10
11**Structure**:
12```go
13type ModuleConfig struct {
14    Name         string `validate:"required"`           // "dumber"
15    Version      string `validate:"required,semver"`    // "v0.1.0"
16    GoVersion    string `validate:"required"`           // Go version requirement
17    Dependencies []Dependency `validate:"dive"`
18}
19
20type Dependency struct {
21    ImportPath string `validate:"required,uri"`        // e.g. "github.com/spf13/cobra"
22    Version    string `validate:"required"`            // "@latest" or specific version
23    Type       DependencyType `validate:"required"`    // runtime, dev, tool
24}
25
26type DependencyType int
27const (
28    RuntimeDep DependencyType = iota  // Core application dependencies
29    DevDep                           // Development/testing tools  
30    ToolDep                          // CLI tools (sqlc, wails)
31)
32```
33
34**Validation Rules**:
35- Module name must be valid Go identifier
36- Version must follow semantic versioning
37- All dependency paths must be valid import paths
38- No circular dependencies allowed
39
40### 2. Project Structure
41**Purpose**: Defines the directory layout and file organization
42
43**Structure**:
44```go
45type ProjectStructure struct {
46    RootPath     string `validate:"required,dir"`
47    Directories  []Directory `validate:"dive"`
48    ConfigFiles  []ConfigFile `validate:"dive"`
49    InitialFiles []InitialFile `validate:"dive"`
50}
51
52type Directory struct {
53    Path        string `validate:"required"`           // relative to root
54    Purpose     string `validate:"required"`           // description
55    Required    bool                                   // must be created
56}
57
58type ConfigFile struct {
59    Path        string `validate:"required"`           // relative to root
60    Template    string `validate:"required"`           // template name
61    Variables   map[string]string                      // template variables
62}
63
64type InitialFile struct {
65    Path     string `validate:"required"`              // relative to root
66    Content  string                                    // file content
67    Type     FileType `validate:"required"`           // go, sql, yaml, etc.
68}
69```
70
71### 3. Dependency Installation Status
72**Purpose**: Tracks installation progress and success/failure states
73
74**Structure**:
75```go
76type InstallationStatus struct {
77    ModuleName   string `validate:"required"`
78    Dependencies []DependencyStatus `validate:"dive"`
79    Tools        []ToolStatus `validate:"dive"`
80    Overall      StatusType `validate:"required"`
81    Timestamp    time.Time `validate:"required"`
82    Errors       []InstallError
83}
84
85type DependencyStatus struct {
86    ImportPath   string `validate:"required"`
87    Version      string
88    Status       StatusType `validate:"required"`
89    InstallTime  time.Duration                        // how long to install
90    Error        *InstallError
91}
92
93type ToolStatus struct {
94    Name         string `validate:"required"`          // "sqlc", "wails"
95    Command      string `validate:"required"`          // installation command
96    Status       StatusType `validate:"required"`
97    Version      string                                // installed version
98    Error        *InstallError
99}
100
101type StatusType int
102const (
103    NotStarted StatusType = iota
104    InProgress
105    Success
106    Failed
107    Skipped
108)
109
110type InstallError struct {
111    Message     string `validate:"required"`
112    Code        int
113    Suggestion  string                                 // helpful hint for user
114}
115```
116
117## State Transitions
118
119### Module Initialization Flow
120```
121Empty Directory → Module Init → Dependency Resolution → Tool Installation → Verification → Complete
122                     ↓              ↓                      ↓                ↓
123                  [go.mod]      [go.mod updated]      [tools available]  [build succeeds]
124```
125
126### Dependency Installation States
127```
128NotStarted → InProgress → Success
129             ↓
130             Failed (with retry option)
131```
132
133## Relationships
134
1351. **ModuleConfig** contains multiple **Dependencies**
1362. **ProjectStructure** defines where **ConfigFiles** are placed
1373. **InstallationStatus** tracks the progress of **ModuleConfig** setup
1384. Each **Directory** in **ProjectStructure** serves specific **Dependencies**
139
140## Validation Constraints
141
142### Business Rules
1431. **Module name uniqueness**: No conflicts with existing Go modules in workspace
1442. **Dependency compatibility**: All dependencies must support the same Go version
1453. **Tool availability**: Required tools (sqlc, wails) must be installable
1464. **Directory permissions**: All target directories must be writable
1475. **Disk space**: Adequate space for dependencies and generated files
148
149### Technical Constraints
1501. **Go version**: Must support generics (Go 1.18+)
1512. **CGO requirement**: SQLite driver requires CGO_ENABLED=1
1523. **System dependencies**: Wails requires WebKit2GTK development headers
1534. **Network access**: Dependency download requires internet connectivity
154
155## Integration Points
156
157### With CLI Commands
158- `dumber init` → Creates **ModuleConfig** and **ProjectStructure**
159- `dumber deps install` → Updates **InstallationStatus**
160- `dumber deps verify` → Validates all **Dependencies**
161
162### With Configuration Files
163- **go.mod**: Generated from **ModuleConfig**
164- **sqlc.yaml**: Generated from database **Dependencies**
165- **wails.json**: Generated from Wails **Dependencies**
166
167### With Testing Framework
168- Integration tests validate each **StatusType** transition
169- Contract tests verify **ConfigFile** template generation
170- Unit tests cover **Dependency** validation logic
171
172This data model supports the initialization phase while preparing for the next development phases (CLI implementation, database setup, browser integration).

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 8

Tags 42

↑↓ moveenter openesc close