Skip to content

Commit ab38ba2

Browse files
committed
Update when colors and handles
1 parent 61c71d2 commit ab38ba2

80 files changed

Lines changed: 10595 additions & 2157 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.githooks/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT="$(git rev-parse --show-toplevel)"
5+
exec "$ROOT/scripts/pre-commit.sh"

.github/workflows/ci.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
backend:
14+
name: Backend (Go)
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version-file: go.mod
24+
cache: true
25+
26+
- name: Install goimports
27+
run: go install golang.org/x/tools/cmd/goimports@latest
28+
29+
- name: Check Go formatting/imports
30+
run: ./scripts/check-go-format.sh
31+
32+
- name: Go vet
33+
run: go vet ./...
34+
35+
- name: Go test
36+
run: go test ./... -count=1
37+
38+
proto:
39+
name: Proto (buf)
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
45+
- name: Setup buf
46+
uses: bufbuild/buf-setup-action@v1
47+
48+
- name: Check proto formatting
49+
run: buf format -d --exit-code
50+
51+
- name: Proto lint
52+
run: buf lint
53+
54+
- name: Buf build
55+
run: buf build
56+
57+
frontend:
58+
name: Frontend (Next.js)
59+
runs-on: ubuntu-latest
60+
defaults:
61+
run:
62+
working-directory: ui
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v4
66+
67+
- name: Setup Node
68+
uses: actions/setup-node@v4
69+
with:
70+
node-version: "22"
71+
cache: npm
72+
cache-dependency-path: ui/package-lock.json
73+
74+
- name: Install dependencies
75+
run: npm ci
76+
77+
- name: ESLint
78+
run: npm run lint
79+
80+
- name: Prettier check
81+
run: npm run format
82+
83+
- name: Typecheck
84+
run: npm run typecheck
85+
86+
- name: Build
87+
run: npm run build

.github/workflows/health.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Health Checks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
go-vulncheck:
14+
name: Go Vulnerability Scan
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version-file: go.mod
24+
cache: true
25+
26+
- name: Install govulncheck
27+
run: go install golang.org/x/vuln/cmd/govulncheck@latest
28+
29+
- name: Run govulncheck
30+
run: govulncheck ./...
31+
32+
ui-audit:
33+
name: UI Dependency Audit
34+
runs-on: ubuntu-latest
35+
defaults:
36+
run:
37+
working-directory: ui
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
42+
- name: Setup Node
43+
uses: actions/setup-node@v4
44+
with:
45+
node-version: "22"
46+
cache: npm
47+
cache-dependency-path: ui/package-lock.json
48+
49+
- name: Install dependencies
50+
run: npm ci
51+
52+
- name: npm audit (high+)
53+
run: npm audit --audit-level=high
54+
55+
proto-health:
56+
name: Proto Health
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Checkout
60+
uses: actions/checkout@v4
61+
62+
- name: Setup buf
63+
uses: bufbuild/buf-setup-action@v1
64+
65+
- name: Proto lint
66+
run: buf lint
67+
68+
- name: Buf build
69+
run: buf build

.gitignore

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,42 @@
1-
gen/
2-
*.log
1+
# OS / editor
32
.DS_Store
3+
.idea/
4+
.vscode/
5+
*.swp
6+
*.swo
7+
8+
# Logs / temp
9+
*.log
10+
*.tmp
11+
*.out
12+
13+
# Environment files
14+
.env
15+
.env.*
16+
!.env.example
17+
18+
# Go
19+
bin/
20+
server
21+
.gocache/
22+
coverage.out
23+
coverage.txt
24+
25+
# Node / Next.js (ui)
26+
ui/node_modules/
27+
ui/.next/
28+
ui/out/
29+
ui/build/
30+
ui/.turbo/
31+
ui/.npm/
32+
ui/.pnpm-store/
33+
ui/coverage/
34+
35+
# Package manager logs
36+
npm-debug.log*
37+
yarn-debug.log*
38+
yarn-error.log*
39+
pnpm-debug.log*
440

41+
# Local tool state
42+
.claude/

Makefile

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
# agentic-learnings — development driver
21
# Run `make help` for usage
32

4-
.PHONY: help proto proto-lint proto-format build run test fmt vet lint check clean \
5-
ui-install ui-dev ui-build ui-lint ui-start \
6-
dev all deps
3+
.PHONY: help proto proto-lint proto-format proto-check build run test fmt vet check clean \
4+
ui-install ui-dev ui-build ui-lint ui-format ui-typecheck ui-start \
5+
dev all deps hooks-install hooks-uninstall
76

