Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
/.codegraph/
# Local AI runtime state
.atl/
# Generated frontend bundle embedded by the Wails composition root. It is
# versioned so direct Go builds and tests have the same runtime assets.
!/cmd/x6configurator/frontend/
!/cmd/x6configurator/frontend/dist/
!/cmd/x6configurator/frontend/dist/**
# Generated frontend bundle embedded by the Wails composition root.
/cmd/x6configurator/frontend/dist/
/bin/
/frontend/node_modules/
2 changes: 1 addition & 1 deletion .opencode/skills/wails-backend/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Wails service (`internal/desktop/service.go`), emitting live events, or changing
3. In `cmd`, ensure the real emitter is attached (`AttachListener`) and the
listener is started/stopped with the app lifecycle.
4. Regenerate bindings; update `frontend/src/wails-service.ts` facade.
5. Run `go build ./...` and `(cd frontend && npm run build)`.
5. Run `(cd frontend && npm ci && npm run build)` before `go build ./...`, Go tests, or `go vet ./...`; `//go:embed frontend/dist` requires the generated assets.

## Output Contract
Report the method/binding added, the event name emitted, the lifecycle wiring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ app := application.New(application.Options{
})
```

Assets come from `//go:embed frontend/dist` (`main.go:20`).
Assets come from `//go:embed frontend/dist` (`main.go:20`). Generate them on a clean checkout with `(cd frontend && npm ci && npm run build)` before any Go build, test, or vet command; the output is generated and ignored rather than versioned.

## 2. Bridge events without importing Wails into `desktop`

Expand Down
10 changes: 9 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ cd attack-shark-linux
The hidraw tests run against a fake device — no hardware needed:

```sh
(cd frontend && npm ci && npm run build)
go build ./...
go test ./...
```

Generate the embedded frontend first on every clean checkout, before any Go
build, test, vet, or release check.

To test against the real dongle, install the udev policy first
([docs/linux-usb-prerequisites.md](docs/linux-usb-prerequisites.md)).

Expand Down Expand Up @@ -82,12 +86,15 @@ Branch naming:
**Tests must pass before merge.** CI enforces this automatically.

```sh
# Required before backend checks on a clean checkout
(cd frontend && npm ci && npm run build)

# Backend
go test ./... # unit tests (fake hidraw, no device needed)
go vet ./... # static analysis

# Frontend
(cd frontend && npm ci && npm test)
(cd frontend && npm test)
```

### Test conventions
Expand Down Expand Up @@ -139,6 +146,7 @@ body.

### PR checklist (required)

- [ ] `(cd frontend && npm ci && npm run build)` completes before Go checks
- [ ] `go build ./...` compiles without errors
- [ ] `go test ./...` unit tests pass
- [ ] `go vet ./...` passes
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ install-deps: ## Install native Ubuntu/Debian dependencies required by Wails
frontend-install: ## Install frontend dependencies deterministically
cd $(FRONTEND_DIR) && npm ci

frontend-build: ## Build frontend assets
frontend-build: frontend-install ## Build frontend assets
cd $(FRONTEND_DIR) && npm run build

frontend-test: ## Run frontend tests
cd $(FRONTEND_DIR) && npm test

go-test: ## Run Go tests
go-test: frontend-build ## Run Go tests
go test ./...

vet: ## Run Go vet
vet: frontend-build ## Run Go vet
go vet ./...

test: go-test frontend-test ## Run Go and frontend tests

build: ## Build the Wails desktop application
build: frontend-build ## Build the Wails desktop application
cd $(APP_DIR) && $(WAILS) build

dev: ## Start the Wails development application
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,25 @@ Go + [Wails v3](https://wails.io) (backend) and React + Vite (frontend).

## Building

Requirements: Go 1.25+, Node.js (for the frontend).
Requirements: Go 1.25+, Node.js (for the frontend), and [Task](https://taskfile.dev).

```sh
# Generate the embedded frontend before any Go build, test, or vet command.
(cd frontend && npm ci && npm run build)

# Backend + embedded frontend
task build # taskfile at cmd/x6configurator
task --dir cmd/x6configurator build

# Or manually:
# Or build the Go packages manually:
go build ./...
(cd frontend && npm ci && npm run build)
```

## Testing

```sh
# Required once per clean checkout, before Go checks:
(cd frontend && npm ci && npm run build)

go test ./... # backend unit tests (hidraw tests use a fake, no device needed)
go vet ./... # static analysis
(cd frontend && npm test) # frontend unit tests (vitest)
Expand Down

This file was deleted.

14 changes: 0 additions & 14 deletions cmd/x6configurator/frontend/dist/assets/index-DG8SNgAN.js

This file was deleted.

3 changes: 0 additions & 3 deletions cmd/x6configurator/frontend/dist/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions docs/linux-usb-prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Wails remains pinned to `github.com/wailsapp/wails/v3 v3.0.0-beta.5`; this
document does not upgrade it. Build and run the fake-only hidraw tests with:

```sh
# Generate the assets embedded by cmd/x6configurator before Go checks or builds.
(cd frontend && npm ci && npm run build)
go test ./internal/hidlinux -run 'TestHidraw(SendAndAwait|ReadInterruptIN|Enumerate|ValidateDescriptor)' -count=1
go build ./cmd/x6configurator
```
Expand Down
Loading