From 70ee56848aa2ab821ae0e7c902d97383fe8e6efc Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Mon, 19 Oct 2026 00:10:35 -0500 Subject: [PATCH 1/2] build(nix): add declarative flake.nix devShell with nodejs_22, pnpm, biome, and tea Refs: #1 --- .envrc | 1 + .gitignore | 3 ++- flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 25 ++++++++++++++++++++++ 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 07d8575..dcc6282 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,8 @@ yarn-debug.log* yarn-error.log* pnpm-debug.log* -# Editor +# Editor / Nix direnv .vscode/ .idea/ *.swp +.direnv/ diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9f6b98c --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1791914995, + "narHash": "sha256-Zf/xfQEAasnwnmEfHqW/4hjDE/s44yn2hD4RuVIZRjA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b7a79d3fea1e214f6d668d521cecec0c01e26544", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1792094642, + "narHash": "sha256-zp8ToDMnqZcu4o4IH9pdwXFXGp7yLm/M0dEnNWnyd7I=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fe13242281a67641c0102cdb1087f0ebe586c7df", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c82d09a --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + description = "Armonía del Ser: Admin Dashboard (armonia-dashboard) — Node.js 22 + pnpm + Biome devShell"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShells.default = pkgs.mkShell { + name = "armonia-dashboard-dev-shell"; + packages = with pkgs; [ + nodejs_22 + pnpm + biome + tea + ]; + }; + }); +} From 3f1ab11a5db9299aaf3741c6a1a7e3f3430b4b60 Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Mon, 19 Oct 2026 00:10:35 -0500 Subject: [PATCH 2/2] docs(dashboard): refine AGENTS.md technical blueprint and align README with 48h follow-up workflow - Strip duplicated workspace git/session rules from AGENTS.md and establish local pnpm + Vite+ + Biome gates. - Document 48-hour follow-up queue, payment acknowledgment, delayed-payment authorization, and slot release in README.md. Refs: #1 --- AGENTS.md | 54 ++++++++++++++++++++++++++++++++---------------------- README.md | 39 +++++++++++++++++++++++---------------- 2 files changed, 55 insertions(+), 38 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index eb29665..5eeec92 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,35 +1,45 @@ -# Armonía del Ser: Admin Dashboard - Agent Guidelines & Workflow Rules +# Repository Technical Blueprint: `armonia-dashboard` -This document specifies mandatory workflows, constraints, and quality gates for AI agents operating in `armonia-dashboard`. +This file defines the local toolchain, frontend implementation rules, UX invariants, and security boundaries for `armonia-dashboard`. For cross-repo Git branching rules, TDD lifecycle, or Gitea (`tea`) issue tracking, consult the workspace root [`../AGENTS.md`](../AGENTS.md). --- -## 1. Core Operating Constraints +## 1. Local Toolchain & Nix Environment (`flake.nix` + `pnpm` + `Vite+` + `Biome`) -- **No Direct Commits to `main`**: Agents must never commit directly to `main`. All work must be developed on descriptive feature, bugfix, or chore branches (`feat/*`, `fix/*`, `chore/*`). -- **No Destructive Git Actions**: Commands such as `git reset --hard`, `git restore `, `git clean -fd`, and force-pushes (`git push --force`) are strictly prohibited without the user's explicit yes. -- **Secret Redaction**: Never print, commit, or log sensitive tokens or API credentials. -- **Session Modes**: - - `learning`: The user drives and writes the reasoning, the agent asks guiding questions. - - `delivery`: The agent may draft code and plans, presenting rationale and trade-offs. +This repository is provisioned via a declarative Nix `devShell` (`flake.nix` + `.envrc`) and uses `pnpm`, `Vite+` (`vp`), and `Biome`. +- **Nix DevShell:** Ensure commands run inside the Nix environment (`direnv` activates automatically on `cd`, or prefix with `nix develop -c `). +- **Package Manager:** Use `pnpm` exclusively (`pnpm install`, `pnpm add`). Never use `npm` or `yarn` (do not generate `package-lock.json` or `yarn.lock`). +- **Verification Gates (Pre-Commit Checklist):** + Before proposing or executing any commit, run and pass all checks with zero warnings or errors: + ```bash + pnpm exec biome check . + pnpm exec vp check + pnpm exec vp test + ``` --- -## 2. Agent Directory & Persona Delegation +## 2. Frontend Architecture & Persona Delegation -- **Anne Droid** (`profile/agents/anne-droid.md`): Senior Frontend Engineer & UX Specialist. - - **Consult when**: Designing or reviewing mobile ergonomics, accessible form components, and booking state transitions. - - **Delegate when**: Implementing UI components, Tailwind styling, and client-side interactions on `feat/anne/*` branches. - - **Anti-"Zombie UI" Invariant**: Every view must explicitly design for the 5 states: *Empty*, *Loading*, *Error*, *Partial*, and *Success*. Touch targets must be >= 44x44px for thumb use on mobile devices. +### Anne Droid Delegation (`profile/agents/anne-droid.md`) +- **Consult when:** Designing or reviewing mobile ergonomics, accessible form controls, and operator workflows for booking/payment state transitions. +- **Delegate when:** Implementing UI components, Tailwind CSS styling, HTMX/Vite+ client interactions, and frontend tests on `feat/anne/*` branches. + +### UI & UX Invariants +- **5-State Resilient UI (Anti-"Zombie UI"):** Every operator view and interactive control must explicitly handle all 5 states: *Empty*, *Loading*, *Error*, *Partial* (e.g., booking saved in Turso but Google Calendar sync `FAILED`), and *Success*. +- **Mobile Ergonomics:** Designed mobile-first for Jasmin and her assistant operating on smartphones. All interactive touch targets must be $\ge 44\times 44\text{px}$ with zero layout shift. + +### Security & API Boundary +- **Zero Client Secrets:** Never embed Google OAuth client secrets, Turso tokens, or session signing keys in frontend code or `VITE_*` environment variables. All authentication and `admin_allowlist` checks are enforced server-side by `armonia-api`. --- -## 3. Architecture & Functional Directives +## 3. Core Operator Views & Functional Scope -- **Primary Persona**: Jazmín (therapist and business owner). -- **Core Ergonomic Requirement**: **Mobile-first**. Jazmín checks her banking app (BBVA) on her phone to see incoming SPEI notifications, then switches to the dashboard to tap "Acreditar Pago" in one touch. -- **Key Views**: - 1. *Agenda & Reservas*: Live list of pending vs confirmed bookings with filter toggles. - 2. *Validación de Pagos*: Fast-action review queue for incoming SPEI deposits matching folios (`ADS-XXXX`). - 3. *Directorio de Clientes*: Searchable directory with direct `wa.me` WhatsApp contact links. - 4. *Catálogo de Servicios*: Configuration of prices, schedules, and capacity. +1. **Cola de Seguimiento (48h) & Pagos Pendientes:** Surfaces `RESERVED` bookings within 48 hours where `payment_status = 'AWAITING_ACKNOWLEDGMENT'` (plus any unpaid `DELAYED_ALLOWED` exceptions), providing 1-tap `wa.me` follow-up links and explicit operator actions: + - **Acreditar Pago (`ACKNOWLEDGED`)** + - **Autorizar Pago Diferido (`DELAYED_ALLOWED`)** + - **Liberar Espacio (`RELEASED`)** +2. **Agenda & Sincronización con Google Calendar:** Displays unified booking (`booking_status`) and payment (`payment_arrangement`, `payment_status`) truth alongside Google Calendar sync status (`SYNCED` vs `FAILED` with 1-tap retry). +3. **Control de Paquetes & Asistencia:** Multi-session package progress tracker (e.g., `8 de 10`) and group workshop roster check-in. +4. **Catálogo de Servicios:** Administrative management of service modalities (`PRESENCIAL` / `ONLINE`), capacities, buffers, and MXN pricing. diff --git a/README.md b/README.md index 833f6c4..48d0e7a 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,26 @@ # Armonía del Ser: Admin Dashboard (`armonia-dashboard`) -Mobile-first operational dashboard for **Jazmín**, owner of **Armonía del Ser**. +Mobile-first operational control surface for **Jasmin**, owner of **Armonía del Ser**, and her assistant. -Designed to streamline schedule coordination, client directory tracking, and instant 1-tap SPEI payment acknowledgment without friction. +Designed to provide single-source-of-truth visibility into bookings, 48-hour payment follow-ups, delayed-payment exceptions, deliberate slot releases, and Google Calendar coordination. --- ## The Operational Problem Solved -Currently, Jazmín coordinates bookings via manual chat messages and allows clients to pay after sessions, leading to lost revenue when clients stop responding. - -`armonia-dashboard` equips Jazmín with a dedicated, mobile-optimized tool where she can: -1. **Acknowledge Payments in 1 Tap**: When an SPEI deposit notification appears in her banking app matching a reservation folio (`ADS-XXXX`), she taps "Confirmar Pago" to transition the booking from `PENDING_PAYMENT` to `CONFIRMED`. -2. **Synchronize with Google Calendar**: View locked-in sessions alongside tentative holds. -3. **Contact Clients Directly**: One-touch WhatsApp triggers (`wa.me`) to send session reminders or meeting links. -4. **Manage Services**: Adjust pricing, schedules, and capacity limits (e.g., Círculos de Cacao, Meditaciones con cuencos, Atención Psicológica). +`armonia-dashboard` equips Jasmin and her assistant with an authenticated (`Google OAuth` + server-side Turso allowlist), mobile-optimized control surface where they can: +1. **Monitor the 48-Hour Payment Follow-Up Queue**: View active bookings within 48 hours of their session (or with authorized delayed payments) whose payments have not yet been acknowledged, and contact clients manually via 1-tap `wa.me` links. +2. **Acknowledge Payments (`ACKNOWLEDGED`)**: Record verified SPEI/cash deposits with full auditability (`acknowledged_by`, `acknowledged_at`). +3. **Authorize Delayed-Payment Exceptions (`DELAYED_ALLOWED`)**: Explicitly allow a session to proceed without prepayment while keeping the outstanding balance visible and traceable. +4. **Deliberately Release Slots (`RELEASED`)**: Release an unconfirmed slot after manual follow-up so another client can book the time. +5. **Coordinate with Google Calendar**: Inspect schedule synchronization status (`SYNCED` vs `FAILED`) and retry failed calendar syncs. --- ## Architectural Principles - **Zero-Cost Deployment**: Designed for **Cloudflare Pages** (static edge delivery, $0/month). +- **Server-Enforced Security**: OAuth credentials and session signing secrets live strictly in `armonia-api`, verified on every request against Turso's `admin_allowlist`. - **Mobile Ergonomics**: Large touch targets (minimum 44x44px), thumb-friendly layout, and zero layout shift. - **5-State Resilient UI**: Every component handles *Empty*, *Loading*, *Error*, *Partial*, and *Success* states gracefully. @@ -29,22 +29,29 @@ Currently, Jazmín coordinates bookings via manual chat messages and allows clie ## Local Development Quickstart ### Prerequisites -- Node.js 20+ -- npm +- NixOS / Nix Flakes (`direnv` recommended) or Node.js 22+ & `pnpm` -### 1. Setup Environment +### 1. Enter Nix DevShell & Setup Environment ```bash +direnv allow # or: nix develop cp .env.example .env ``` Set `VITE_API_BASE_URL=http://localhost:8000` to connect to `armonia-api`. ### 2. Install Dependencies ```bash -npm install +pnpm install ``` -### 3. Run Dev Server +### 3. Run Dev Server (`Vite+`) ```bash -npm run dev +pnpm exec vp dev ``` -Open `http://localhost:5173` in your browser. \ No newline at end of file +Open `http://localhost:5173` in your browser. + +### 4. Verification Gates +```bash +pnpm exec biome check . +pnpm exec vp check +pnpm exec vp test +``` \ No newline at end of file