Skip to content

Commit 74da60a

Browse files
committed
build: setup ldflags & switch to Taskfile from justfile
1 parent 8681137 commit 74da60a

File tree

19 files changed

+2840
-137
lines changed

19 files changed

+2840
-137
lines changed

README.md

Lines changed: 9 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,19 @@
66
[![Go Version](https://img.shields.io/github/go-mod/go-version/stormlightlabs/noteleaf)](go.mod)
77

88
Noteleaf is a unified personal productivity CLI that combines task management, note-taking, and media tracking in one place.
9-
It provides TaskWarrior-inspired task management with additional support for notes, articles, books, movies, and TV shows - all built with Golang & Charm.sh libs. Inspired by TaskWarrior & todo.txt CLI applications.
9+
It provides TaskWarrior-inspired task management with additional support for notes, articles, books, movies, and TV shows, all built with Golang & Charm.sh libs.
10+
Inspired by TaskWarrior & todo.txt CLI applications.
1011

1112
## Why?
1213

13-
- **Fragmented productivity tools**: Instead of juggling multiple apps for tasks, notes, reading lists, and media queues, Noteleaf provides a single CLI interface
14-
- **Terminal-native workflow**: For developers and power users who prefer staying in the terminal, Noteleaf offers rich TUIs without leaving your command line
15-
- **Lightweight and fast**: No desktop apps or web interfaces - just a fast, focused CLI tool
14+
- **Fragmented Ecosystem**: Instead of juggling multiple apps for tasks, notes, reading lists, and media queues, Noteleaf provides a single CLI interface
15+
- **Terminal-native**: For developers and power users who prefer staying in the terminal, Noteleaf offers rich TUIs without leaving your command line
16+
- **Lightweight**: No desktop apps or web interfaces, just a fast, focused CLI tool
1617
- **Unified data model**: Tasks, notes, and media items can reference each other, creating a connected knowledge and productivity system
1718

18-
## Getting started
19+
## Getting Started
1920

20-
### Prerequisites
21-
22-
Go v1.24+
23-
24-
### Installation
21+
### Quick Install
2522

2623
```sh
2724
git clone https://github.com/stormlightlabs/noteleaf
@@ -30,45 +27,6 @@ go build -o ./tmp/noteleaf ./cmd
3027
go install
3128
```
3229

33-
### Basic usage
34-
35-
```sh
36-
# Initialize the application
37-
noteleaf setup
38-
39-
# Add sample data for exploration
40-
noteleaf setup seed
41-
42-
# Create your first task
43-
noteleaf task add "Learn Noteleaf CLI"
44-
45-
# View tasks
46-
noteleaf task list
47-
48-
# Create a note
49-
noteleaf note add "My first note"
50-
51-
# Add a book to your reading list
52-
noteleaf media book add "The Name of the Wind"
53-
54-
# Generate docs
55-
noteleaf docgen --format docusaurus --out ./website/docs/manual
56-
```
57-
58-
## Status
59-
60-
**Status**: Work in Progress (MVP completed)
61-
62-
### Completed
63-
64-
- Task management with projects and tags
65-
- Note-taking system
66-
- Article parsing from URLs
67-
- Media tracking (books, movies, TV shows)
68-
69-
### Planned
30+
### First Steps
7031

71-
- Time tracking integration
72-
- Advanced search and filtering
73-
- Export/import functionality
74-
- Plugin system
32+
For a comprehensive walkthrough including task management, time tracking, notes, and media tracking, see the [Quickstart Guide](website/docs/Quickstart.md).

Taskfile.yml

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
version: '3'
2+
3+
vars:
4+
BINARY_NAME: noteleaf
5+
BUILD_DIR: ./tmp
6+
CMD_DIR: ./cmd
7+
COVERAGE_FILE: coverage.out
8+
COVERAGE_HTML: coverage.html
9+
VERSION_PKG: github.com/stormlightlabs/noteleaf/internal/version
10+
11+
# Git version detection
12+
GIT_COMMIT:
13+
sh: git rev-parse --short HEAD 2>/dev/null || echo "none"
14+
GIT_TAG:
15+
sh: git describe --tags --exact-match 2>/dev/null || echo ""
16+
GIT_DESCRIBE:
17+
sh: git describe --tags --always --dirty 2>/dev/null || echo "dev"
18+
BUILD_DATE:
19+
sh: date -u +"%Y-%m-%dT%H:%M:%SZ"
20+
21+
tasks:
22+
default:
23+
desc: Show available tasks
24+
silent: true
25+
cmds:
26+
- task --list
27+
28+
test:
29+
desc: Run all tests
30+
cmds:
31+
- go test ./...
32+
33+
coverage:
34+
desc: Generate HTML coverage report
35+
cmds:
36+
- go test -coverprofile={{.COVERAGE_FILE}} ./...
37+
- go tool cover -html={{.COVERAGE_FILE}} -o {{.COVERAGE_HTML}}
38+
- echo "Coverage report generated at {{.COVERAGE_HTML}}"
39+
40+
cov:
41+
desc: Show coverage in terminal
42+
cmds:
43+
- go test -coverprofile={{.COVERAGE_FILE}} ./...
44+
- go tool cover -func={{.COVERAGE_FILE}}
45+
46+
build:
47+
desc: Build binary (simple build without version injection)
48+
cmds:
49+
- mkdir -p {{.BUILD_DIR}}
50+
- go build -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.CMD_DIR}}
51+
- echo "Built {{.BUILD_DIR}}/{{.BINARY_NAME}}"
52+
53+
build:dev:
54+
desc: Build binary with dev version (includes git commit hash)
55+
vars:
56+
VERSION: "{{.GIT_DESCRIBE}}"
57+
LDFLAGS: "-X {{.VERSION_PKG}}.Version={{.VERSION}} -X {{.VERSION_PKG}}.Commit={{.GIT_COMMIT}} -X {{.VERSION_PKG}}.BuildDate={{.BUILD_DATE}}"
58+
cmds:
59+
- mkdir -p {{.BUILD_DIR}}
60+
- go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.CMD_DIR}}
61+
- 'echo "Built {{.BUILD_DIR}}/{{.BINARY_NAME}} (version: {{.VERSION}})"'
62+
63+
build:rc:
64+
desc: Build release candidate binary (requires git tag with -rc suffix)
65+
vars:
66+
VERSION: "{{.GIT_TAG}}"
67+
LDFLAGS: "-X {{.VERSION_PKG}}.Version={{.VERSION}} -X {{.VERSION_PKG}}.Commit={{.GIT_COMMIT}} -X {{.VERSION_PKG}}.BuildDate={{.BUILD_DATE}}"
68+
preconditions:
69+
- sh: '[ -n "{{.GIT_TAG}}" ]'
70+
msg: "No git tag found. Create a tag with 'git tag v1.0.0-rc1' first."
71+
- sh: 'echo "{{.GIT_TAG}}" | grep -q "\-rc"'
72+
msg: "Git tag must contain '-rc' for release candidate builds (e.g., v1.0.0-rc1)"
73+
cmds:
74+
- mkdir -p {{.BUILD_DIR}}
75+
- go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.CMD_DIR}}
76+
- 'echo "Built {{.BUILD_DIR}}/{{.BINARY_NAME}} (version: {{.VERSION}})"'
77+
78+
build:prod:
79+
desc: Build production binary (requires clean semver git tag)
80+
vars:
81+
VERSION: "{{.GIT_TAG}}"
82+
LDFLAGS: "-X {{.VERSION_PKG}}.Version={{.VERSION}} -X {{.VERSION_PKG}}.Commit={{.GIT_COMMIT}} -X {{.VERSION_PKG}}.BuildDate={{.BUILD_DATE}}"
83+
preconditions:
84+
- sh: '[ -n "{{.GIT_TAG}}" ]'
85+
msg: "No git tag found. Create a tag with 'git tag v1.0.0' first."
86+
- sh: 'echo "{{.GIT_TAG}}" | grep -qE "^v?[0-9]+\.[0-9]+\.[0-9]+$"'
87+
msg: "Git tag must be a clean semver version (e.g., v1.0.0 or 1.0.0) without prerelease suffix"
88+
- sh: '[ -z "$(git status --porcelain)" ]'
89+
msg: "Working directory must be clean (no uncommitted changes) for production builds"
90+
cmds:
91+
- mkdir -p {{.BUILD_DIR}}
92+
- go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.CMD_DIR}}
93+
- 'echo "Built {{.BUILD_DIR}}/{{.BINARY_NAME}} (version: {{.VERSION}})"'
94+
95+
clean:
96+
desc: Remove build artifacts and coverage files
97+
cmds:
98+
- rm -f {{.COVERAGE_FILE}} {{.COVERAGE_HTML}}
99+
- rm -rf {{.BUILD_DIR}}
100+
- echo "Cleaned build artifacts"
101+
102+
lint:
103+
desc: Run linters (go vet and go fmt)
104+
cmds:
105+
- go vet ./...
106+
- go fmt ./...
107+
108+
check:
109+
desc: Run linters and coverage tests
110+
cmds:
111+
- task: lint
112+
- task: cov
113+
114+
deps:
115+
desc: Download and tidy dependencies
116+
cmds:
117+
- go mod download
118+
- go mod tidy
119+
120+
run:
121+
desc: Build and run the application
122+
deps: [build]
123+
cmds:
124+
- '{{.BUILD_DIR}}/{{.BINARY_NAME}}'
125+
126+
status:
127+
desc: Show Go version, module info, and dependencies
128+
silent: true
129+
cmds:
130+
- echo "=== Go Version ==="
131+
- go version
132+
- echo ""
133+
- echo "=== Module Info ==="
134+
- go list -m
135+
- echo ""
136+
- echo "=== Dependencies ==="
137+
- go list -m all
138+
139+
dev:
140+
desc: Full development workflow (clean, lint, test, build)
141+
cmds:
142+
- task: clean
143+
- task: lint
144+
- task: test
145+
- task: build
146+
147+
docs:generate:
148+
desc: Generate documentation in all formats
149+
cmds:
150+
- go run tools/docgen.go -output website/docs/manual -format docusaurus
151+
- go run tools/docgen.go -output docs/manual -format man
152+
- echo "Documentation generated"
153+
154+
docs:man:
155+
desc: Generate man pages
156+
cmds:
157+
- mkdir -p docs/manual
158+
- go run tools/docgen.go -output docs/manual -format man
159+
- echo "Man pages generated in docs/manual"
160+
161+
docs:serve:
162+
desc: Start docusaurus development server
163+
dir: website
164+
cmds:
165+
- npm run start
166+
167+
version:show:
168+
desc: Display current version information
169+
silent: true
170+
cmds:
171+
- echo "Version info:"
172+
- 'echo " Git tag: {{.GIT_TAG}}"'
173+
- 'echo " Git commit: {{.GIT_COMMIT}}"'
174+
- 'echo " Git describe: {{.GIT_DESCRIBE}}"'
175+
- 'echo " Build date: {{.BUILD_DATE}}"'
176+
177+
version:validate:
178+
desc: Validate git tag format for releases
179+
cmds:
180+
- |
181+
if [ -z "{{.GIT_TAG}}" ]; then
182+
echo "No git tag found"
183+
exit 1
184+
fi
185+
if echo "{{.GIT_TAG}}" | grep -qE "^v?[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$"; then
186+
echo "Valid version tag: {{.GIT_TAG}}"
187+
else
188+
echo "Invalid version tag: {{.GIT_TAG}}"
189+
echo "Expected format: v1.0.0 or v1.0.0-rc1"
190+
exit 1
191+
fi