87
BINARY := bin/server
98
GO_PKGS := ./...
@@ -19,25 +18,30 @@ help:
1918
@echo " make build Build server binary to $(BINARY)"
2019
@echo " make run Run server (Connect :$(API_PORT), gRPC :$(GRPC_PORT))"
2120
@echo " make test Run Go tests"
22-
@echo " make fmt Format Go code"
21+
@echo " make fmt Format Go code and imports (goimports)"
2322
@echo " make vet Run go vet"
2423
@echo ""
2524
@echo "Frontend (Next.js in $(UI_DIR)/):"
2625
@echo " make ui-install Install UI dependencies"
2726
@echo " make ui-dev Run UI dev server"
2827
@echo " make ui-build Build UI for production"
2928
@echo " make ui-lint Lint UI"
29+
@echo " make ui-format Check UI formatting (prettier)"
30+
@echo " make ui-typecheck Type-check UI (tsc --noEmit)"
3031
@echo ""
3132
@echo "Proto & codegen:"
3233
@echo " make proto Generate Go + TypeScript from protos (buf)"
3334
@echo " make proto-lint Lint protos (buf lint)"
3435
@echo " make proto-format Check proto formatting (buf format -d)"
36+
@echo " make proto-check proto-format + proto-lint + buf build"
3537
@echo ""
3638
@echo "Convenience:"
37-
@echo " make deps Install Go + buf tooling needed for proto"
39+
@echo " make deps Install local CLI tooling (buf, protoc plugins, goimports)"
40+
@echo " make hooks-install Configure git to use repo pre-commit hooks"
41+
@echo " make hooks-uninstall Remove repo hook configuration"
3842
@echo " make dev Run backend + UI in parallel (use Ctrl+C to stop both)"
39-
@echo " make all Proto + build backend + build UI"
40-
@echo " make check fmt + vet + test + ui-lint"
43+
@echo " make all Build backend + build UI"
44+
@echo " make check fmt + vet + proto checks + test + UI lint/format/typecheck"
4145
@echo " make clean Remove built artifacts"
4246

4347
# ─── Proto ───────────────────────────────────────────────────────────────────
@@ -53,6 +57,12 @@ proto-format:
5357
buf format -d
5458
@echo "proto-format: ok"
5559

60+
proto-check: proto-format proto-lint
61+
@GOBIN="$$(go env GOPATH)/bin"; PATH="$$GOBIN:$$PATH"; \
62+
command -v buf >/dev/null 2>&1 || { echo "missing: buf (run make deps)"; exit 1; }; \
63+
buf build
64+
@echo "proto-check: ok"
65+
5666
proto: proto-lint
5767
@GOBIN="$$(go env GOPATH)/bin"; PATH="$$GOBIN:$$PATH"; \
5868
for cmd in buf protoc-gen-go protoc-gen-go-grpc; do \
@@ -66,6 +76,7 @@ deps:
6676
@go install github.com/bufbuild/buf/cmd/buf@latest
6777
@go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
6878
@go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
79+
@go install golang.org/x/tools/cmd/goimports@latest
6980
@echo "deps: installed"
7081

7182
# ─── Backend ──────────────────────────────────────────────────────────────────
@@ -81,14 +92,19 @@ test:
8192
go test $(GO_PKGS) -count=1
8293

8394
fmt:
84-
@go fmt $(GO_PKGS)
95+
@GOBIN="$$(go env GOPATH)/bin"; PATH="$$GOBIN:$$PATH"; \
96+
command -v goimports >/dev/null 2>&1 || { echo "missing: goimports (run make deps)"; exit 1; }; \
97+
GO_FILES="$$(git ls-files '*.go')"; \
98+
if [ -n "$$GO_FILES" ]; then \
99+
goimports -w $$GO_FILES; \
100+
fi
85101

86102
vet:
87103
go vet $(GO_PKGS)
88104

89105
# ─── Frontend ─────────────────────────────────────────────────────────────────
90106
ui-install:
91-
cd $(UI_DIR) && npm install
107+
cd $(UI_DIR) && npm ci
92108

93109
ui-dev: proto
94110
cd $(UI_DIR) && npm run dev
@@ -99,6 +115,12 @@ ui-build: proto
99115
ui-lint:
100116
cd $(UI_DIR) && npm run lint
101117

118+
ui-format:
119+
cd $(UI_DIR) && npm run format
120+
121+
ui-typecheck:
122+
cd $(UI_DIR) && npm run typecheck
123+
102124
ui-start: ui-build
103125
cd $(UI_DIR) && npm run start
104126

@@ -110,13 +132,23 @@ dev:
110132
$(MAKE) ui-dev; \
111133
kill $$SERVER_PID 2>/dev/null || true
112134

113-
all: proto build ui-build
135+
all: build ui-build
114136
@echo "all: backend and UI built"
115137

116-
check: fmt vet proto-lint proto-format test ui-lint
138+
check: fmt vet proto-check test ui-lint ui-format ui-typecheck
117139
@echo "check: passed"
118140

141+
hooks-install:
142+
@git config core.hooksPath .githooks
143+
@chmod +x .githooks/pre-commit scripts/pre-commit.sh
144+
@echo "hooks-install: configured .githooks/pre-commit"
145+
146+
hooks-uninstall:
147+
@-git config --unset core.hooksPath
148+
@echo "hooks-uninstall: removed core.hooksPath"
149+
119150
clean:
120151
rm -rf bin
152+
rm -rf .gocache
121153
rm -rf $(UI_DIR)/.next $(UI_DIR)/build
122154
@echo "clean: done"

0 commit comments

Comments
 (0)