Commit Graph

28 Commits

Author SHA1 Message Date
david b5650c53ba test: add JS test framework using Node built-in test runner
Extracted pure utility functions (esc, sanitize, formatBytes, formatTime)
into web/ui/util.js with CommonJS export for Node testing compatibility.
Added 19 tests across 4 suites using node:test + node:assert (zero deps).

- util.js: browser-compatible utility functions
- util.test.js: 19 tests (5 esc, 3 sanitize, 6 formatBytes, 5 formatTime)
- package.json: 'test' script → node --test util.test.js
- mise.toml: js-test task
- app.js: removed duplicate helper functions (now in util.js)
- index.html: load util.js before app.js
2026-06-22 02:23:24 -07:00
david d7a17eb054 fix: show extract API errors in UI instead of false 'Extraction complete'
doExtract() only checked data.message, so JSON responses with
error key (e.g. 'no ISO files found') would show green success.
Now checks data.error first and displays it in red.
2026-06-22 01:10:40 -07:00
david fe3e92ce33 feat: recursive WAV browsing in subdirectories
Handle ListWavs now uses filepath.WalkDir to find .wav files
in all subdirectories. Returns relative paths (e.g. Kicks/kick.wav).
Serves them correctly via /wavs/ prefix.

Fixed: WalkDir swallows root errors differently than ReadDir —
now detects and reports non-existent root directory errors.

Added test for recursive subdirectory traversal.
2026-06-22 01:05:44 -07:00
david 371feaf0cb fix: initialize files as empty slice instead of nil var
var files []string marshals to JSON null, breaking the frontend
which expects an array. Using files := []string{} ensures [].
2026-06-22 00:46:30 -07:00
david b69e1d81ab debug: add console logging to browseWavs and playWav 2026-06-22 00:42:18 -07:00
david cd8484de0c fix: pin electron to exact version 33.4.11
electron-builder requires an exact version (not a range like ^33.0.0)
because it downloads platform-specific binaries for a specific release.
2026-06-22 00:22:19 -07:00
david d194a25bf8 chore: pin node to 22.12 to fix electron-build engine requirements
@electron/rebuild and node-abi require node >=22.12.0.
System node (22.9.0) caused EBADENGINE errors during electron-build.
2026-06-22 00:16:42 -07:00
david 4f03524668 chore: add JS/ESLint toolchain, refactor onclick to event delegation
- Add ESLint config for web/ui (flat config, golangci-lint-compatible)
- Add js-lint task to mise.toml (npm run lint in web/ui)
- Add ESLint check to check-toolchain.sh
- Add .golangci.yml for golangci-lint v2 with correct exclusions
- Refactor app.js: replace inline onclick with data-action + event delegation
- Add null checks and HTTP status checks to browseWavs
- Add web/ui/node_modules/ to .gitignore
2026-06-22 00:10:49 -07:00
david f716902580 fix: handle null data in browseWavs, add HTTP status check
Avoid 'Cannot read properties of null (reading error)' when server
returns null or non-JSON. Also check resp.ok before parsing JSON.
2026-06-22 00:02:32 -07:00
david cf53912a33 feat: Audio Preview Player — browse and play WAV samples via Web Audio API
Issue: #9

Backend:
- GET /api/list-wavs?dir=<path> — lists .wav files in a directory
- GET /wavs/<file> — static file serving from ./output/wavs

Web UI:
- WAV Browser section with path input + Browse button
- AudioContext-based playback (zero deps) — progress bar, time display
- WAV file grid with Play buttons, active item highlighting

Tests:
- 3 new tests for handleListWavs (wav files, empty dir, nonexistent dir)
- Fix TestFindAkaiutil: add t.Chdir(tmp) so relative path lookups don't
  accidentally find the repo's third_party/akaiutil/akaiutil binary
2026-06-22 00:01:15 -07:00
david 120993fb02 test: add comprehensive test suite - 5 test files, 65% coverage
- cli_test.go: 10 tests for list/search/extract/download commands
- serve_test.go: 11 tests for HTTP handlers and SSE progress
- http_test.go: 5 subtests for archive.org API
- download_test.go: 10 tests for download logic
- util_test.go: 7 tests for string/util helpers

Error paths covered: server errors, empty results, download failures,
extract failures, missing identifiers, ReadDir errors.

golangci-lint: 0 issues, go vet: clean
2026-06-21 23:54:57 -07:00
david 470fb9a4c4 docs: update README/AGENTS for current codebase
- All references updated from fetch → akai-fetch
- AGENTS: document golangci-lint, extract.go replaces bash,
  remove findScript, update Electron binary name