cmd/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/stormlightlabs/noteleaf/internal/store"
1414
"github.com/stormlightlabs/noteleaf/internal/ui"
1515
"github.com/stormlightlabs/noteleaf/internal/utils"
16+
"github.com/stormlightlabs/noteleaf/internal/version"
1617
"github.com/stormlightlabs/noteleaf/tools"
1718
)
1819

@@ -253,7 +254,7 @@ history of completed media.`,
253254
root.AddCommand(tools.NewDocGenCommand(root))
254255

255256
opts := []fang.Option{
256-
fang.WithVersion("0.1.0"),
257+
fang.WithVersion(version.String()),
257258
fang.WithoutCompletions(),
258259
fang.WithColorSchemeFunc(ui.NoteleafColorScheme),
259260
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.24.5
44

55
require (
66
github.com/BurntSushi/toml v1.5.0
7-
github.com/charmbracelet/fang v0.4.2
7+
github.com/charmbracelet/fang v0.4.3
88
github.com/mattn/go-sqlite3 v1.14.32
99
github.com/spf13/cobra v1.9.1
1010
)
@@ -19,7 +19,7 @@ require (
1919
github.com/bluesky-social/indigo v0.0.0-20251031012455-0b4bd2478a61
2020
github.com/gomarkdown/markdown v0.0.0-20250810172220-2e2c11897d1a
2121
github.com/ipfs/go-cid v0.4.1
22-
github.com/jaswdr/faker/v2 v2.8.0
22+
github.com/jaswdr/faker/v2 v2.8.1
2323
)
2424

2525
require (

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ github.com/charmbracelet/bubbletea v1.3.4 h1:kCg7B+jSCFPLYRA52SDZjr51kG/fMUEoPoZ
4343
github.com/charmbracelet/bubbletea v1.3.4/go.mod h1:dtcUCyCGEX3g9tosuYiut3MXgY/Jsv9nKVdibKKRRXo=
4444
github.com/charmbracelet/colorprofile v0.3.2 h1:9J27WdztfJQVAQKX2WOlSSRB+5gaKqqITmrvb1uTIiI=
4545
github.com/charmbracelet/colorprofile v0.3.2/go.mod h1:mTD5XzNeWHj8oqHb+S1bssQb7vIHbepiebQ2kPKVKbI=
46-
github.com/charmbracelet/fang v0.4.2 h1:nWr7Tb82/TTNNGMGG35aTZ1X68loAOQmpb0qxkKXjas=
47-
github.com/charmbracelet/fang v0.4.2/go.mod h1:wHJKQYO5ReYsxx+yZl+skDtrlKO/4LLEQ6EXsdHhRhg=
46+
github.com/charmbracelet/fang v0.4.3 h1:qXeMxnL4H6mSKBUhDefHu8NfikFbP/MBNTfqTrXvzmY=
47+
github.com/charmbracelet/fang v0.4.3/go.mod h1:wHJKQYO5ReYsxx+yZl+skDtrlKO/4LLEQ6EXsdHhRhg=
4848
github.com/charmbracelet/glamour v0.10.0 h1:MtZvfwsYCx8jEPFJm3rIBFIMZUfUJ765oX8V6kXldcY=
4949
github.com/charmbracelet/glamour v0.10.0/go.mod h1:f+uf+I/ChNmqo087elLnVdCiVgjSKWuXa/l6NU2ndYk=
5050
github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 h1:ZR7e0ro+SZZiIZD7msJyA+NjkCNNavuiPBLgerbOziE=
@@ -197,8 +197,8 @@ github.com/ipld/go-ipld-prime v0.21.0 h1:n4JmcpOlPDIxBcY037SVfpd1G+Sj1nKZah0m6QH
197197
github.com/ipld/go-ipld-prime v0.21.0/go.mod h1:3RLqy//ERg/y5oShXXdx5YIp50cFGOanyMctpPjsvxQ=
198198
github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus=
199199
github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
200-
github.com/jaswdr/faker/v2 v2.8.0 h1:3AxdXW9U7dJmWckh/P0YgRbNlCcVsTyrUNUnLVP9b3Q=
201-
github.com/jaswdr/faker/v2 v2.8.0/go.mod h1:jZq+qzNQr8/P+5fHd9t3txe2GNPnthrTfohtnJ7B+68=
200+
github.com/jaswdr/faker/v2 v2.8.1 h1:2AcPgHDBXYQregFUH9LgVZKfFupc4SIquYhp29sf5wQ=
201+
github.com/jaswdr/faker/v2 v2.8.1/go.mod h1:jZq+qzNQr8/P+5fHd9t3txe2GNPnthrTfohtnJ7B+68=
202202
github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA=
203203
github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o=
204204
github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=

0 commit comments

Comments
 (0)