v0.2.0 759cc92

research.md RawHistoryFolder

Research: Project Initialization Dependencies

Date: 2025-01-09
Context: Resolve technical unknowns for dumber project initialization

Research Questions Resolved

1. Go Module Initialization

Decision: Use go mod init dumber Rationale:

  • Simple module name matching the binary name
  • Local development focus (no public import path needed)
  • Follows Go module naming conventions

Alternatives considered:

  • github.com/user/dumber - rejected (unnecessary complexity for local tool)
  • dumber/v1 - rejected (premature versioning)

2. Wails v3-Alpha Compatibility

Decision: Use Wails v3.0.0-alpha.28 (latest available) Rationale:

  • Constitution specifically requires v3-alpha
  • Alpha version provides newest WebKit2GTK integration
  • Active development branch with Wayland improvements
  • Breaking changes acceptable for new project

Alternatives considered:

  • Wails v2 stable - rejected (constitution mandates v3-alpha)
  • Wait for v3 stable - rejected (delays development unnecessarily)

Integration approach:

go install github.com/wailsapp/wails/v3/cmd/wails@v3.0.0-alpha.28

3. CLI Framework Selection

Decision: Cobra v1.8+ with Viper v1.18+ Rationale:

  • Constitution requirement: "Cobra + Viper for configuration"
  • Mature, stable libraries with excellent Go ecosystem integration
  • Perfect for dmenu/rofi integration via stdin/stdout
  • Built-in flag parsing and configuration management

Key packages:

  • github.com/spf13/cobra@latest
  • github.com/spf13/viper@latest

4. Database Stack

Decision: SQLite with ncruces/go-sqlite3 (CGO-free) + SQLC v1.25+ Rationale:

  • Constitution requirement: "SQLite + SQLC for type-safe SQL"
  • github.com/ncruces/go-sqlite3 is CGO-free (better performance, fewer build issues)
  • Only Wails needs CGO, not database layer - cleaner separation
  • SQLC generates type-safe Go code from SQL schemas
  • Perfect for local history storage

Key packages:

  • github.com/ncruces/go-sqlite3@latest (CGO-free SQLite driver)
  • Install SQLC CLI tool: go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest

Alternatives considered:

  • github.com/mattn/go-sqlite3 - rejected (requires CGO unnecessarily)
  • Pure Go implementations - rejected (ncruces is the modern standard)

5. Input Validation

Decision: go-playground/validator v10.16+ Rationale:

  • Constitution requirement
  • Industry standard for Go struct validation
  • URL validation capabilities for browser input
  • Tag-based validation (clean code)

Key package:

  • github.com/go-playground/validator/v10@latest

6. Testing Framework

Decision: Standard Go testing + testify v1.8+ Rationale:

  • Standard library first approach (constitution: simplicity)
  • testify for better assertions and test organization
  • No need for heavyweight testing frameworks

Key package:

  • github.com/stretchr/testify@latest

7. Project Directory Structure

Decision: Follow constitution implementation order

/
├── cmd/                 # CLI entry point
├── internal/
│   ├── cli/            # Cobra commands
│   ├── db/             # SQLC generated code + migrations
│   ├── parser/         # URL parsing logic
│   └── browser/        # Wails integration
├── migrations/         # SQL schema files
├── configs/           # Configuration files (SQLC, Wails)
└── tests/             # Integration tests

Rationale:

  • internal/ prevents external imports (Go convention)
  • Matches constitution implementation order
  • Separates concerns clearly
  • Easy to test individual components

8. Build Configuration

Decision: Standard Go build with Wails embedding Rationale:

  • Single binary requirement from constitution
  • Wails handles frontend asset embedding
  • Standard go build for CLI-only functionality

Dependency Installation Order

Based on research, the installation sequence should be:

  1. Initialize Go module

    go mod init dumber
    
  2. Install CLI dependencies

    go get github.com/spf13/cobra@latest
    go get github.com/spf13/viper@latest
    
  3. Install database dependencies

    go get github.com/ncruces/go-sqlite3@latest
    go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
    
  4. Install validation

    go get github.com/go-playground/validator/v10@latest
    
  5. Install testing tools

    go get github.com/stretchr/testify@latest
    
  6. Install Wails (last - most complex)

    go install github.com/wailsapp/wails/v3/cmd/wails@v3.0.0-alpha.28
    # Wails will handle its own module dependencies during init
    

Risk Assessment

Low Risk:

  • Standard Go dependencies (Cobra, Viper, SQLite)
  • Well-established patterns

Medium Risk:

  • Wails v3-alpha stability (alpha software)
  • WebKit2GTK system dependency availability
  • CGO requirement for Wails (but not for database layer)

Mitigation:

  • Test Wails installation immediately after dependency setup
  • Verify WebKit2GTK availability in integration tests
  • Document CGO requirement clearly (only for final Wails build)
  • Database layer can be developed/tested CGO-free independently

Next Phase Requirements

All technical unknowns resolved. Phase 1 can proceed with:

  • Data model design (SQLite schema)
  • Contract definitions (CLI commands)
  • Integration test scenarios
  • Configuration file generation

Status: ✅ Complete - All NEEDS CLARIFICATION items resolved

