docs: update AGENTS.md and README for new features, add JS tests

Docs:
- AGENTS.md: updated toolchain section with js-lint/js-test tasks,
  expanded web/ui/ directory listing, added event delegation and
  Web Audio API to key patterns, updated testing section
- README: marked issue #9 (Audio Preview Player) as done
- .gitignore: added akai-fetch.test and cover.out

Tests:
- Moved groupWavs and cleanName to util.js (pure functions)
- Added 10 new JS tests: 6 groupWavs, 4 cleanName
- Total JS tests: 29 (up from 19)
This commit is contained in:
2026-06-22 02:46:34 -07:00
parent e0bad5e5ac
commit 7124b16fc1
6 changed files with 118 additions and 33 deletions
+24 -1
View File
@@ -24,6 +24,29 @@ function formatTime(secs) {
return m + ':' + s.toString().padStart(2, '0')
}
function groupWavs(paths) {
const libs = {}
for (const p of paths) {
const parts = p.split('/')
let lib, prog, file
if (parts.length === 1) {
lib = ''; prog = parts[0]; file = parts[0]
} else if (parts.length === 2) {
lib = parts[0]; prog = parts[0]; file = parts[1]
} else {
lib = parts[0]; prog = parts[1]; file = parts[parts.length - 1]
}
if (!libs[lib]) libs[lib] = {}
if (!libs[lib][prog]) libs[lib][prog] = []
libs[lib][prog].push({ fullPath: p, name: file.replace(/\.wav$/i, '') })
}
return libs
}
function cleanName(name) {
return name.replace(/_+/g, ' ').trim()
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = { esc, sanitize, formatBytes, formatTime }
module.exports = { esc, sanitize, formatBytes, formatTime, groupWavs, cleanName }
}