Files
MaalFlows/AGENTS.md
T

3.5 KiB

MaalFlows Agent

Purpose: maintain the MaalFlows live chat widget and admin app.

Project Shape

  • Main application file: server.js.
  • Frontend assets: public/widget.js, public/admin.js, public/admin.css, public/admin.html.
  • Runtime: Node.js without a framework, SQLite through better-sqlite3.
  • Local check command: npm.cmd run check.
  • Production app is proxied by nginx on app.black-week.cz to 127.0.0.1:3400.

Work Rules

  • Read the relevant code before editing.
  • Keep changes small and focused on the user's request.
  • Do not touch .agents/sogo-mail-filter-agent.md or docs/mail-sogo-* files unless the task is explicitly about SOGo mail filters.
  • Preserve existing user changes. Do not reset, checkout, or delete unrelated work.
  • For language/translation changes, protect conversation-level customer language from short greetings, product names, SKUs, colors, and other language-neutral text.

Verification

Before finishing a code change, run:

npm.cmd run check

If a broader behavioral change is made, add or run the smallest practical extra verification for that area.

Git Workflow

Project remote:

https://git.ma-al.com/rajch_ales/MaalFlows.git

The main branch is main.

After each completed project code change:

  1. Review git diff.
  2. Stage only files that belong to the change.
  3. Commit with a concise message.
  4. Push the current branch to origin.
  5. Report what was changed, what was verified, and whether the push succeeded.

Do not stage unrelated untracked files such as historical audits, screenshots, exports, or mail-filter documentation unless the user explicitly asks for them.

If Git authentication is needed, this project follows the same HTTPS credential style as D:\Codex\01-projekty\catalog-meaker-by-magic-ai: read GIT_USERNAME and GIT_PASSWORD from that project's local .env only for the command that needs them. Never print those values, commit them, save them into origin, or leave credentials embedded in Git config.

Production Update

After a successful push, update the production server.

Production details:

Host: app.black-week.cz
SSH user: root
SSH key: C:/Users/DELL/.ssh/druhakapitola_hetzner
App directory: /var/www/maalflows
PM2 process: maalflows
Public URL: https://app.black-week.cz/admin

Deploy workflow:

  1. SSH to root@app.black-week.cz with the druhakapitola_hetzner key.
  2. In /var/www/maalflows, check git status --short first. Stop if there are unexpected local changes.
  3. Ensure server origin is https://git.ma-al.com/rajch_ales/MaalFlows.git.
  4. Fetch origin main. If HTTPS credentials are required, provide them via a one-command temporary credential helper from the local catalog project's .env; do not store credentials on the server.
  5. Run git merge --ff-only FETCH_HEAD.
  6. Run npm install --omit=dev.
  7. Run npm run check.
  8. Run pm2 restart maalflows.
  9. Run pm2 save.
  10. Verify:
cd /var/www/maalflows && git status --short
cd /var/www/maalflows && git log -1 --oneline
pm2 describe maalflows
curl -s -o /dev/null -w '%{http_code} %{content_type}\n' http://127.0.0.1:3400/admin
curl -s -o /dev/null -w '%{http_code} %{content_type}\n' http://127.0.0.1:3400/widget.js
curl -k -s -o /dev/null -w '%{http_code} %{content_type}\n' https://app.black-week.cz/admin

Expected verification: PM2 status online, local /admin and /widget.js return 200, public HTTPS /admin returns 200, and the server worktree is clean.