source
1# Research: Project Initialization Dependencies
2
3**Date**: 2025-01-09  
4**Context**: Resolve technical unknowns for dumber project initialization
5
6## Research Questions Resolved
7
8### 1. Go Module Initialization
9**Decision**: Use `go mod init dumber`
10**Rationale**: 
11- Simple module name matching the binary name
12- Local development focus (no public import path needed)
13- Follows Go module naming conventions
14
15**Alternatives considered**: 
16- `github.com/user/dumber` - rejected (unnecessary complexity for local tool)
17- `dumber/v1` - rejected (premature versioning)
18
19### 2. Wails v3-Alpha Compatibility
20**Decision**: Use Wails v3.0.0-alpha.28 (latest available)
21**Rationale**:
22- Constitution specifically requires v3-alpha
23- Alpha version provides newest WebKit2GTK integration
24- Active development branch with Wayland improvements
25- Breaking changes acceptable for new project
26
27**Alternatives considered**:
28- Wails v2 stable - rejected (constitution mandates v3-alpha)
29- Wait for v3 stable - rejected (delays development unnecessarily)
30
31**Integration approach**:
32```bash
33go install github.com/wailsapp/wails/v3/cmd/wails@v3.0.0-alpha.28
34```
35
36### 3. CLI Framework Selection
37**Decision**: Cobra v1.8+ with Viper v1.18+
38**Rationale**:
39- Constitution requirement: "Cobra + Viper for configuration"
40- Mature, stable libraries with excellent Go ecosystem integration
41- Perfect for dmenu/rofi integration via stdin/stdout
42- Built-in flag parsing and configuration management
43
44**Key packages**:
45- `github.com/spf13/cobra@latest`
46- `github.com/spf13/viper@latest`
47
48### 4. Database Stack
49**Decision**: SQLite with ncruces/go-sqlite3 (CGO-free) + SQLC v1.25+
50**Rationale**:
51- Constitution requirement: "SQLite + SQLC for type-safe SQL"
52- `github.com/ncruces/go-sqlite3` is CGO-free (better performance, fewer build issues)
53- Only Wails needs CGO, not database layer - cleaner separation
54- SQLC generates type-safe Go code from SQL schemas
55- Perfect for local history storage
56
57**Key packages**:
58- `github.com/ncruces/go-sqlite3@latest` (CGO-free SQLite driver)
59- Install SQLC CLI tool: `go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest`
60
61**Alternatives considered**:
62- `github.com/mattn/go-sqlite3` - rejected (requires CGO unnecessarily)
63- Pure Go implementations - rejected (ncruces is the modern standard)
64
65### 5. Input Validation
66**Decision**: go-playground/validator v10.16+
67**Rationale**:
68- Constitution requirement
69- Industry standard for Go struct validation
70- URL validation capabilities for browser input
71- Tag-based validation (clean code)
72
73**Key package**:
74- `github.com/go-playground/validator/v10@latest`
75
76### 6. Testing Framework
77**Decision**: Standard Go testing + testify v1.8+
78**Rationale**:
79- Standard library first approach (constitution: simplicity)
80- testify for better assertions and test organization
81- No need for heavyweight testing frameworks
82
83**Key package**:
84- `github.com/stretchr/testify@latest`
85
86### 7. Project Directory Structure
87**Decision**: Follow constitution implementation order
88```
89/
90├── cmd/                 # CLI entry point
91├── internal/
92│   ├── cli/            # Cobra commands
93│   ├── db/             # SQLC generated code + migrations
94│   ├── parser/         # URL parsing logic
95│   └── browser/        # Wails integration
96├── migrations/         # SQL schema files
97├── configs/           # Configuration files (SQLC, Wails)
98└── tests/             # Integration tests
99```
100
101**Rationale**:
102- `internal/` prevents external imports (Go convention)
103- Matches constitution implementation order
104- Separates concerns clearly
105- Easy to test individual components
106
107### 8. Build Configuration
108**Decision**: Standard Go build with Wails embedding
109**Rationale**:
110- Single binary requirement from constitution
111- Wails handles frontend asset embedding
112- Standard go build for CLI-only functionality
113
114## Dependency Installation Order
115
116Based on research, the installation sequence should be:
117
1181. **Initialize Go module**
119   ```bash
120   go mod init dumber
121   ```
122
1232. **Install CLI dependencies**
124   ```bash
125   go get github.com/spf13/cobra@latest
126   go get github.com/spf13/viper@latest
127   ```
128
1293. **Install database dependencies**
130   ```bash
131   go get github.com/ncruces/go-sqlite3@latest
132   go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
133   ```
134
1354. **Install validation**
136   ```bash
137   go get github.com/go-playground/validator/v10@latest
138   ```
139
1405. **Install testing tools**
141   ```bash
142   go get github.com/stretchr/testify@latest
143   ```
144
1456. **Install Wails (last - most complex)**
146   ```bash
147   go install github.com/wailsapp/wails/v3/cmd/wails@v3.0.0-alpha.28
148   # Wails will handle its own module dependencies during init
149   ```
150
151## Risk Assessment
152
153**Low Risk**:
154- Standard Go dependencies (Cobra, Viper, SQLite)
155- Well-established patterns
156
157**Medium Risk**:
158- Wails v3-alpha stability (alpha software)
159- WebKit2GTK system dependency availability
160- CGO requirement for Wails (but not for database layer)
161
162**Mitigation**:
163- Test Wails installation immediately after dependency setup
164- Verify WebKit2GTK availability in integration tests
165- Document CGO requirement clearly (only for final Wails build)
166- Database layer can be developed/tested CGO-free independently
167
168## Next Phase Requirements
169
170All technical unknowns resolved. Phase 1 can proceed with:
171- Data model design (SQLite schema)
172- Contract definitions (CLI commands)
173- Integration test scenarios
174- Configuration file generation
175
176**Status**: ✅ Complete - All NEEDS CLARIFICATION items resolved

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