- README: update roadmap, extraction tech stack
- mise.toml: add golangci-lint tool
2026-06-21 23:22:00 -07:00
david a17f22ccb2 rename binary from fetch to akai-fetch
Consistent with go.mod, usage strings, and docs.
Updated Dockerfile, electron config, and Makefile.
2026-06-21 22:45:12 -07:00
david f195ba5a5c ui: move search results below download/extract controls
Search bar stays at top as the "command center".
Download queue and extract controls follow.
Results render at the bottom — the main scrolling area.
2026-06-21 22:35:18 -07:00
david 31fd368bda fix: create parent dirs for downloads with subdirectory paths
Some archive.org file names include directory prefixes
(e.g. "ZERO-G - Deepest India/vocal.iso"). MkdirAll only
created the output root, not intermediate directories.
Added filepath.Dir(MkdirAll) in both downloadFile (CLI)
and handleAPIDownload (web).
2026-06-21 22:31:49 -07:00
david 04d2bec114 fix: add init target to pre-create output dirs before docker
Docker creates host-side bind-mount directories as root:root.
Pre-creating them with make init (or mise run init) ensures
they exist with the user's ownership before docker compose
touches them. docker-up now depends on init.
2026-06-21 22:29:55 -07:00
david 15979d01b5 fix: check MkdirAll errors, add gopls to toolchain
- serve.go/cmdAPIDownload: check MkdirAll error, use absolute path
- main.go/cmdDownload,cmdExtract: check MkdirAll errors
- check-toolchain.sh: verify gopls installation
- mise.toml: add gopls install task
- AGENTS.md: document gopls as dev dependency
2026-06-21 22:27:17 -07:00
david ea2bcde74b feat: reimplement WAV extraction in Go (replaces extract_wavs.sh)
extract.go replaces the bash script with idiomatic Go:
- akaiutil process communication via stdin/stdout pipes
- partition enumeration (df output parsing)
- volume enumeration (dir output parsing per partition)
- sample2wavall per volume with WAV count aggregation

runAkaiutil is a package-level var — tests stub it with canned
output to verify parsing without a real akaiutil binary or ISO.

Removed: findScript(), -tool flag on extract, os/exec from main.go
Kept: extract_wavs.sh as a standalone utility (no longer called)
2026-06-21 22:17:24 -07:00
david bc12130dd6 fix: ensure output dirs exist in extract and API extract
cmdExtract and handleAPIExtract were missing os.MkdirAll calls
while cmdDownload, cmdPipeline, and handleAPIDownload all had
them. The bash script creates dirs internally but this is not
robust — create dirs in Go before shelling out.

Closes #13
2026-06-21 22:04:47 -07:00
david 4c09fb8d9b fix: useful Docker bind address output in serve
When binding to 0.0.0.0 (--host 0.0.0.0), print "localhost" and
"<host-ip>" URLs instead of the raw 0.0.0.0 address. Also handles
nil TCPAddr.IP to avoid the ":::" garbled display in Docker.
2026-06-21 22:03:01 -07:00
david ca0cd10436 docs: update README/AGENTS for current codebase state
- README: added --host flag, toolchain check commands, docker output fix
- AGENTS: documented --host bind address behavior, macOS bcopy fix,
  check-toolchain scripts, updated architecture tree
2026-06-21 22:00:08 -07:00
david e671320bbb feat: add toolchain check scripts and mise tasks
- scripts/check-toolchain.sh: checks gcc, homebrew, mise, go, node
- scripts/check-docker-toolchain.sh: checks docker, compose, colima (macOS), buildx
- mise tasks: check-toolchain, check-docker-toolchain, check-all
2026-06-21 21:46:11 -07:00
david 48d6d8c4d3 fix: macOS bcopy conflict and Docker host binding
- Fix #11: Guard bcopy/bzero declarations with _VISUALCPP in commoninclude.h
  to avoid redefinition errors on macOS where <strings.h> provides them
- Fix #12: Add --host flag to serve command, default 127.0.0.1
  Docker now binds to 0.0.0.0 so Colima can reach the server from host
- Also fix truncate() panic when n < 3
2026-06-21 21:40:41 -07:00
david 649a73984d docs: README and AGENTS.md
- README.md: project overview, quickstart (mise/docker/build),
  architecture diagram, feature roadmap linking to issues #1-#9
- AGENTS.md: development guide covering toolchain, key patterns,
  API conventions, akaiutil integration, formatting rules
2026-06-21 19:46:38 -07:00
david 9657aaa523 chore: docker compose, mise.toml, updated toolchain
- Dockerfile: updated to serve mode with web/ embed, expose 8080
- docker-compose.yml: new, maps :8080 and output volume
- Makefile: added serve, akaiutil, electron-* targets
- mise.toml: new, go 1.26 + node 22, all build/run tasks
- .gitignore: exclude built akaiutil binary
2026-06-21 19:46:34 -07:00
david e2dbb66525 feat: web UI + HTTP server + Electron shell
- serve.go: embedded web UI (embed.FS), REST API endpoints for
  search, list, download (SSE progress), and WAV extraction
- main.go: added serve subcommand and flag registration
- web/ui: vanilla JS frontend with search cards, download queue,
  extract controls; dark theme, zero dependencies
- electron/: Electron wrapper that spawns fetch serve as sidecar,
  reads port from stdout, creates BrowserWindow; electron-builder
  config for macOS .app bundle with akaiutil + script as resources

Refs #1, #9
2026-06-21 19:46:30 -07:00
casaos 815d43ee97 WIP 2026-06-21 22:05:18 -04:00
david 9f107b5f80 Initial commit: akai-fetch - AKAI sampler ISO downloader & extractor
- fetch: Go CLI tool for searching, downloading, and extracting
  AKAI sampler ISOs from archive.org
- scripts/extract_wavs.sh: Shell script driving akaiutil to
  convert samples to WAV
- Dockerfile: Multi-stage build packaging akaiutil + fetch
- third_party/akaiutil: Vendored akaiutil v4.6.7 source (GPLv2)
- docs/akaiutil.md: Full akaiutil reference
2026-06-15 22:33:53 -07:00