- Ruby app entry points live at
app.rband config inconfig.rb/config/. - Core domain logic is under
lib/(models, processors, API clients, utilities). - UI assets:
public/(JS/CSS) and server-rendered templates inviews/. - Scripts and ops tasks live in
script/(setup, post processing, deploy, helpers). - Tests are split into unit specs in
spec/and integration-style specs inintegration_spec/.
- Install deps:
bundle install - Initial setup:
bundle exec ruby script/setup.rb - Run the main post-processing flow:
bundle exec ruby script/post_process.rb - Dev server (Sinatra/Puma):
RACK_ENV=development bundle exec ruby app.rb -l- If Redis should start locally, keep
-l; otherwise omit it. - Logs:
data/log/anidb.loganddata/log/dev.stdout.log - Note: Local Redis binding may require escalated permissions (port 6379). If startup fails, rerun with approval.
- Error watch (background):
ruby -e 'log=ARGV[0]; out=ARGV[1]; f=File.open(log); f.seek(0,IO::SEEK_END); File.open(out,"a") { |o| loop { if (line=f.gets); if line.include?("\u001b[31mE") || line.match?(/\bERROR\b|\berror\b|Exception|Traceback/); o.write(line); o.flush; end; else; sleep 0.2; end; } }' data/log/dev.stdout.log data/log/dev.errors.log > /dev/null 2>&1 & - Stop error watch:
kill $(cat data/log/dev.error_watch.pid)(if running) - Stop webserver:
lsof -i :4567thenkill <PID>
- If Redis should start locally, keep
- Run unit specs:
bundle exec ruby spec_runner.rb --pattern './spec/**/*_spec.rb' - Run integration specs:
TEST_INTERFACE=cli bundle exec ruby spec_runner.rb --pattern './integration_spec/**/*_spec.rb'- Requires rbenv init:
eval "$(rbenv init -)" - Requires escalated permissions so Redis can bind/connect
- Requires rbenv init:
- For webserver/web infrastructure changes, run integration specs in web mode:
TEST_INTERFACE=web bundle exec ruby spec_runner.rb --pattern './integration_spec/**/*_spec.rb'
- Local Docker compose (use local build, avoid re-pull):
cd docker-app && ./build.shdocker compose up -d --force-recreatedocker compose downto stop
- Prod deploy (TrueNAS SCALE on
alita):- Build + push multi-arch image:
cd docker-app && ./build.sh --push - SSH to alita and redeploy the app:
midclt call app.redeploy cisqua - Verify status:
midclt call app.get_instance cisqua - Verify version endpoint:
curl -s http://127.0.0.1:4567/version
- Build + push multi-arch image:
- Frontend formatting/linting (configured in
package.json):npx prettier "public/**/*.{js,css}"npx stylelint "public/**/*.css"
- Ruby style follows
.rubocop.yml; prefersnake_casefor methods/vars andCamelCasefor classes/modules. - JS/CSS live in
public/; keep filenames descriptive and aligned to views/features. - Use
spec/andintegration_spec/with filenames ending in_spec.rb.
- Framework: RSpec (see
spec/spec_helper.rbandintegration_spec/spec_helper.rb). - Prefer focused unit specs in
spec/lib/**and broader workflow tests inintegration_spec/. - Name examples for behavior and expected outcomes; keep fixtures under
spec/orspec_util/.
- Commit messages in history are short and descriptive, often lowercase and sometimes prefixed (e.g.,
fix:,chore:,refactor:). Keep subjects concise and action‑oriented. - PRs should include: a brief summary, key behavior changes, and screenshots for UI changes in
public/orviews/.
- Local credentials and options live under
data/(e.g.,data/options.yml); do not commit secrets. - Be cautious with scripts that touch media folders or external services; prefer dry runs when available.
- In this repository, commands prefixed with
gitmay be run without asking for approval. - Initialize rbenv before running Ruby/Bundler commands:
eval "$(rbenv init -)".