-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
157 lines (130 loc) · 5.46 KB
/
Makefile
File metadata and controls
157 lines (130 loc) · 5.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
.PHONY: dev build release install install-deps install-app uninstall lint fmt check clean wipe-config test test-rust test-front test-tui front icons sidecar tui tui-build tui-help coverage-check coverage-rust coverage-fe size-check quality-check setup-hooks
# Development — frontend (Vite HMR) + backend (Rust rebuild on change).
# Trims Rust artifacts not touched in the last 7 days before each session
# so target/ stops inflating past 30 GB. Requires `cargo install cargo-sweep`;
# falls back silently if missing so dev never blocks on a tooling gap.
dev: sidecar
@command -v cargo-sweep >/dev/null 2>&1 && cargo sweep --time 7 || true
npm run tauri dev
# Run the terminal binary. Opens the active vault from the database;
# prompts on first run.
tui:
cargo run -p httui-tui
tui-help:
cargo run -p httui-tui -- --help
tui-build:
cargo build -p httui-tui --release
test-tui:
cargo test -p httui-tui
# Frontend only (sem janela desktop)
front:
npm run dev
# Build do sidecar (JS bundle) — empacotado como recurso Tauri, executado via node
sidecar:
@command -v bun >/dev/null 2>&1 || { \
echo "Error: bun is required to build the sidecar."; \
echo "Install with: curl -fsSL https://bun.sh/install | bash"; \
exit 1; \
}
@mkdir -p httui-desktop/src-tauri/resources
cd httui-sidecar && bun install && bun run build
# Build de producao (com bundle .app para macOS)
build: sidecar
npm run tauri build -- --bundles app
# Instalar dependencias
install-deps:
npm install
cd httui-sidecar && (command -v bun >/dev/null 2>&1 && bun install || echo "skip: bun not installed")
cargo fetch
# Build + instalar app em /Applications (macOS)
APP_NAME = httui
APP_BUNDLE = target/release/bundle/macos/$(APP_NAME).app
install: build
@if [ ! -d "$(APP_BUNDLE)" ]; then \
echo "Error: build failed — $(APP_BUNDLE) not found"; \
exit 1; \
fi
@echo "Installing $(APP_NAME) to /Applications..."
@rm -rf "/Applications/$(APP_NAME).app"
@cp -R "$(APP_BUNDLE)" "/Applications/$(APP_NAME).app"
@echo "Done. Open with: open '/Applications/$(APP_NAME).app'"
# Remover app de /Applications
uninstall:
@echo "Removing $(APP_NAME) from /Applications..."
@rm -rf "/Applications/$(APP_NAME).app"
@echo "Done."
# Type check + clippy + fmt-check + prettier-check. Mirrors the CI gate.
check:
./node_modules/.bin/tsc --noEmit -p httui-desktop/tsconfig.json
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
# Lint TS/TSX in both frontend workspaces (eslint, not tsc).
lint:
npm run lint --workspace httui-desktop
npm run lint --workspace httui-web
# Format Rust + frontend in place.
fmt:
cargo fmt --all
./node_modules/.bin/prettier --write 'httui-desktop/src/**/*.{ts,tsx,js,jsx,css,md}' 'httui-web/src/**/*.{ts,tsx,js,jsx,css,md}' 'httui-sidecar/src/**/*.{ts,tsx,js,jsx}'
# Pre-release validation: every gate the CI runs, then the release build.
# Use this before tagging a version to catch regressions locally.
release: check test build
@echo "Release artifacts ready in $(APP_BUNDLE)"
# Testes
test: test-rust test-tui test-front
test-rust:
cargo test --workspace
test-front:
npm run test --workspace httui-desktop -- --project unit
# Coverage gate — touched-files rule (≥80% per file changed).
# See CONTRIBUTING.md.
coverage-check:
./scripts/coverage-check.sh
# Run the full Rust coverage report. Used by coverage-check; exposed
# for ad-hoc inspection (HTML report opens at target/llvm-cov/html/index.html).
coverage-rust:
cargo llvm-cov --workspace --html
# Frontend coverage report (HTML at httui-desktop/coverage/index.html).
coverage-fe:
cd httui-desktop && npm run test -- --project unit --coverage
# File-size gate — touched files must stay under MAX_LINES (default 600).
# SOLID nudge for SRP. See CONTRIBUTING.md.
size-check:
./scripts/size-check.sh
# Combined gate — runs size-check then coverage-check. Same order as
# the pre-push hook so local runs match remote behavior.
quality-check: size-check coverage-check
# Symlink tracked git hooks into .git/hooks (idempotent).
setup-hooks:
./scripts/setup-hooks.sh
# Limpar artifacts
clean:
rm -rf httui-desktop/dist
cargo clean
# Limpar estado persistente do app (configs + cache). Útil pra
# voltar ao empty state entre testes manuais. Mantém keychain
# (use `security delete-generic-password -s httui-notes` em loop
# se precisar limpar secrets também). Vaults no disco NÃO são
# tocados. Feche o app antes.
#
# Paths usados pelo app (productName=httui em tauri.conf.json):
# ~/.config/httui (notes.db)
# ~/Library/Application Support/httui (user.toml — Mac)
# ~/Library/Caches/httui-notes (WebKit cache)
wipe-config:
@echo "Wiping httui app config..."
@rm -rf "$$HOME/.config/httui"
@rm -rf "$$HOME/Library/Application Support/httui"
@rm -rf "$$HOME/Library/Caches/httui-notes"
@echo "Done. App opens with empty state on next launch."
# Gerar icones placeholder
icons:
@mkdir -p httui-desktop/src-tauri/icons
@python3 -c "\
import struct, zlib; \
def png(w,h,r,g,b): \
ch=lambda t,d: struct.pack('>I',len(d))+t+d+struct.pack('>I',zlib.crc32(t+d)&0xffffffff); \
raw=b''.join(b'\x00'+bytes([r,g,b,255])*w for _ in range(h)); \
return b'\x89PNG\r\n\x1a\n'+ch(b'IHDR',struct.pack('>IIBBBBB',w,h,8,6,0,0,0))+ch(b'IDAT',zlib.compress(raw))+ch(b'IEND',b''); \
[open(f'httui-desktop/src-tauri/icons/{n}','wb').write(png(s,s,99,102,241)) for n,s in [('icon.png',256),('32x32.png',32),('128x128.png',128),('128x128@2x.png',256)]]; \
print('icons generated')"