Compare commits
122
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ec5714676 | ||
|
|
a68fb94b61 | ||
|
|
e3ec6a9ac3 | ||
|
|
a3d6cbe404 | ||
|
|
66b169cf06 | ||
|
|
63150ed115 | ||
|
|
b8d1b0ac25 | ||
|
|
247595e064 | ||
|
|
e9b934806f | ||
|
|
9bb5ea8d37 | ||
|
|
6b39075403 | ||
|
|
c225967892 | ||
|
|
a970826cb0 | ||
|
|
550e45795b | ||
|
|
1e0742a548 | ||
|
|
0c5888761b | ||
|
|
9f8d5c4ed2 | ||
|
|
7e03d9ae4c | ||
|
|
c0933e6ef8 | ||
|
|
3a8b2eb727 | ||
|
|
3505806358 | ||
|
|
c6a4bd9bc9 | ||
|
|
784ed5719b | ||
|
|
8347770db0 | ||
|
|
5f9a53ed18 | ||
|
|
526f413bfd | ||
|
|
abe5e137e6 | ||
|
|
e27134e57e | ||
|
|
d0dafa8471 | ||
|
|
c468585ab9 | ||
|
|
13b722e945 | ||
|
|
ba603ee09b | ||
|
|
3e06371899 | ||
|
|
3ab3ce480b | ||
|
|
c96f1f8398 | ||
|
|
42ae2f0ebb | ||
|
|
ae81f34109 | ||
|
|
dc7a777d9f | ||
|
|
104756db7f | ||
|
|
94640e4d9c | ||
|
|
8dd8208d18 | ||
|
|
2fd5c9bc8b | ||
|
|
facc5db641 | ||
|
|
af45b23750 | ||
|
|
2bb9f122d5 | ||
|
|
8687ae28a2 | ||
|
|
477b1a9b78 | ||
|
|
a6f7b07a69 | ||
|
|
c1be3a586b | ||
|
|
b3331d5279 | ||
|
|
98ac9859c7 | ||
|
|
bff08edafe | ||
|
|
acd1ff2ed9 | ||
|
|
329e2e3403 | ||
|
|
822646a82a | ||
|
|
32b6643fbc | ||
|
|
0eb6594acc | ||
|
|
ef93cec935 | ||
|
|
3a5d272b0f | ||
|
|
1569efd9a7 | ||
|
|
b96e77606c | ||
|
|
ca4d447d73 | ||
|
|
183b304687 | ||
|
|
dac55d9d0b | ||
|
|
2165551711 | ||
|
|
678fa3ba7e | ||
|
|
e8ff7adeb5 | ||
|
|
38d34fab4c | ||
|
|
829f543962 | ||
|
|
9b5ca94030 | ||
|
|
00cf09270d | ||
|
|
0637a9ba64 | ||
|
|
bcdcfdc59c | ||
|
|
4ead784f52 | ||
|
|
0ce231edb4 | ||
|
|
46bce2f1fd | ||
|
|
b5a8936f42 | ||
|
|
2ad3e75c87 | ||
|
|
d699bf4787 | ||
|
|
758ee2cfed | ||
|
|
3573d2accb | ||
|
|
1bf32dd076 | ||
|
|
e2b0c62628 | ||
|
|
a7e0530068 | ||
|
|
bf6c8f7abd | ||
|
|
d2f960207e | ||
|
|
d60c38f65a | ||
|
|
314b129259 | ||
|
|
c07ec2298c | ||
|
|
d207e5653e | ||
|
|
02a73b3702 | ||
|
|
74e40329a0 | ||
|
|
3f72d714df | ||
|
|
265b656df9 | ||
|
|
00d2b82877 | ||
|
|
729268a3fe | ||
|
|
94647d5293 | ||
|
|
d8cccc1a65 | ||
|
|
1b3ae07811 | ||
|
|
19622d9703 | ||
|
|
12b2711168 | ||
|
|
21a0d73639 | ||
|
|
d445f0f31a | ||
|
|
b5590175b7 | ||
|
|
d6f3dda9e5 | ||
|
|
594865ea9a | ||
|
|
8407b45367 | ||
|
|
71ab1e08ac | ||
|
|
fb11eff18b | ||
|
|
30f271651a | ||
|
|
6589289878 | ||
|
|
1b587ac373 | ||
|
|
776fa66bc8 | ||
|
|
928439bc7b | ||
|
|
1c9e231a16 | ||
|
|
329269aeb1 | ||
|
|
17c6d63ae3 | ||
|
|
570f4b45e5 | ||
|
|
91a9d97a59 | ||
|
|
72a5a10476 | ||
|
|
c4e3d91640 | ||
|
|
a3d7e9ce75 |
+17
-4
@@ -13,6 +13,7 @@
|
||||
|
||||
- **Projekt neve**: websitedev (mozdIT Bt. weboldal)
|
||||
- **Plane workspace**: `developments` (pm.llmdev.mozdit.hu)
|
||||
- **Plane MCP**: kizárólag a `plane-developments_*` eszközöket használd. A `plane-priws_*` kapcsolat más workspace slugot (`priws`) használ, és MITHOME műveletekhez hibás.
|
||||
- **Plane projekt**: `WebSite Dev` — azonosító: `MITHOME`, ID: `643f7055-1237-4912-912f-99ec49fd0f0e`
|
||||
- **Típus**: Marketing weboldal fejlesztési projekt
|
||||
- **Elsődleges nyelv**: Magyar (kommunikáció, weboldal tartalom, dokumentáció), Angol (kód, kommentek, commit üzenetek)
|
||||
@@ -74,16 +75,29 @@ sync: update Plane issues + TODO [leírás]
|
||||
|
||||
---
|
||||
|
||||
## 3.6 Specifikációvezérelt fejlesztés (OpenSpec)
|
||||
|
||||
- Az OpenSpec a nagyobb feature-ök, API-/adatmodell-változások és architekturális döntések specifikációinak, illetve megvalósítási tervének helye.
|
||||
- OpenCode workflow-k: `/opsx-explore`, `/opsx-propose`, `/opsx-apply`, `/opsx-update`, `/opsx-sync`, `/opsx-archive`.
|
||||
- Kis, elszigetelt bugfixeknél használható közvetlenül a `.agent/workflows/fix-bug.md`.
|
||||
- A Plane MITHOME marad az authoritative task- és státuszforrás; a `TODO.md` továbbra is annak lokális tükre. Az OpenSpec `tasks.md` nem helyettesíti a Plane/TODO szinkront.
|
||||
- Konfiguráció és specifikációk: `openspec/config.yaml`, `openspec/specs/`, `openspec/changes/`.
|
||||
|
||||
## 4. Projekt struktúra
|
||||
|
||||
```
|
||||
websitedev/
|
||||
├── proto/ # Fő Next.js alkalmazás (itt futtatsd a parancsokat!)
|
||||
│ ├── src/
|
||||
│ │ ├── app/ # Next.js App Router (pages és API routes)
|
||||
│ │ ├── app/
|
||||
│ │ │ ├── (frontend)/ # Publikus oldalak: [locale]/[slug] catch-all
|
||||
│ │ │ └── (payload)/ # Payload admin (/admin) + REST/GraphQL API
|
||||
│ │ ├── components/ # React komponensek (Header, Footer, ThemeProvider)
|
||||
│ │ ├── content/ # JSON tartalom-kezelő rendszer
|
||||
│ │ ├── lib/ # Utility könyvtárak (MongoDB, Logger, Site Config)
|
||||
│ │ ├── globals/ # Payload Globals (Home, About, Services, Contact, Common)
|
||||
│ │ ├── collections/ # Payload Collections (LegalPages, Partners, Media, ContactSubmissions, Users)
|
||||
│ │ ├── payload.config.ts # Payload CMS konfiguráció
|
||||
│ │ ├── content/ # RÉGI JSON rendszer — csak migrációs seed + teszt-fixture (MITHOME-91/93/96)
|
||||
│ │ ├── lib/ # payload-content.ts (Local API adapter), content-transfer, Logger
|
||||
│ │ ├── config/ # Statikus site konfiguráció
|
||||
│ │ └── types/ # TypeScript típusdefiníciók
|
||||
│ └── public/ # Statikus fájlok
|
||||
@@ -279,7 +293,6 @@ Az `.agent/workflows/` mappában találhatók az elérhető slash command workfl
|
||||
| --- | --- |
|
||||
| `/new-feature` | Új funkció fejlesztési folyamata |
|
||||
| `/fix-bug` | Hibajavítás folyamata |
|
||||
| `/cms-feature` | CMS (Content Editor) fejlesztési folyamata |
|
||||
| `/review` | Kód review checklist |
|
||||
| `/deploy` | Deployment folyamata |
|
||||
|
||||
|
||||
@@ -8,12 +8,13 @@ Ez a fájl minden interakcióban automatikusan betöltődik az AI számára a pr
|
||||
|
||||
## Rendszer áttekintés
|
||||
|
||||
A projekt egy **Next.js 15 alapú marketing weboldal** a mozdIT Bt. számára, App Router architektúrával, TypeScript-tel és Tailwind CSS 4-gyel.
|
||||
A projekt egy **Next.js 15 alapú marketing weboldal** a mozdIT Bt. számára, App Router architektúrával, TypeScript-tel és Tailwind CSS 4-gyel, **Payload CMS**-sel (self-hosted, `/admin`) mint tartalomkezelő réteggel (MITHOME-85 epic).
|
||||
|
||||
- **Frontend**: Next.js 15 App Router (SSR/SSG), React 19, Tailwind CSS 4
|
||||
- **Backend**: Next.js API Routes (`/api/*`)
|
||||
- **Adatbázis**: MongoDB (Mongoose ODM) — site config és contact form logok
|
||||
- **Logging**: Winston + Loki (strukturált naplózás)
|
||||
- **Frontend**: Next.js 15 App Router (dinamikus renderelés — lásd MITHOME-97 WHY: SSG helyett, hogy egy admin publikálás azonnal látszódjon), React 19, Tailwind CSS 4
|
||||
- **CMS**: Payload CMS — Globals (Home/About/Services/Contact/Common) + Collections (LegalPages/Partners/Media/ContactSubmissions/Users), hu/en lokalizáció, draft/publish + verziózás
|
||||
- **Backend**: Next.js API Routes (`/api/*`), Payload REST/GraphQL API + Local API
|
||||
- **Adatbázis**: PostgreSQL 16 (MITHOME-136, mitplatform ADR-0001) — Payload `postgresAdapter`, UUID-azonosítók, a séma csak migrációval változik (`proto/src/migrations/`, `push: false`). Egy PostgreSQL-szerver, a weboldalnak saját adatbázisa van (`mozdit_web`)
|
||||
- **Logging**: Winston strukturált szerveroldali naplózás stdout/stderr kimenetre; a központi gyűjtés hostoldali collector feladata, külön Hosting-infrastruktúra.
|
||||
- **Infrastructure**: Docker + Docker Compose, natív deploy (`deploy.sh`)
|
||||
|
||||
## Rétegek és Felelősségek
|
||||
@@ -24,17 +25,18 @@ A projekt egy **Next.js 15 alapú marketing weboldal** a mozdIT Bt. számára, A
|
||||
| **Component** | Újrahasználható UI elemek | `proto/src/components/` |
|
||||
| **API Route** | Route handling, validáció | `proto/src/app/api/` |
|
||||
| **Service/Lib** | Üzleti logika, DB kapcsolat | `proto/src/lib/` |
|
||||
| **Content** | JSON alapú tartalom | `proto/src/content/` |
|
||||
| **Content** | Payload CMS Globals/Collections (admin: `/admin`), Local API adapter | `proto/src/globals/`, `proto/src/collections/`, `proto/src/lib/payload-content.ts` |
|
||||
| **Config** | Statikus site konfiguráció | `proto/src/config/` |
|
||||
| **Agent / Tools** | AI ügynökök eszközei | `.agent/` |
|
||||
|
||||
## Fontos Architektúra Szabályok
|
||||
|
||||
1. **Tartalom JSON-ban**: SOHA ne égess be szöveget közvetlenül komponensbe — használd a `src/content/` rendszert.
|
||||
1. **Tartalom Payload-ban**: SOHA ne égess be szöveget közvetlenül komponensbe — a tartalom Payload Global/Collection mezőkben él, az ügyfél a `/admin` felületen szerkeszti, a frontend a `src/lib/payload-content.ts` adapteren (Payload Local API) keresztül olvassa. (Kivétel: `proto/src/content/*.json` még mindig létezik, de csak a `migrate-content-to-payload.ts` seed-script forrásaként és néhány komponens-teszt fixture-jeként — élő oldal nem olvassa közvetlenül, lásd MITHOME-91/93/96.)
|
||||
2. **Stateless API**: A backend API teljesen stateless — session-t a kliens kezel.
|
||||
3. **Observability**: Minden hiba legyen logolva Winstonnal. API válaszok egységes formátumban: `{ success, data, error }`.
|
||||
3. **Observability**: Minden szerveroldali hiba legyen logolva strukturált Winston-bejegyzésként stdout/stderr-re; az alkalmazás ne küldjön közvetlenül távoli logszolgáltatásnak. API-válaszok egységes formátuma: `{ success, data, error }`.
|
||||
4. **Security-by-design**: Input validáció minden API route-on, secrets csak env változókból.
|
||||
5. **Component-first**: Komponensek Server Component-ek alapértelmezetten — csak indokolt esetben adj `"use client"` direktívát.
|
||||
5. **Külső linkek mindig új lapon** (MITHOME-124, általános szabály): minden más hostra mutató http(s) link `target="_blank"` + `rel="noopener noreferrer"` attribútumot kap. Belső útvonal, `mailto:` és `tel:` ugyanazon a lapon marad. A döntés **a címből** születik, sosem kézi kapcsolóból: JSX-ben `<a href={href} {...externalLinkProps(href)}>`, CMS-ből érkező HTML-nél `openExternalLinksInNewTab(html)` (`proto/src/lib/external-link.ts`). Kézzel írt `target="_blank"` vagy „external” mező ne kerüljön a kódba.
|
||||
6. **Component-first**: Komponensek Server Component-ek alapértelmezetten — csak indokolt esetben adj `"use client"` direktívát.
|
||||
|
||||
## Adatfolyam (Request Lifecycle)
|
||||
|
||||
@@ -42,7 +44,7 @@ A projekt egy **Next.js 15 alapú marketing weboldal** a mozdIT Bt. számára, A
|
||||
2. **Next.js middleware**: Auth ellenőrzés (ha szükséges)
|
||||
3. **API Route**: Input validáció
|
||||
4. **Lib/Service**: Üzleti logika végrehajtása
|
||||
5. **MongoDB**: Adatbázis művelet
|
||||
5. **PostgreSQL** (Payload Local API-n át): Adatbázis művelet
|
||||
6. **Responder**: Egységes formátumú JSON válasz
|
||||
|
||||
## Design System szabályok
|
||||
@@ -52,19 +54,41 @@ A projekt egy **Next.js 15 alapú marketing weboldal** a mozdIT Bt. számára, A
|
||||
- Animációk: `globals.css`-ben definiált utility osztályok (`.card`, `.btn`, `.icon-container`)
|
||||
- Reszponzivitás: mobile-first, breakpoint-ok: 360px, 640px, 768px, 1024px, 1280px+
|
||||
|
||||
## SEO (MITHOME-116)
|
||||
|
||||
- Minden publikus oldal `generateMetadata`-ja `alternates: pageAlternates(locale, pageKey)`-t ad: saját canonical + hreflang `hu`/`en`/`x-default` (a magyar oldal). Új oldal felvételekor a `PAGE_SLUGS`-ba kell tenni, így a sitemapbe és a hreflang-párokba is automatikusan bekerül (`proto/src/lib/seo.ts`).
|
||||
- `/sitemap.xml` és `/robots.txt` a `proto/src/app/sitemap.ts` és `robots.ts` fájlból jön. Felhasználói döntés: minden oldal mindkét nyelve szerepel, az angol jóváhagyási állapottól (MITHOME-113) függetlenül.
|
||||
- A staging (`NEXT_PUBLIC_DEPLOY_ENV=staging`) sosem indexelhető: a `robots.txt` mindent tilt, a sitemap üres, és minden oldal `noindex` metát kap. A `NEXT_PUBLIC_*` értékek build időben égnek be, ezért a site URL-nek és a deploy-környezetnek build-argumentumként is meg kell lennie (Dockerfile).
|
||||
|
||||
## Content Management
|
||||
|
||||
```typescript
|
||||
// Helyes: content rendszer használata
|
||||
import { content, getPageContent } from '@/content'
|
||||
const pageData = content.pages.about
|
||||
// Helyes: Payload Local API adapter használata (Server Component-ben)
|
||||
import { getAboutContent } from '@/lib/payload-content'
|
||||
const about = await getAboutContent(locale) // locale: 'hu' | 'en'
|
||||
|
||||
// TILOS: közvetlen szöveg komponensben
|
||||
<h1>Rólunk</h1>
|
||||
```
|
||||
|
||||
Az ügyfél a tartalmat a Payload admin felületen (`/admin`) szerkeszti —
|
||||
Global (pl. Home, About) vagy Collection (pl. LegalPages, Partners) dokumentum
|
||||
formájában, "Save Draft"/"Publish changes" munkafolyamattal (MITHOME-92). Új
|
||||
mező felvételekor a megfelelő `proto/src/globals/*.ts` vagy
|
||||
`proto/src/collections/*.ts` fájlt bővítsd, majd generáld újra a típusokat
|
||||
(`payload generate:types`).
|
||||
|
||||
Ha egy meglévő mező tárolási alakja változik (pl. utólagos `localized: true`),
|
||||
a meglévő adatot **Payload migrációval** kell átalakítani
|
||||
(`proto/src/migrations/`, regisztrálva az `index.ts`-ben). A migráció
|
||||
productionben induláskor automatikusan fut (`prodMigrations`). A JSON-seed
|
||||
újrafuttatása tilos erre a célra, mert felülírná az admin-szerkesztéseket
|
||||
(MITHOME-111). Lokalizációs retrofithez a `proto/src/lib/localize-paths.ts`
|
||||
helperek használhatók. A `src/migrations/` mappába csak migrációs fájl
|
||||
kerüljön, mert a Payload CLI minden `.ts` fájlt migrációnak tekint.
|
||||
|
||||
## Dependency szabályok
|
||||
|
||||
- Új NPM package bevezetéséhez **jóváhagyás szükséges**
|
||||
- Előnyben részesítjük a Next.js beépített megoldásait (Image, Link, Font, stb.)
|
||||
- MongoDB driver helyett Mongoose ODM-et használunk
|
||||
- Adatbázis-hozzáférés a Payload Local API-n át; nyers SQL csak migrációban és ellenőrző tesztben
|
||||
|
||||
@@ -76,9 +76,8 @@ git commit -m "fix(<scope>): <mi volt a hiba és hogyan lett javítva>"
|
||||
|
||||
## Felhasználói dokumentáció karbantartása
|
||||
|
||||
- A CMS **❓ Súgó** menüpontja a `docs/felhasznaloi-utmutato.md` fájlt rendereli (`/guide`).
|
||||
- **Kötelező**: minden CMS- vagy honlapfunkció változtatásánál (új gomb, viselkedésváltozás, útvonal) ugyanabban a commitban frissítsd az útmutatót.
|
||||
- Támogatott markdown forma a `scripts/markdown-render.js` részhalmaza: címsorok, **félkövér**, `kód`, listák, linkek, `---` elválasztók (táblázat nem).
|
||||
- A régi egyedi CMS-nek (`content-editor.js`, saját **❓ Súgó** menüponttal, `docs/felhasznaloi-utmutato.md`) volt saját, karbantartott felhasználói útmutatója — ezt a Payload CMS-re állás után leépítettük (MITHOME-93). A Payload admin felület (`/admin`) saját, upstream dokumentációval rendelkezik; ügyfél-facing Payload-specifikus útmutató készítése külön feladat (MITHOME-95), ha szükséges.
|
||||
- **Kötelező**: minden honlapfunkció-változtatásnál (új útvonal, viselkedésváltozás) ellenőrizd, hogy a `docs/` alatti releváns dokumentáció ne legyen elavult.
|
||||
|
||||
## Nyelvhasználat
|
||||
|
||||
@@ -143,8 +142,9 @@ const rateLimitStore = new Map<string, number[]>();
|
||||
// DECISION: fire-and-forget MongoDB write — ne várakozzon a válasz a cache írásra
|
||||
dbClient.logContact(data).catch(() => null);
|
||||
|
||||
// TRADEOFF: JSON content management vs CMS — könnyebb deploy, de nem non-tech szerkeszthető
|
||||
const content = await import('@/content/pages/home.json');
|
||||
// TRADEOFF: Payload Local API vs statikus JSON import — élő, adminból
|
||||
// szerkeszthető tartalom, cserébe minden kérésnél DB-olvasás kell (MITHOME-97)
|
||||
const content = await getHomeContent(locale);
|
||||
```
|
||||
|
||||
## Pre-modification kockázatbecslés
|
||||
|
||||
+31
-22
@@ -9,9 +9,9 @@ Ez a fájl automatikusan betöltődik tesztfájlok érintésekor, és segít a t
|
||||
|
||||
## Stratégia és Prioritások
|
||||
|
||||
1. **Unit tesztek**: Logikai egységek, tiszta függvények, komponensek tesztelése (`jest.config.unit.js`)
|
||||
2. **Browser integration**: jsdom + mocked API-k (`jest.config.js`)
|
||||
3. **Docker integration**: Valódi HTTP hívások a futó Docker stack-hez (`jest.config.integration.js`)
|
||||
1. **Unit tesztek**: Logikai egységek, tiszta függvények, komponensek tesztelése (`jest.config.unit.cjs`)
|
||||
2. **Browser integration**: jsdom + mocked API-k (`jest.config.cjs`)
|
||||
3. **Docker integration**: Valódi HTTP hívások a futó Docker stack-hez (`jest.config.integration.cjs`)
|
||||
4. **E2E tesztek**: Teljes user flow-ok (`src/__tests__/e2e-docker.test.ts`)
|
||||
|
||||
## Elvárások
|
||||
@@ -22,7 +22,7 @@ Ez a fájl automatikusan betöltődik tesztfájlok érintésekor, és segít a t
|
||||
- Utility függvények: **>90%**
|
||||
- API endpoint-ok: minden happy path + fő error case-ek
|
||||
- A tesztek legyenek **izoláltak** és **determinisztikusak**.
|
||||
- Használj mock-okat a külső függőségekhez (MongoDB, Loki, HTTP hívások).
|
||||
- Használj mock-okat a külső függőségekhez (adatbázis, Loki, HTTP hívások).
|
||||
|
||||
## Elnevezési konvenciók
|
||||
|
||||
@@ -38,12 +38,13 @@ Ez a fájl automatikusan betöltődik tesztfájlok érintésekor, és segít a t
|
||||
## Futtatás (`proto/` mappából)
|
||||
|
||||
```bash
|
||||
npm test # unit tesztek (alapértelmezett, jest.config.unit.js)
|
||||
npm test # unit tesztek (alapértelmezett, jest.config.unit.cjs)
|
||||
npm run test:watch # watch mode
|
||||
npm run test:coverage # lefedettség riport
|
||||
npm run test:browser # browser integration
|
||||
npm run test:integration # Docker integration (Docker kell!)
|
||||
npm run test:e2e # E2E tesztek (Docker kell!)
|
||||
npm run test:payload # Payload Local API integráció (élő PostgreSQL + tartalom kell!)
|
||||
npm run test:all # teljes proto suite
|
||||
npm run test:smoke:staging # Playwright smoke a staging ellen
|
||||
```
|
||||
@@ -77,22 +78,30 @@ Minden deploy előtt az **egyetlen belépési pont** futtatandó:
|
||||
scripts/pre-deploy-tests.sh
|
||||
```
|
||||
|
||||
Ez lefedi: proto unit + `tsc --noEmit` + `eslint`, content séma-validáció, a CMS
|
||||
integrációs tesztjei (`scripts/test-content-editor-*.js`), a publish-teszt és a
|
||||
Ez lefedi: proto unit + `tsc --noEmit` + `eslint`, content séma-validáció és a
|
||||
Plane-sync unit tesztek. Bármelyik hibája megszakítja a kiadást.
|
||||
|
||||
A CMS (content-editor.js) tesztjei külön is futtathatók (valódi szervert indítanak):
|
||||
|
||||
```bash
|
||||
node scripts/test-content-editor-security.js # auth, CSRF, XFF
|
||||
node scripts/test-content-editor-serializer.js # collect/reindex regresszió
|
||||
node scripts/test-content-editor-save.js # atomikus mentés + validáció
|
||||
node scripts/test-content-editor-conflict.js # optimista zárolás (409)
|
||||
node scripts/test-content-editor-versions.js # verziók panel (diff, restore)
|
||||
node scripts/test-content-editor-logo.js # logó feltöltés
|
||||
node scripts/test-content-editor-login.js # login flow (session, Safari)
|
||||
node scripts/test-content-editor-logout.js # logout + rate-limit
|
||||
node scripts/test-content-editor-guide.js # /guide + markdown renderer
|
||||
node scripts/test-content-editor-bottombar.js # alsó sáv layout guard
|
||||
node scripts/test-cms-publish.js # publish parancs + integráció
|
||||
```
|
||||
> A régi egyedi CMS (content-editor.js) saját teszt-szkriptjeit (auth, CSRF,
|
||||
> serializer, optimista zárolás, verziók panel, logó feltöltés, login/logout,
|
||||
> guide, publish) a Payload CMS-re állás után (MITHOME-93) eltávolítottuk —
|
||||
> a Payload admin felület a saját upstream tesztelésével fedett, ezt itt nem
|
||||
> duplikáljuk.
|
||||
>
|
||||
> **MITHOME-96**: Payload collection/global config tesztek —
|
||||
> `src/payload-config.test.ts` (a `npm test`/pre-deploy suite része, nincs
|
||||
> hozzá élő DB, csak a Collection/Global config objektumokat vizsgálja —
|
||||
> köztük két, MITHOME-121-ben talált éles hibára regresszió-őrt: a Media
|
||||
> publikus olvashatósága, a Partners.logo opcionalitása). A Local API elleni,
|
||||
> élő adatbázist igénylő tesztek külön scriptben vannak
|
||||
> (`scripts/test-payload-local-api.ts`, `npm run test:payload`) — WHY nem
|
||||
> Jest: a `payload` csomag ESM-only dist-et ad ki, amit a next/jest
|
||||
> transzform alapból nem fordít le (a teljes függőségi fa
|
||||
> `transformIgnorePatterns`-be vétele törékeny lenne), ezért ugyanazt a
|
||||
> bevált `node --import tsx` mintát követi, mint `migrate-content-to-payload.ts`.
|
||||
> Nincs a `pre-deploy-tests.sh`-ban (élő, tartalommal feltöltött adatbázis kell hozzá,
|
||||
> mint a régi, eltávolított CMS-teszteknek is), de a `npm run test:payload`
|
||||
> paranccsal bármikor lefuttatható egy futó dev PostgreSQL ellen (MITHOME-136). A régi,
|
||||
> Docker-stack-hez kötött `integration.test.ts`/`e2e-docker.test.ts` is
|
||||
> frissítve lett a locale-prefixes útvonalakra és a Payload collection-nevekre
|
||||
> (korábban a pre-Payload, unprefixelt útvonalakra és `site_config`/
|
||||
> `contact_submissions` nyers Mongo collection-ökre hivatkoztak).
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
---
|
||||
description: CMS (Content Editor) fejlesztési munkafolyamata — módosítástól a staging élesítésig
|
||||
---
|
||||
|
||||
# CMS Fejlesztési Workflow (/cms-feature)
|
||||
|
||||
A `content-editor.js`, a hozzá tartozó scriptek (`scripts/markdown-render.js`, `scripts/test-content-editor-*.js`) és a CMS-en keresztül szerkeszthető tartalmi sémák (`proto/src/content/schema.js`) módosításakor kövesd ezt a folyamatot.
|
||||
|
||||
A szabály (a *miért*): `.agent/steering/development-rules.md` → „Felhasználói dokumentáció karbantartása". Ez a fájl a *hogyan*-t írja le.
|
||||
|
||||
---
|
||||
|
||||
## 1. Tervezés
|
||||
|
||||
- Fogalmazd meg, mi változik a felhasználó szemszögéből (új gomb? más viselkedés? új hibaüzenet?)
|
||||
- **Új endpoint vagy UI elem esetén**: tervezd meg az útmutató érintett szakaszának frissítését is.
|
||||
- Content séma (`schema.js`) változásnál ellenőrizd, hogy a meglévő JSON fájlok mind átmegyek az új sémán.
|
||||
|
||||
## 2. Implementáció
|
||||
|
||||
- A CMS system Nodeon fut, **nincs node_modules** — csak beépítő modulokat használj (`http`, `fs`, `path`, `crypto`, `child_process`).
|
||||
- Fájlméret: a `content-editor.js` közelít a 300 soros soft limit felé — nagyobb funkciót szervezz ki külön modulba (pl. `scripts/markdown-render.js` minta).
|
||||
- Biztonsági követelmények:
|
||||
- Minden új POST endpoint **CSRF token ellenőrzéssel**.
|
||||
- Új GET endpoint **auth után** serviced (kivétel: `/logout` minta).
|
||||
- User input escape-elés (lásd `escapeHtml` a markdown rendererben).
|
||||
- Titok soha nem kerül kimenetre — válaszkóddal (401/200) igazolj.
|
||||
|
||||
## 3. Útmutató frissítése (KÖTELEZŐ, ugyanabban a commitban)
|
||||
|
||||
- Forrás: `docs/felhasznaloi-utmutato.md` — a felhasználó nyelvén, nem műszaki részletekkel.
|
||||
- Új UI elem → felület áttekintés szakasz + adott funkció szakasz frissítése.
|
||||
- Támogatott markdown részhalmaz: címsorok, **félkövér**, `kód`, listák, linkek, `---` (táblázat nem — a `scripts/markdown-render.js` nem jeleníti meg).
|
||||
|
||||
## 4. Tesztek
|
||||
|
||||
Minden CMS-változtatás után futtasd mindet:
|
||||
|
||||
```bash
|
||||
node --check content-editor.js
|
||||
node scripts/test-content-editor-security.js # auth, CSRF, XFF
|
||||
node scripts/test-content-editor-serializer.js # collect/reindex regresszió
|
||||
node scripts/test-content-editor-save.js # atomic save + validáció
|
||||
node scripts/test-content-editor-logout.js # /logout viselkedés
|
||||
node scripts/test-content-editor-guide.js # /guide + Súgó link
|
||||
```
|
||||
|
||||
- Új funkcióhoz **új tesztfájl** a fenti minta szerint (valós szervert indító integration teszt ajánlott).
|
||||
- Content séma változásnál: `node scripts/test-content-schema.js` is.
|
||||
|
||||
## 5. Commit
|
||||
|
||||
```bash
|
||||
git add content-editor.js scripts/ docs/felhasznaloi-utmutato.md
|
||||
git commit -m "feat(cms): <rövid leírás>" # vagy fix(cms):
|
||||
```
|
||||
|
||||
- Az útmutató frissítése **ugyanabban a commitban** landol, mint a funkció.
|
||||
- Plane ticket (`Closes MITHOME-XX`) + `node plane-sync.js --yes` a TODO.md szinkronhoz.
|
||||
|
||||
## 6. Staging élesítés és ellenőrzés
|
||||
|
||||
A CMS a websitetől **független szolgáltatás** — deploy szkript nélkül, közvetlenül élesítjük:
|
||||
|
||||
```bash
|
||||
ssh sadmin@llmdev.mozdit.hu '
|
||||
cd /home/sadmin/websitedev && git pull --ff-only origin main &&
|
||||
sudo systemctl restart mozdit-content-editor.service &&
|
||||
systemctl is-active mozdit-content-editor.service'
|
||||
```
|
||||
|
||||
Ellenőrzés (a hitelesítő adatokat az `/etc/mozdit-content-editor.env`-ből olvasd, **soha ne írd ki**):
|
||||
|
||||
```bash
|
||||
# kulcs nélkül 401-et várunk
|
||||
curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:4001/
|
||||
# hitelesített kérést sudo sh -c ". /etc/mozdit-content-editor.env; curl -u ..." mintával futtass
|
||||
```
|
||||
|
||||
- Az érintett funkciókra vonatkozó válaszkódok ellenőrzése (401/200/429 stb.).
|
||||
- Ha a honlap (`proto/`) is változott: `./scripts/deploy_to_stage_on_local.sh` a teljes deployhoz.
|
||||
|
||||
## 7. Bezárás
|
||||
|
||||
- Plane ticket → Done.
|
||||
- `node plane-sync.js --yes` + `git commit -m "sync: ..."` + push.
|
||||
@@ -7,9 +7,9 @@ description: Deployment munkafolyamata — lokális teszttől a stagingen át a
|
||||
## Architektúra áttekintés
|
||||
|
||||
- **Nincs Dokploy / registry push** — a deploy natív Docker Compose-zal, a szerveren buildelve történik.
|
||||
- **Környezetenként külön compose fájl**: `docker-compose.staging.yml` (app: 127.0.0.1:8081, saját Mongo) és `docker-compose.prod.yml` (app: 8080). A két környezet ugyanazon a hoston, külön hálózaton és volume-mal fut.
|
||||
- **Környezeti változók**: kötelező `.env.staging` / `.env.production` fájlból jönnek (minta: `.env.staging.example`, `.env.production.example`). Bizalmas értékeknek (MONGO_ROOT_PASSWORD, MONGODB_URI) **nincs fallback** — hiányzó env hangosan hibázik.
|
||||
- **Staging megkülönböztetés**: a `NEXT_PUBLIC_DEPLOY_ENV=staging` build arg amber banner-t jelenít meg a weboldalon; a Content Editor is staging feliratot kap.
|
||||
- **Környezetenként külön compose fájl**: `docker-compose.staging.yml` (app: 127.0.0.1:8081, saját PostgreSQL) és `docker-compose.prod.yml` (app: 8080). A két környezet ugyanazon a hoston, külön hálózaton és volume-mal fut.
|
||||
- **Környezeti változók**: kötelező `.env.staging` / `.env.production` fájlból jönnek (minta: `.env.staging.example`, `.env.production.example`). Bizalmas értékeknek (POSTGRES_PASSWORD, PAYLOAD_SECRET, az átállás idejére MONGO_ROOT_PASSWORD) **nincs fallback** — hiányzó env hangosan hibázik.
|
||||
- **Staging megkülönböztetés**: a `NEXT_PUBLIC_DEPLOY_ENV=staging` build arg amber banner-t jelenít meg a weboldalon.
|
||||
|
||||
## Előfeltételek
|
||||
|
||||
@@ -42,12 +42,33 @@ Bármely lépés hibája azonnal leállítja a folyamatot. Paraméterek környez
|
||||
```
|
||||
|
||||
1. Kötelező `.env.<env>` fájl betöltése (`--env-file` a compose-nak).
|
||||
2. `docker compose -f docker-compose.<env>.yml up --build --force-recreate -d` — a friss Dockerfile/build-arg változások is érvényesüljenek.
|
||||
3. Healthcheck: max 60s-ig kérdezi a `http://localhost:<port>/api/health`-t (staging: 8081, prod: 8080). Sikertelenség esetén app-logok kiírása + exit 1.
|
||||
2. **Port-ellenőrzés a build előtt** (MITHOME-137): `scripts/check-ports.sh --env-file .env.<env> --compose docker-compose.<env>.yml`. Minden közzétett host-port szabad legyen, vagy ugyanennek a projektnek ugyanaz a szolgáltatása foglalja (azt a deploy újraindítja). Egyéb foglaltság esetén a deploy azonnal leáll, és semmi nem épül újra.
|
||||
3. `docker compose -f docker-compose.<env>.yml up --build --force-recreate -d` — a friss Dockerfile/build-arg változások is érvényesüljenek.
|
||||
4. Healthcheck: max 60s-ig kérdezi a `http://localhost:<port>/api/health`-t (staging: 8081, prod: 8080). Sikertelenség esetén app-logok kiírása + exit 1.
|
||||
5. **Payload admin-seedelés** (MITHOME-97): healthcheck után meghívja a Payload beépített `POST /api/users/first-register` endpointját az `.env.<env>`-ben megadott `ADMIN_EMAIL`/`ADMIN_PASSWORD`-del. Ez az endpoint csakis akkor enged létrehozni felhasználót, ha a `users` collection teljesen üres — ezért idempotens: egy vadonatúj adatbázisnál (első deploy, vagy volume-törlés utáni újrakezdés) automatikusan létrehozza az ismert admin fiókot, minden további deployon pedig 403-at kap és ártalmatlanul kihagyja (a jelszót utólag sosem írja felül). Ha az `ADMIN_EMAIL`/`ADMIN_PASSWORD` hiányzik az env fájlból, ezt a lépést egyszerűen kihagyja (figyelmeztetéssel, nem hibával) — ilyenkor az első felhasználót manuálisan kell létrehozni `/admin` alatt.
|
||||
|
||||
## CMS-ből történő publikálás
|
||||
### Új port vagy konténer bevezetése
|
||||
|
||||
A Content Editor (`content-editor.js`) Publikálás gombja: commit + push (`content: frissítve a CMS-ből`), majd a `CMS_DEPLOY_ENV`-ben beállított környezet deployja a háttérben. **Soha nem deployol productionre implicit** — a `CMS_DEPLOY_ENV` kötelező, érvényes érték nélkül az editor el sem indul.
|
||||
**Szabály:** minden port definiálása előtt port-ellenőrzés kell, legyen az új Compose-szolgáltatás, `docker run -p` vagy SSH-alagút. Így nem fut feleslegesen egy build vagy egy indítás.
|
||||
|
||||
```bash
|
||||
# a Macről, a távoli llmdev szerverre:
|
||||
scripts/check-ports.sh --host sadmin@10.8.0.1 5433
|
||||
scripts/check-ports.sh --host sadmin@10.8.0.1 --project websitedev --compose docker-compose.staging.yml
|
||||
```
|
||||
|
||||
A szabad portot a használat előtt be kell jegyezni a portregiszterbe (`~/Projects/maintenance/docker-hatter-specifikacio.md`, 5. pont).
|
||||
|
||||
## Payload adatmigrációk és automatikus DB-mentés (MITHOME-111, MITHOME-136)
|
||||
|
||||
A `proto/src/migrations/` alatti Payload migrációk a `postgresAdapter({ prodMigrations })` révén **az app konténer indulásakor automatikusan lefutnak** (`NODE_ENV=production`, stagingen és productionben is). A lefutottakat a `payload_migrations` tábla tartja nyilván, ezért minden migráció csak egyszer fut. A lefutást az app-log mutatja (`Migrating: …` / `Migrated: …`).
|
||||
|
||||
- **Új migráció:** `npm run migrate:create <név>` (proto/), egy futó PostgreSQL-re mutató `DATABASE_URI`-vel. A séma csak migrációval változik; a generált fájlt kézzel nem szerkesztjük.
|
||||
- **Mentés:** a `deploy.sh` **a build előtt automatikusan ment**: `pg_dump -Fc` → `~/backups/mozdit-<env>-<időbélyeg>-pre-deploy.pgdump`, az átállás idejére a MongoDB-t is (`.archive`), 600-as jogosultsággal.
|
||||
|
||||
## Tartalom publikálása (Payload admin)
|
||||
|
||||
A régi Content Editor (`content-editor.js`, git push-alapú publikálás) helyét a Payload admin (`/admin`) draft/publish + verziózás funkciója vette át (MITHOME-92/93) — ez nem jár git commit-tal vagy automatikus deployjal, a tartalom közvetlenül az adatbázisba (PostgreSQL) íródik. Kódváltozás (Globals/Collections séma, frontend) továbbra is a lenti git-alapú deploy folyamaton megy át.
|
||||
|
||||
## Production deploy (élesítés)
|
||||
|
||||
@@ -59,9 +80,33 @@ cd <prod-path>
|
||||
./deploy.sh production
|
||||
```
|
||||
|
||||
### Indexelhetőségi őr és élesítési SEO-ellenőrzés (MITHOME-127)
|
||||
|
||||
A staging tiltása (`noindex`, mindent tiltó `robots.txt`, üres sitemap) a `NEXT_PUBLIC_DEPLOY_ENV=staging` build-változón múlik (MITHOME-116). Ha ez véletlenül az éles buildbe kerül, a Google csendben kiveszi az oldalt a találatok közül. Ezért a `deploy.sh` automatikusan véd:
|
||||
|
||||
- **Build előtt (csak production):** ha az `.env.production` vagy a `docker-compose.prod.yml` `NEXT_PUBLIC_DEPLOY_ENV=staging`-et állít, a deploy el sem indul.
|
||||
- **Deploy után (mindkét környezet):** `scripts/check-indexability.sh <url> <indexable|blocked>` — productionben indexelhető, stagingen tiltott állapotot vár. Eltérésnél a deploy hibával áll le (productionben rollback-utasítással).
|
||||
|
||||
**Élesítéskor és minden éles kiadás után** futtasd a teljes SEO-csomagot is (`proto/` mappából):
|
||||
|
||||
```bash
|
||||
BASE_URL=https://mozdit.hu npm run test:seo:production
|
||||
```
|
||||
|
||||
A csomag ellenőrzi:
|
||||
- a `robots.txt` enged, és a sitemapre mutat;
|
||||
- a sitemap mind a 12 URL-je végleges (200, átirányítás nélkül), nincs rajtuk `noindex`, a canonical önmagára mutat, a hreflang-párok sitemap-URL-ek;
|
||||
- a tartalom és a belső linkek JavaScript nélkül is a HTML-ben vannak;
|
||||
- a `/` egy lépésben a `/hu`-ra irányít, és az ismeretlen oldal 404-et ad.
|
||||
|
||||
A host-átirányítások (`http→https`, `www→` preferált host) az Nginx feladatai (MITHOME-15): amint az éles domain él, `SEO_CHECK_HOST_REDIRECTS=1`-gyel ezek is ellenőrizhetők.
|
||||
|
||||
Élesítés után: Google Search Console beállítása, sitemap beküldése, kulcsoldalak URL-vizsgálata (MITHOME-128).
|
||||
|
||||
## Post-deploy ellenőrzés
|
||||
|
||||
- [ ] Minden oldal betölt (`/`, `/rolunk`, `/szolgaltatasok`, `/kapcsolat`)
|
||||
- [ ] Minden oldal betölt mindkét nyelven (`/hu`, `/hu/rolunk`, `/hu/szolgaltatasok`, `/hu/kapcsolat`, illetve `/en`, `/en/about`, `/en/services`, `/en/contact`)
|
||||
- [ ] Migrációs kiadásnál: az app-logban szerepel a `Migrated: <név>` sor, és a magyar tartalom változatlan
|
||||
- [ ] `/api/health` zöld
|
||||
- [ ] Smoke tesztek: `BASE_URL=<url> npm run test:smoke:staging` (proto/)
|
||||
- [ ] Logok: `docker compose -f docker-compose.<env>.yml logs -f app`
|
||||
@@ -73,6 +118,15 @@ git checkout HEAD~1
|
||||
./deploy.sh <env>
|
||||
```
|
||||
|
||||
Ha a visszavont kiadás adatmigrációt tartalmazott, a régi kód a migrált adatot nem feltétlenül tudja olvasni. Ilyenkor a deploy előtti mentést is vissza kell állítani (a `--clean` felülírja a jelenlegi adatbázist; `CONTAINER_ENV` = `staging` vagy `prod`):
|
||||
|
||||
```bash
|
||||
docker exec -i mozdit-postgres-$CONTAINER_ENV pg_restore --clean --if-exists -U mozdit_web -d mozdit_web \
|
||||
< ~/backups/mozdit-$ENV-<időbélyeg>-pre-deploy.pgdump
|
||||
```
|
||||
|
||||
A migrációk `down` függvénye csak végső esetre való.
|
||||
|
||||
---
|
||||
|
||||
## CI — Gitea Actions (jelenleg szünetel)
|
||||
@@ -81,6 +135,8 @@ A Gitea Actions workflow szünetel, mert nincs dedikált, biztonságosan elkül
|
||||
|
||||
## Docker lokális dev stack
|
||||
|
||||
> **Megjegyzés (2026-09-28):** a fejlesztői Macen már nincs Docker daemon. A konténerek a közös llmdev szerveren futnak (`docker --context llmdev …`); a konvenciókat és a portregisztert a `~/Projects/maintenance/docker-hatter-specifikacio.md` írja le. Az alábbi parancsok ennek megfelelően csak a távoli contexttel működnek.
|
||||
|
||||
```bash
|
||||
cd proto
|
||||
npm run docker:dev # indítás (docker-compose.dev.yml)
|
||||
@@ -88,4 +144,4 @@ npm run docker:dev:down # leállítás
|
||||
npm run docker:dev:logs # logok követése
|
||||
```
|
||||
|
||||
Szolgáltatások: weboldal http://localhost:8080, MongoDB (host port 27018), Mongo Express http://localhost:8081, Loki :3100, Grafana http://localhost:3001.
|
||||
Szolgáltatások: weboldal http://localhost:8080, PostgreSQL (host port 5433, MITHOME-136), Loki :3100, Grafana http://localhost:3012 (MITHOME-137: a 8081 és a 3001 az llmdev-en foglalt).
|
||||
|
||||
@@ -55,8 +55,12 @@ git checkout -b feature/[leíró-feature-neve]
|
||||
```
|
||||
|
||||
### 3. Content frissítés (ha szöveges tartalom kell)
|
||||
- Módosítsd a megfelelő `proto/src/content/pages/*.json` fájlt
|
||||
- Frissítsd a `types.ts`-t ha új content struktúra kell
|
||||
- Új mező esetén bővítsd a megfelelő `proto/src/globals/*.ts` vagy
|
||||
`proto/src/collections/*.ts` Payload config fájlt, majd generáld újra a
|
||||
típusokat (`payload generate:types`)
|
||||
- Meglévő mező szövegét az ügyfél a Payload admin felületen (`/admin`)
|
||||
szerkeszti — ne írj bele közvetlenül `proto/src/content/*.json`-ba (az már
|
||||
csak a migrációs seed-script forrása, élő oldal nem olvassa, MITHOME-91/93)
|
||||
|
||||
### 4. UI / Komponens implementáció (ha szükséges)
|
||||
- Server Component alapértelmezetten — csak indokolt esetben `"use client"`
|
||||
|
||||
@@ -74,7 +74,8 @@ description: Kód review checklist — PR előtt és review során
|
||||
|
||||
✅ JÓ:
|
||||
[BLOCK] Ez hardcoded szöveget tartalmaz a komponensben.
|
||||
Át kell tenni: proto/src/content/pages/home.json → content.pages.home.*
|
||||
Át kell tenni Payload mezőbe (proto/src/globals/*.ts vagy collections/*.ts),
|
||||
és a payload-content.ts adapteren keresztül kell beolvasni.
|
||||
|
||||
[SUGGEST] Ezt a logikát érdemes egy helper funkcióba kiszervezni,
|
||||
ha több helyen is szükség lesz rá.
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
name: program-hid-update
|
||||
description: Frissíti a "Program Híd" publikus Artifactot (MITHOME ↔ PLATFM konvergencia-térkép, PLATFM roadmap-sín, MITHOME Payload-epic progresssáv) a Plane MITHOME és PLATFM projektek friss állapota alapján. Használd, ha a felhasználó a "Program Híd" frissítését/szinkronizálását kéri, "állapotkép"-et, "program térkép"-et említ, vagy miután jelentős haladás történt a MITHOME Payload CMS epicben (MITHOME-85 alá tartozó ticketek) vagy a PLATFM roadmapben/AI-pilotban (PLATFM-1..12).
|
||||
---
|
||||
|
||||
# Program Híd frissítés
|
||||
|
||||
Ez a skill szinkronban tartja a publikált **Program Híd** Artifactot (interaktív konvergencia-térkép a mozdIT MITHOME weboldal- és PLATFM platform-projektje között) a Plane aktuális állapotával. Az Artifact statikus HTML+JS — nincs élő Plane-kapcsolata, ezért kézzel (ezzel a skillel) kell frissen tartani.
|
||||
|
||||
## Állandók
|
||||
|
||||
- **Artifact URL** (mindig ugyanerre frissíts, ne hozz létre új linket): `https://claude.ai/code/artifact/95d7def2-c648-4fb7-a3f3-0d172b1c21ab`
|
||||
- **MITHOME Plane project_id**: `643f7055-1237-4912-912f-99ec49fd0f0e`
|
||||
- **PLATFM Plane project_id**: `b3e5b750-5a24-48f9-a3b6-e79925475b64`
|
||||
- **Kanonikus forrásfájl ebben a repóban**: `.claude/skills/program-hid-update/source.html` — ez van feltöltve az Artifactra. Mindig ezt szerkeszd, ne a régi scratchpad-másolatot (az session-specifikus, nem marad meg).
|
||||
|
||||
## Lépések
|
||||
|
||||
### 1. Artifact olvasása jóváhagyás előtt
|
||||
|
||||
Hívd meg `Artifact` action `"read"`-et a fenti URL-lel, mielőtt bármit publikálsz — ez a tool előírása (nem publikálhatsz olyan artifactra, amit a beszélgetés még nem olvasott). Ha a visszakapott tartalom eltér a helyi `source.html`-től (pl. valaki kézzel szerkesztette a publikált oldalt), a Plane-ből frissen lekért adatot építsd *arra* a verzióra, ne a helyi fájlra.
|
||||
|
||||
### 2. Friss Plane-állapot lekérése
|
||||
|
||||
**MITHOME oldal** — kérdezd le ezeket (readable identifier vagy `get_issue_using_readable_identifier`):
|
||||
- MITHOME-85 epic gyerekei: 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 102, 103, 105 — állapot (Done/Backlog/Todo/In Progress/Cancelled) és cím.
|
||||
- Ellenőrizd `list_project_issues`-szal (project_id fent), hogy nem került-e be **új** gyerek a MITHOME-85 alá az utolsó frissítés óta — ha igen, vedd fel az `epicItems` tömbbe.
|
||||
- MITHOME-31, MITHOME-40 (a hídon szereplő két satellit-ticket) állapota/prioritása.
|
||||
|
||||
**PLATFM oldal** — kérdezd le mind a 12 (vagy annál több, ha új került fel) issue-t `list_project_issues`-szal a PLATFM project_id-n:
|
||||
- Melyik fázishoz tartoznak (a fázis-hozzárendelés statikus, lásd `source.html` `phases` tömb — csak akkor változtasd, ha a PLATFM-11 roadmap issue szövege explicit átsorolást ír le).
|
||||
- Állapot/prioritás (kiemelten: PLATFM-5 BCDR és PLATFM-10 AI-pilot, mert ezek adják a híd "hot"/"live" jelölését).
|
||||
|
||||
### 3. Adatok újraszámolása
|
||||
|
||||
- **`epicItems`** (MITHOME Payload epic): `done: true`, ha a Plane state "Done"; frissítsd a címeket, ha változtak; vedd fel az új ticketeket.
|
||||
- **`phases`** (PLATFM roadmap-sín): egy fázis `status` legyen `"progress"`, ha van benne legalább egy In Progress vagy Done issue és van még nyitott is; `"urgent"`, ha van benne urgent prioritású *nyitott* issue (ma ez az 1. fázis, PLATFM-5 miatt); egyébként `"open"`. Az `issues` tömb `p` mezője (`urgent`/`high`/`med`) kövesse a Plane priority mezőt.
|
||||
- **`rows`** (híd, 6 konvergencia-pont): a `cls` mező jelzi az állapotot —
|
||||
- `"live"` (zöld, animált): a konvergencia-pont mindkét oldala aktívan halad vagy már összekötött (pl. AI-triázs, amíg a MITHOME esemény-emisszió és a PLATFM-10 pilot is legalább In Progress).
|
||||
- `"hot"` (piros, pulzáló): sürgős, még nincs megoldva — ma ez a BCDR sor (MITHOME-40 + PLATFM-5), amíg mindkettő nyitott.
|
||||
- `""` (semleges): még nem aktuális, a trigger-feltétel nem teljesült.
|
||||
- Ha egy konvergencia-pont mindkét oldala Done lesz, változtasd a sor feliratát "lezárva"-ra, és `cls` maradjon `"live"` (zöld), de a `trig` szöveg mondja ki, hogy megtörtént.
|
||||
- **Fejléc chipek** (`.chiprow`): számold újra a "X aktív · Y kész · Z lezárt duplikátum" (MITHOME) és "N feladat · M urgent · 8 roadmap-fázis" (PLATFM) szövegeket a friss számokból.
|
||||
- **`.stamp`** dátum: írd át a mai dátumra (`YYYY-MM-DD`, éles Plane-lekérdezés napja).
|
||||
|
||||
### 4. A `source.html` szerkesztése
|
||||
|
||||
Az adatok a fájl végén, a `<script>` blokkban vannak (`phases`, `unplaced`, `rows`, `epicItems` JS tömbök) — ezeket szerkeszd Edit-tel, ne írd újra az egész fájlt. A CSS/HTML-váz (fejléc, szekciók, SVG-koordináták) stabil marad, hacsak nem változik a konvergencia-pontok *száma* (akkor a bridge SVG `viewBox` magassága és a `rowH`/`top` számítás is igazításra szorul — lásd a JS-ben a `rows.forEach` ciklust).
|
||||
|
||||
Ha egy phase `issues` tömbje bővül/csökken, a fejlécben lévő `pcount` automatikusan követi (JS-ből generálódik), nincs kézi szinkron.
|
||||
|
||||
### 5. Ellenőrzés publikálás előtt
|
||||
|
||||
- Nézd át, hogy minden JS tömb szintaktikailag zárt (vesszők, zárójelek) — egy törött `<script>` az egész oldalt elviszi.
|
||||
- Számold meg a `{`/`}` és `(`/`)` párokat a módosított szakaszban, ha bizonytalan vagy.
|
||||
- Ha van rá mód (bejelentkezett böngésző-session), nyisd meg az Artifact URL-t és nézd meg egyszer, mielőtt publikálod a végleges verziót — lásd az `artifact-design` skill "write, look once, publish" szabályát.
|
||||
|
||||
### 6. Publikálás
|
||||
|
||||
`Artifact` action `"publish"` (alapértelmezett), `file_path` a `source.html`-re, **`url`** a fenti Artifact URL-re (így ugyanaz a link marad, nem jön létre új Artifact). `favicon`-t és `title`-t **ne** add meg újra — a redeploy megtartja a meglévőt.
|
||||
|
||||
### 7. Nyomon követés
|
||||
|
||||
- Írj egy rövid sort a `TODO.md` "Frissítési Napló" szekciójába: `**YYYY-MM-DD**: Program Híd frissítve (X/Y MITHOME Payload-feladat kész, N nyitott PLATFM-item).`
|
||||
- Commitold a `source.html` változást (`git add .claude/skills/program-hid-update/source.html TODO.md && git commit` a projekt konvenciói szerint — `docs:` vagy `chore:` prefix).
|
||||
- Foglald össze a felhasználónak, mi változott a térképen (melyik konvergencia-pont mozdult, melyik fázis indult el).
|
||||
|
||||
## Ha rendszeres/automatikus futtatást szeretne a felhasználó
|
||||
|
||||
Ez a skill önmagában **kézi indítású** (a felhasználó vagy egy másik munkamenet hívja meg). Ha valódi, felügyelet nélküli, időzített frissítést szeretnének (pl. hetente egyszer), azt a `schedule` skillel/CronCreate-tel lehet erre a skillre ráépíteni — ezt csak akkor állítsd be, ha a felhasználó explicit kéri, és mondd el neki, hogy ez azt jelenti: rendszeres, felügyelet nélküli Plane-olvasás és Artifact-publikálás fog lezajlani a háttérben.
|
||||
@@ -0,0 +1,685 @@
|
||||
<title>Program Híd</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap">
|
||||
<style>
|
||||
:root{
|
||||
--bg:#F2F6F6;
|
||||
--surface:#FFFFFF;
|
||||
--surface-2:#E7EEEE;
|
||||
--ink:#152029;
|
||||
--ink-soft:#4C606D;
|
||||
--ink-faint:#7E909B;
|
||||
--line:#C7D5D8;
|
||||
--line-strong:#A9BCC0;
|
||||
--accent:#0F7A8F;
|
||||
--accent-ink:#FFFFFF;
|
||||
--accent-soft:#DCEEF1;
|
||||
--success:#2C8A57;
|
||||
--success-soft:#DEF1E6;
|
||||
--warning:#AD6F0B;
|
||||
--warning-soft:#F6E9D2;
|
||||
--critical:#C13B30;
|
||||
--critical-soft:#F8DEDB;
|
||||
--shadow: 0 1px 2px rgba(21,32,41,.06), 0 8px 24px -12px rgba(21,32,41,.18);
|
||||
--radius: 10px;
|
||||
font-synthesis: none;
|
||||
}
|
||||
@media (prefers-color-scheme: dark){
|
||||
:root:not([data-theme="light"]){
|
||||
--bg:#0D151D;
|
||||
--surface:#131E28;
|
||||
--surface-2:#1A2733;
|
||||
--ink:#E7EFF2;
|
||||
--ink-soft:#9BAEBB;
|
||||
--ink-faint:#6C8090;
|
||||
--line:#2A3C49;
|
||||
--line-strong:#3B5062;
|
||||
--accent:#3FBBD1;
|
||||
--accent-ink:#052229;
|
||||
--accent-soft:#163642;
|
||||
--success:#4FBE84;
|
||||
--success-soft:#173428;
|
||||
--warning:#E3A741;
|
||||
--warning-soft:#3A2B10;
|
||||
--critical:#E2685C;
|
||||
--critical-soft:#3A1D1A;
|
||||
--shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 28px -14px rgba(0,0,0,.6);
|
||||
}
|
||||
}
|
||||
:root[data-theme="dark"]{
|
||||
--bg:#0D151D;
|
||||
--surface:#131E28;
|
||||
--surface-2:#1A2733;
|
||||
--ink:#E7EFF2;
|
||||
--ink-soft:#9BAEBB;
|
||||
--ink-faint:#6C8090;
|
||||
--line:#2A3C49;
|
||||
--line-strong:#3B5062;
|
||||
--accent:#3FBBD1;
|
||||
--accent-ink:#052229;
|
||||
--accent-soft:#163642;
|
||||
--success:#4FBE84;
|
||||
--success-soft:#173428;
|
||||
--warning:#E3A741;
|
||||
--warning-soft:#3A2B10;
|
||||
--critical:#E2685C;
|
||||
--critical-soft:#3A1D1A;
|
||||
--shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 28px -14px rgba(0,0,0,.6);
|
||||
}
|
||||
|
||||
*{ box-sizing:border-box; }
|
||||
body{
|
||||
margin:0;
|
||||
background:var(--bg);
|
||||
color:var(--ink);
|
||||
font-family:"IBM Plex Sans", system-ui, -apple-system, sans-serif;
|
||||
line-height:1.5;
|
||||
}
|
||||
.mono{ font-family:"IBM Plex Mono", ui-monospace, "SF Mono", monospace; }
|
||||
|
||||
.wrap{
|
||||
max-width:1180px;
|
||||
margin:0 auto;
|
||||
padding:36px 20px 64px;
|
||||
}
|
||||
|
||||
/* ---------- header ---------- */
|
||||
header.hero{
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
gap:14px;
|
||||
margin-bottom:34px;
|
||||
}
|
||||
.eyebrow{
|
||||
font-family:"IBM Plex Mono", monospace;
|
||||
font-size:11.5px;
|
||||
letter-spacing:.14em;
|
||||
text-transform:uppercase;
|
||||
color:var(--accent);
|
||||
font-weight:600;
|
||||
}
|
||||
h1{
|
||||
font-size:clamp(28px, 4.4vw, 42px);
|
||||
line-height:1.08;
|
||||
margin:0;
|
||||
letter-spacing:-0.01em;
|
||||
text-wrap:balance;
|
||||
font-weight:700;
|
||||
}
|
||||
.lede{
|
||||
max-width:64ch;
|
||||
color:var(--ink-soft);
|
||||
font-size:15.5px;
|
||||
margin:0;
|
||||
}
|
||||
.stamp{
|
||||
font-family:"IBM Plex Mono", monospace;
|
||||
font-size:12px;
|
||||
color:var(--ink-faint);
|
||||
}
|
||||
|
||||
.chiprow{
|
||||
display:flex;
|
||||
flex-wrap:wrap;
|
||||
gap:10px;
|
||||
margin-top:6px;
|
||||
}
|
||||
.chip{
|
||||
display:flex;
|
||||
align-items:baseline;
|
||||
gap:8px;
|
||||
background:var(--surface);
|
||||
border:1px solid var(--line);
|
||||
border-radius:999px;
|
||||
padding:7px 14px 7px 12px;
|
||||
box-shadow:var(--shadow);
|
||||
}
|
||||
.chip .dot{ width:8px; height:8px; border-radius:50%; flex:none; }
|
||||
.chip .proj{ font-family:"IBM Plex Mono", monospace; font-weight:600; font-size:12.5px; letter-spacing:.02em; }
|
||||
.chip .stat{ font-size:12.5px; color:var(--ink-soft); }
|
||||
.chip.mithome .dot{ background:var(--accent); }
|
||||
.chip.platfm .dot{ background:#8B6BC9; }
|
||||
|
||||
.filterbar{
|
||||
display:flex;
|
||||
gap:6px;
|
||||
margin-top:4px;
|
||||
}
|
||||
.filterbar button{
|
||||
font-family:"IBM Plex Mono", monospace;
|
||||
font-size:12px;
|
||||
letter-spacing:.02em;
|
||||
border:1px solid var(--line);
|
||||
background:var(--surface);
|
||||
color:var(--ink-soft);
|
||||
padding:6px 12px;
|
||||
border-radius:7px;
|
||||
cursor:pointer;
|
||||
transition: background .15s ease, color .15s ease, border-color .15s ease;
|
||||
}
|
||||
.filterbar button:hover{ border-color:var(--line-strong); color:var(--ink); }
|
||||
.filterbar button[aria-pressed="true"]{
|
||||
background:var(--ink);
|
||||
color:var(--bg);
|
||||
border-color:var(--ink);
|
||||
}
|
||||
:root[data-theme="dark"] .filterbar button[aria-pressed="true"]{
|
||||
background:var(--accent); color:var(--accent-ink); border-color:var(--accent);
|
||||
}
|
||||
@media (prefers-color-scheme:dark){
|
||||
:root:not([data-theme="light"]) .filterbar button[aria-pressed="true"]{
|
||||
background:var(--accent); color:var(--accent-ink); border-color:var(--accent);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- section shell ---------- */
|
||||
section{ margin-top:46px; }
|
||||
.sectionhead{
|
||||
display:flex;
|
||||
align-items:baseline;
|
||||
justify-content:space-between;
|
||||
gap:12px;
|
||||
margin-bottom:16px;
|
||||
border-bottom:1px solid var(--line);
|
||||
padding-bottom:10px;
|
||||
}
|
||||
.sectionhead h2{
|
||||
font-size:14px;
|
||||
text-transform:uppercase;
|
||||
letter-spacing:.1em;
|
||||
margin:0;
|
||||
font-weight:600;
|
||||
color:var(--ink-soft);
|
||||
}
|
||||
.sectionhead .note{ font-size:12.5px; color:var(--ink-faint); font-family:"IBM Plex Mono", monospace; }
|
||||
|
||||
/* ---------- phase rail ---------- */
|
||||
.railscroll{ overflow-x:auto; padding-bottom:6px; margin: 0 -4px; }
|
||||
.rail{
|
||||
position:relative;
|
||||
display:flex;
|
||||
gap:0;
|
||||
min-width:840px;
|
||||
padding:34px 4px 4px;
|
||||
}
|
||||
.rail::before{
|
||||
content:"";
|
||||
position:absolute;
|
||||
top:14px; left:44px; right:44px; height:2px;
|
||||
background: repeating-linear-gradient(90deg, var(--line-strong) 0 8px, transparent 8px 14px);
|
||||
background-size: 200% 100%;
|
||||
animation: flow 6s linear infinite;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce){ .rail::before{ animation:none; } }
|
||||
@keyframes flow{ from{ background-position:0 0; } to{ background-position:-28px 0; } }
|
||||
|
||||
.phase{
|
||||
flex:1 1 0;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
align-items:center;
|
||||
text-align:center;
|
||||
padding:0 8px;
|
||||
position:relative;
|
||||
cursor:pointer;
|
||||
transition:opacity .25s ease;
|
||||
}
|
||||
.phase .node{
|
||||
width:26px; height:26px; border-radius:50%;
|
||||
background:var(--surface);
|
||||
border:2px solid var(--line-strong);
|
||||
display:flex; align-items:center; justify-content:center;
|
||||
font-family:"IBM Plex Mono", monospace;
|
||||
font-size:11px; font-weight:600; color:var(--ink-soft);
|
||||
z-index:1;
|
||||
transition: border-color .15s ease, transform .15s ease, color .15s ease;
|
||||
}
|
||||
.phase[data-status="progress"] .node{ border-color:var(--accent); color:var(--accent); background:var(--accent-soft); }
|
||||
.phase[data-status="urgent"] .node{ border-color:var(--critical); color:var(--critical); background:var(--critical-soft); }
|
||||
.phase:hover .node{ transform:scale(1.12); }
|
||||
.phase .pname{
|
||||
margin-top:10px; font-size:12.5px; font-weight:600; max-width:15ch; text-wrap:balance;
|
||||
}
|
||||
.phase .pcount{
|
||||
margin-top:3px; font-size:11px; color:var(--ink-faint); font-family:"IBM Plex Mono", monospace;
|
||||
}
|
||||
.phase.dim{ opacity:.32; }
|
||||
|
||||
.phase-extra{
|
||||
flex:0 0 auto;
|
||||
width:150px;
|
||||
padding-left:14px;
|
||||
margin-left:6px;
|
||||
border-left:1px dashed var(--line-strong);
|
||||
display:flex; flex-direction:column; align-items:flex-start; text-align:left;
|
||||
cursor:pointer;
|
||||
}
|
||||
.phase-extra .tag{
|
||||
font-family:"IBM Plex Mono", monospace; font-size:10.5px; text-transform:uppercase; letter-spacing:.08em;
|
||||
color:var(--warning); font-weight:600; margin-bottom:6px;
|
||||
}
|
||||
.phase-extra .pname{ font-size:12.5px; font-weight:600; }
|
||||
.phase-extra .pcount{ font-size:11px; color:var(--ink-faint); font-family:"IBM Plex Mono", monospace; margin-top:3px;}
|
||||
|
||||
.detail{
|
||||
margin-top:18px;
|
||||
background:var(--surface);
|
||||
border:1px solid var(--line);
|
||||
border-radius:var(--radius);
|
||||
box-shadow:var(--shadow);
|
||||
padding:18px 20px;
|
||||
display:none;
|
||||
}
|
||||
.detail.open{ display:block; }
|
||||
.detail h3{ margin:0 0 3px; font-size:15px; }
|
||||
.detail .sub{ margin:0 0 14px; font-size:12.5px; color:var(--ink-faint); font-family:"IBM Plex Mono", monospace; }
|
||||
.issuelist{ display:flex; flex-direction:column; gap:8px; }
|
||||
.issue{
|
||||
display:flex; align-items:center; gap:10px;
|
||||
padding:8px 10px;
|
||||
background:var(--surface-2);
|
||||
border-radius:7px;
|
||||
}
|
||||
.issue .id{
|
||||
font-family:"IBM Plex Mono", monospace; font-size:11.5px; font-weight:600;
|
||||
background:var(--surface); border:1px solid var(--line); border-radius:5px;
|
||||
padding:2px 7px; flex:none; color:var(--ink-soft);
|
||||
}
|
||||
.issue .t{ font-size:13px; flex:1; }
|
||||
.issue .p{ font-size:10.5px; font-family:"IBM Plex Mono", monospace; text-transform:uppercase; letter-spacing:.06em; flex:none; padding:2px 7px; border-radius:5px; }
|
||||
.p.urgent{ background:var(--critical-soft); color:var(--critical); }
|
||||
.p.high{ background:var(--warning-soft); color:var(--warning); }
|
||||
.p.med{ background:var(--surface); color:var(--ink-faint); border:1px solid var(--line); }
|
||||
.empty-note{ font-size:13px; color:var(--ink-faint); font-style:italic; }
|
||||
|
||||
/* ---------- bridge ---------- */
|
||||
.bridgescroll{ overflow-x:auto; }
|
||||
.bridge-wrap{ min-width:760px; }
|
||||
svg.bridge{ width:100%; height:auto; display:block; overflow:visible; }
|
||||
.col-label{
|
||||
font-family:"IBM Plex Mono", monospace; font-size:11.5px; font-weight:600; letter-spacing:.06em; text-transform:uppercase;
|
||||
}
|
||||
.node-card{ cursor:pointer; }
|
||||
.node-card rect{ fill:var(--surface); stroke:var(--line-strong); stroke-width:1.3; transition:stroke .15s ease, filter .15s ease; }
|
||||
.node-card:hover rect{ stroke:var(--accent); }
|
||||
.node-title{ font-size:12.5px; font-weight:600; fill:var(--ink); font-family:"IBM Plex Sans", sans-serif; }
|
||||
.node-sub{ font-size:10.5px; fill:var(--ink-faint); font-family:"IBM Plex Mono", monospace; }
|
||||
.conn-label{ font-size:10px; fill:var(--ink-faint); font-family:"IBM Plex Mono", monospace; }
|
||||
.conn-label.hot{ fill:var(--critical); font-weight:600; }
|
||||
.conn-label.live{ fill:var(--success); font-weight:600; }
|
||||
.flowpath{ fill:none; stroke:var(--line-strong); stroke-width:1.6; stroke-dasharray:1 7; stroke-linecap:round; }
|
||||
.flowpath.live{ stroke:var(--success); stroke-dasharray:5 5; animation:dash 1.8s linear infinite; }
|
||||
.flowpath.hot{ stroke:var(--critical); stroke-dasharray:5 5; animation:dash 1.2s linear infinite; }
|
||||
@keyframes dash{ to{ stroke-dashoffset:-20; } }
|
||||
@media (prefers-reduced-motion: reduce){ .flowpath.live, .flowpath.hot{ animation:none; } }
|
||||
.ghost rect{ fill:none; stroke:var(--line); stroke-dasharray:3 3; }
|
||||
.ghost text{ fill:var(--ink-faint); }
|
||||
.ghostpath{ fill:none; stroke:var(--line); stroke-width:1.2; stroke-dasharray:2 4; }
|
||||
.side.dim{ opacity:.28; transition:opacity .25s ease; }
|
||||
.flowpath.dim, .conn-label.dim{ opacity:.15; }
|
||||
|
||||
/* ---------- epic progress ---------- */
|
||||
.epicbar{
|
||||
display:flex; flex-wrap:wrap; gap:8px;
|
||||
}
|
||||
.seg{
|
||||
display:flex; align-items:center; gap:8px;
|
||||
background:var(--surface); border:1px solid var(--line); border-radius:7px;
|
||||
padding:8px 10px;
|
||||
min-width:200px; flex:1 1 220px;
|
||||
}
|
||||
.seg .id{ font-family:"IBM Plex Mono", monospace; font-size:11px; font-weight:600; color:var(--ink-soft); flex:none; }
|
||||
.seg .t{ font-size:12.5px; flex:1; }
|
||||
.seg .state{ width:9px; height:9px; border-radius:50%; flex:none; }
|
||||
.state.done{ background:var(--success); }
|
||||
.state.open{ background:var(--ink-faint); }
|
||||
.progresswrap{
|
||||
display:flex; align-items:center; gap:12px; margin-bottom:16px;
|
||||
}
|
||||
.progresstrack{
|
||||
flex:1; height:8px; border-radius:99px; background:var(--surface-2); overflow:hidden;
|
||||
}
|
||||
.progressfill{
|
||||
height:100%; border-radius:99px;
|
||||
background:linear-gradient(90deg, var(--accent), var(--success));
|
||||
transition:width .6s ease;
|
||||
}
|
||||
.progresslabel{ font-family:"IBM Plex Mono", monospace; font-size:12.5px; color:var(--ink-soft); flex:none; }
|
||||
|
||||
footer{
|
||||
margin-top:50px; padding-top:18px; border-top:1px solid var(--line);
|
||||
font-size:12px; color:var(--ink-faint); font-family:"IBM Plex Mono", monospace;
|
||||
display:flex; flex-wrap:wrap; gap:6px 18px; justify-content:space-between;
|
||||
}
|
||||
|
||||
@media (max-width:640px){
|
||||
.wrap{ padding:26px 14px 48px; }
|
||||
.sectionhead{ flex-direction:column; align-items:flex-start; gap:4px; }
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="wrap">
|
||||
|
||||
<header class="hero">
|
||||
<span class="eyebrow">mozdIT Bt. · program áttekintés</span>
|
||||
<h1>Program Híd</h1>
|
||||
<p class="lede">MITHOME (mozdIT weboldal + Payload CMS-migráció) és PLATFM (a szélesebb vállalati platform) között hat ponton ér össze a munka. Ez az oldal azt mutatja, hol tartunk, és mi indítja el a következő találkozási pontot.</p>
|
||||
<p class="stamp">Statikus állapotkép — 2026‑09‑10, a Plane MITHOME + PLATFM projektek alapján</p>
|
||||
|
||||
<div class="chiprow">
|
||||
<div class="chip mithome"><span class="dot"></span><span class="proj">MITHOME</span><span class="stat">15 aktív · 2 kész · 7 lezárt duplikátum</span></div>
|
||||
<div class="chip platfm"><span class="dot"></span><span class="proj">PLATFM</span><span class="stat">12 feladat · 1 urgent · 8 roadmap-fázis</span></div>
|
||||
</div>
|
||||
|
||||
<div class="filterbar" role="group" aria-label="Szűrés projekt szerint">
|
||||
<button type="button" data-filter="all" aria-pressed="true">Mindkettő</button>
|
||||
<button type="button" data-filter="mithome" aria-pressed="false">MITHOME</button>
|
||||
<button type="button" data-filter="platfm" aria-pressed="false">PLATFM</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- ===================== PHASE RAIL ===================== -->
|
||||
<section>
|
||||
<div class="sectionhead">
|
||||
<h2>PLATFM roadmap · 8 fázis</h2>
|
||||
<span class="note">sorrend van, dátum nincs — kattints egy fázisra</span>
|
||||
</div>
|
||||
|
||||
<div class="railscroll">
|
||||
<div class="rail" id="rail">
|
||||
<!-- phases injected by JS -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detail" id="phaseDetail"></div>
|
||||
</section>
|
||||
|
||||
<!-- ===================== BRIDGE ===================== -->
|
||||
<section>
|
||||
<div class="sectionhead">
|
||||
<h2>Konvergencia-híd</h2>
|
||||
<span class="note">6 pont, ahol a két projekt ugyanazt a dolgot érinti</span>
|
||||
</div>
|
||||
|
||||
<div class="bridgescroll">
|
||||
<div class="bridge-wrap">
|
||||
<svg class="bridge" viewBox="0 0 940 566" role="img" aria-label="MITHOME és PLATFM közötti hat konvergencia-pont, összekötő nyilakkal és aktiválási feltétellel">
|
||||
<defs>
|
||||
<marker id="arrow" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M0,0 L10,5 L0,10 z" fill="var(--line-strong)"></path>
|
||||
</marker>
|
||||
<marker id="arrowLive" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M0,0 L10,5 L0,10 z" fill="var(--success)"></path>
|
||||
</marker>
|
||||
<marker id="arrowHot" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M0,0 L10,5 L0,10 z" fill="var(--critical)"></path>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<text x="40" y="26" class="col-label" fill="var(--accent)">MITHOME · weboldal</text>
|
||||
<text x="900" y="26" class="col-label" fill="#8B6BC9" text-anchor="end">PLATFM · vállalati platform</text>
|
||||
|
||||
<!-- connector paths (drawn first, under nodes) -->
|
||||
<g id="connectors"></g>
|
||||
<!-- nodes -->
|
||||
<g id="leftNodes"></g>
|
||||
<g id="rightNodes"></g>
|
||||
|
||||
<!-- ghost story node -->
|
||||
<g class="ghost" id="ghostNode" transform="translate(392,470)">
|
||||
<rect x="0" y="0" width="156" height="46" rx="8"></rect>
|
||||
<text x="12" y="18" class="node-sub">MITHOME-99 EPIC</text>
|
||||
<text x="12" y="33" class="node-sub">duplikátum · lezárva 09-10</text>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ===================== EPIC PROGRESS ===================== -->
|
||||
<section id="mithomeSection">
|
||||
<div class="sectionhead">
|
||||
<h2>MITHOME · Payload CMS epic</h2>
|
||||
<span class="note">MITHOME-85 alá tartozó feladatok</span>
|
||||
</div>
|
||||
|
||||
<div class="progresswrap">
|
||||
<div class="progresstrack"><div class="progressfill" id="epicFill" style="width:0%"></div></div>
|
||||
<span class="progresslabel" id="epicLabel">2 / 15 kész</span>
|
||||
</div>
|
||||
|
||||
<div class="epicbar" id="epicBar"></div>
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
<span>Forrás: Plane · MITHOME + PLATFM projektek</span>
|
||||
<span>Frissítve: 2026-09-10 · nem szinkronizál élőben</span>
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function(){
|
||||
var phases = [
|
||||
{n:1, name:"Platform-alapok és governance", status:"progress", issues:[
|
||||
{id:"PLATFM-1", t:"Platform architektúra és komponensfüggőségi nyilvántartás", p:"high"},
|
||||
{id:"PLATFM-5", t:"Üzletmenet-folytonossági és katasztrófa-helyreállítási terv (BCDR)", p:"urgent"},
|
||||
{id:"PLATFM-6", t:"Build vs. Open Source döntési keret és komponensenkénti ADR-ek", p:"high"},
|
||||
{id:"PLATFM-8", t:"Infrastruktúra-kapacitás, értékesíthető készlet és bővítési ROI modell", p:"high"},
|
||||
{id:"PLATFM-9", t:"Magyar mikro- és KKV webszolgáltatási piac kutatása és termékpriorizálás", p:"high"}
|
||||
]},
|
||||
{n:2, name:"IDM v1 (identitás, RBAC, audit)", status:"open", issues:[
|
||||
{id:"PLATFM-4", t:"Közös jogosultsági modell (RBAC + adatbesorolás) alapjai", p:"high"}
|
||||
]},
|
||||
{n:3, name:"Content Release réteg", status:"open", issues:[]},
|
||||
{n:4, name:"Központi termékkatalógus", status:"open", issues:[
|
||||
{id:"PLATFM-3", t:"Központi termék- és szolgáltatáskatalógus tervezése (mIT Start/Mid/Pro/Pro Plus)", p:"high"}
|
||||
]},
|
||||
{n:5, name:"Belső mIT Portal v1", status:"open", issues:[]},
|
||||
{n:6, name:"Messaging Gateway", status:"open", issues:[
|
||||
{id:"PLATFM-2", t:"Központi Messaging Gateway tervezése és első e-mail csatorna", p:"high"}
|
||||
]},
|
||||
{n:7, name:"Rendelés / számlázás / provisioning", status:"open", issues:[
|
||||
{id:"PLATFM-7", t:"Felügyelt szolgáltatás-teljesítési lánc (rendelés → számlázás → provisioning → üzemeltetés)", p:"high"}
|
||||
]},
|
||||
{n:8, name:"RAG és tudásréteg", status:"open", issues:[]}
|
||||
];
|
||||
var unplaced = {name:"Nincs fázisba sorolva", issues:[
|
||||
{id:"PLATFM-10", t:"Kis kapacitásigényű, felügyelt AI-funkciók pilot és ROI-validáció", p:"med"},
|
||||
{id:"PLATFM-12", t:"ADR: AI Gateway / triázs-motor — Hermes Agent vs. alternatívák", p:"high"}
|
||||
]};
|
||||
|
||||
var rail = document.getElementById("rail");
|
||||
var detail = document.getElementById("phaseDetail");
|
||||
|
||||
function statusLabel(s){
|
||||
if(s==="progress") return "folyamatban";
|
||||
if(s==="urgent") return "sürgős";
|
||||
return "nem indult";
|
||||
}
|
||||
|
||||
function renderDetail(name, issues, sub){
|
||||
var html = "<h3>"+name+"</h3><p class=\"sub\">"+sub+"</p>";
|
||||
if(issues.length===0){
|
||||
html += "<p class=\"empty-note\">Ehhez a fázishoz még nincs Plane-feladat — az előtte lévő fázisok lezárása után nyílik meg.</p>";
|
||||
} else {
|
||||
html += "<div class=\"issuelist\">" + issues.map(function(i){
|
||||
return "<div class=\"issue\"><span class=\"id\">"+i.id+"</span><span class=\"t\">"+i.t+"</span><span class=\"p "+i.p+"\">"+i.p+"</span></div>";
|
||||
}).join("") + "</div>";
|
||||
}
|
||||
detail.innerHTML = html;
|
||||
detail.classList.add("open");
|
||||
}
|
||||
|
||||
var openPhase = null;
|
||||
function togglePhase(el, name, issues, sub){
|
||||
if(openPhase === el){
|
||||
detail.classList.remove("open");
|
||||
openPhase = null;
|
||||
return;
|
||||
}
|
||||
openPhase = el;
|
||||
renderDetail(name, issues, sub);
|
||||
}
|
||||
|
||||
phases.forEach(function(ph){
|
||||
var el = document.createElement("div");
|
||||
el.className = "phase";
|
||||
el.dataset.status = ph.status;
|
||||
el.dataset.side = "platfm";
|
||||
el.innerHTML = "<div class=\"node\">"+ph.n+"</div><div class=\"pname\">"+ph.name+"</div><div class=\"pcount\">"+ph.issues.length+" feladat</div>";
|
||||
el.addEventListener("click", function(){
|
||||
togglePhase(el, ph.n+". fázis · "+ph.name, ph.issues, "Roadmap-sorrend szerinti "+ph.n+". lépés · státusz: "+statusLabel(ph.status));
|
||||
});
|
||||
rail.appendChild(el);
|
||||
});
|
||||
|
||||
var extra = document.createElement("div");
|
||||
extra.className = "phase-extra";
|
||||
extra.dataset.side = "platfm";
|
||||
extra.innerHTML = "<div class=\"tag\">függőben</div><div class=\"pname\">"+unplaced.name+"</div><div class=\"pcount\">"+unplaced.issues.length+" feladat</div>";
|
||||
extra.addEventListener("click", function(){
|
||||
togglePhase(extra, unplaced.name, unplaced.issues, "PLATFM-10 pilot elindult izoláltan, mielőtt a roadmap besorolta volna — 2026-09-10-i döntés");
|
||||
});
|
||||
rail.appendChild(extra);
|
||||
|
||||
// ---------------- bridge ----------------
|
||||
var leftG = document.getElementById("leftNodes");
|
||||
var rightG = document.getElementById("rightNodes");
|
||||
var connG = document.getElementById("connectors");
|
||||
|
||||
var rows = [
|
||||
{
|
||||
left:{t:"Esemény-forrás", sub:"MITHOME-102 · 103 · 105"},
|
||||
right:{t:"AI-triázs pilot + ADR", sub:"PLATFM-10 · 12"},
|
||||
trig:"már aktív", cls:"live"
|
||||
},
|
||||
{
|
||||
left:{t:"Payload Users", sub:"MITHOME-90 · helyi auth"},
|
||||
right:{t:"IDM v1 / RBAC", sub:"PLATFM-4 · 2. fázis"},
|
||||
trig:"IDM v1 indulásakor", cls:""
|
||||
},
|
||||
{
|
||||
left:{t:"Draft & régi CMS", sub:"MITHOME-92 · 93"},
|
||||
right:{t:"Content Release réteg", sub:"3. fázis"},
|
||||
trig:"réteg indulásakor", cls:""
|
||||
},
|
||||
{
|
||||
left:{t:"Szolgáltatások oldal", sub:"Payload Services global"},
|
||||
right:{t:"Termékkatalógus", sub:"PLATFM-3 · 4. fázis"},
|
||||
trig:"katalógus MVP-nél", cls:""
|
||||
},
|
||||
{
|
||||
left:{t:"Kapcsolati form", sub:"e-mail értesítés"},
|
||||
right:{t:"Messaging Gateway", sub:"PLATFM-2 · 6. fázis"},
|
||||
trig:"gateway kész", cls:""
|
||||
},
|
||||
{
|
||||
left:{t:"Mongo mentés", sub:"MITHOME-40 · urgent"},
|
||||
right:{t:"BCDR terv", sub:"PLATFM-5 · RPO 15p / RTO 4ó"},
|
||||
trig:"production induláskor", cls:"hot"
|
||||
}
|
||||
];
|
||||
|
||||
var top = 60, rowH = 68, boxW = 210, boxH = 46;
|
||||
var leftX = 40, rightX = 940 - 40 - boxW;
|
||||
|
||||
rows.forEach(function(r, idx){
|
||||
var y = top + idx*rowH;
|
||||
|
||||
var lg = document.createElementNS("http://www.w3.org/2000/svg","g");
|
||||
lg.setAttribute("class","node-card"); lg.setAttribute("data-side","mithome");
|
||||
lg.setAttribute("transform","translate("+leftX+","+y+")");
|
||||
lg.innerHTML = '<rect width="'+boxW+'" height="'+boxH+'" rx="8"></rect>'+
|
||||
'<text x="14" y="19" class="node-title">'+r.left.t+'</text>'+
|
||||
'<text x="14" y="34" class="node-sub">'+r.left.sub+'</text>';
|
||||
leftG.appendChild(lg);
|
||||
|
||||
var rg = document.createElementNS("http://www.w3.org/2000/svg","g");
|
||||
rg.setAttribute("class","node-card"); rg.setAttribute("data-side","platfm");
|
||||
rg.setAttribute("transform","translate("+rightX+","+y+")");
|
||||
rg.innerHTML = '<rect width="'+boxW+'" height="'+boxH+'" rx="8"></rect>'+
|
||||
'<text x="14" y="19" class="node-title">'+r.right.t+'</text>'+
|
||||
'<text x="14" y="34" class="node-sub">'+r.right.sub+'</text>';
|
||||
rightG.appendChild(rg);
|
||||
|
||||
var x1 = leftX+boxW, y1 = y+boxH/2, x2 = rightX, y2 = y+boxH/2;
|
||||
var mx = (x1+x2)/2;
|
||||
var d = "M"+x1+","+y1+" C "+mx+","+y1+" "+mx+","+y2+" "+(x2-8)+","+y2;
|
||||
var marker = r.cls==="live" ? "url(#arrowLive)" : (r.cls==="hot" ? "url(#arrowHot)" : "url(#arrow)");
|
||||
|
||||
var path = document.createElementNS("http://www.w3.org/2000/svg","path");
|
||||
path.setAttribute("d", d);
|
||||
path.setAttribute("class","flowpath "+r.cls);
|
||||
path.setAttribute("marker-end", marker);
|
||||
path.setAttribute("data-side","bridge");
|
||||
connG.appendChild(path);
|
||||
|
||||
var label = document.createElementNS("http://www.w3.org/2000/svg","text");
|
||||
label.setAttribute("x", mx);
|
||||
label.setAttribute("y", y1 - 8);
|
||||
label.setAttribute("text-anchor","middle");
|
||||
label.setAttribute("class","conn-label"+(r.cls==="hot"?" hot":r.cls==="live"?" live":""));
|
||||
label.setAttribute("data-side","bridge");
|
||||
label.textContent = r.trig;
|
||||
connG.appendChild(label);
|
||||
});
|
||||
|
||||
// ghost connector: MITHOME-99 (cancelled) -> PLATFM-10
|
||||
var ghostPath = document.createElementNS("http://www.w3.org/2000/svg","path");
|
||||
var gx1 = 392, gy1 = 470+10, gx2 = rightX+8, gy2 = top + 0*rowH + boxH/2;
|
||||
ghostPath.setAttribute("d","M"+gx1+","+gy1+" C "+(gx1-120)+","+gy1+" "+(gx2-40)+","+gy2+" "+gx2+","+gy2);
|
||||
ghostPath.setAttribute("class","ghostpath");
|
||||
connG.insertBefore(ghostPath, connG.firstChild);
|
||||
|
||||
// ---------------- epic progress ----------------
|
||||
var epicItems = [
|
||||
{id:"MITHOME-86", t:"Alapinstallálás: config, MongoDB adapter, admin route", done:true},
|
||||
{id:"MITHOME-87", t:"Home/About/Services/Contact/Common Globals + JSON migráció", done:true},
|
||||
{id:"MITHOME-88", t:"LegalPages collection", done:false},
|
||||
{id:"MITHOME-89", t:"Partners + Media collection", done:false},
|
||||
{id:"MITHOME-90", t:"Users collection: admin bejelentkezés", done:false},
|
||||
{id:"MITHOME-91", t:"Frontend Local API átállás", done:false},
|
||||
{id:"MITHOME-92", t:"Draft/preview és verziózás", done:false},
|
||||
{id:"MITHOME-93", t:"Régi egyedi CMS leépítése", done:false},
|
||||
{id:"MITHOME-94", t:"ContactSubmissions collection", done:false},
|
||||
{id:"MITHOME-95", t:"Dokumentáció frissítése", done:false},
|
||||
{id:"MITHOME-96", t:"Tesztek migrálása", done:false},
|
||||
{id:"MITHOME-97", t:"Deploy/Docker frissítés", done:false},
|
||||
{id:"MITHOME-102", t:"Esemény-emisszió — PLATFM-2 séma", done:false},
|
||||
{id:"MITHOME-103", t:"Esemény-emisszió biztonsága", done:false},
|
||||
{id:"MITHOME-105", t:"MITHOME-31 lezárása a pilottal", done:false}
|
||||
];
|
||||
var epicBar = document.getElementById("epicBar");
|
||||
epicItems.forEach(function(it){
|
||||
var el = document.createElement("div");
|
||||
el.className = "seg";
|
||||
el.dataset.side = "mithome";
|
||||
el.innerHTML = '<span class="state '+(it.done?"done":"open")+'"></span>'+
|
||||
'<span class="id">'+it.id+'</span><span class="t">'+it.t+'</span>';
|
||||
epicBar.appendChild(el);
|
||||
});
|
||||
var doneCount = epicItems.filter(function(i){return i.done;}).length;
|
||||
document.getElementById("epicFill").style.width = Math.round(doneCount/epicItems.length*100)+"%";
|
||||
document.getElementById("epicLabel").textContent = doneCount+" / "+epicItems.length+" kész";
|
||||
|
||||
// ---------------- filter ----------------
|
||||
var buttons = document.querySelectorAll(".filterbar button");
|
||||
buttons.forEach(function(btn){
|
||||
btn.addEventListener("click", function(){
|
||||
buttons.forEach(function(b){ b.setAttribute("aria-pressed", b===btn ? "true":"false"); });
|
||||
var f = btn.dataset.filter;
|
||||
document.querySelectorAll('[data-side="mithome"]').forEach(function(n){
|
||||
n.classList.toggle("dim", f==="platfm");
|
||||
});
|
||||
document.querySelectorAll('[data-side="platfm"]').forEach(function(n){
|
||||
n.classList.toggle("dim", f==="mithome");
|
||||
});
|
||||
document.querySelectorAll('[data-side="bridge"]').forEach(function(n){
|
||||
n.classList.toggle("dim", f!=="all");
|
||||
});
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
+19
-5
@@ -1,9 +1,14 @@
|
||||
# Production környezeti változók — másold .env.production néven a prod szerveren!
|
||||
# Másold le és töltsd ki a valódi értékekkel. SOHA ne commitold.
|
||||
|
||||
# MongoDB (production saját konténere a docker-compose.prod.yml-ben)
|
||||
MONGODB_URI=mongodb://admin:password123@mongodb:27017/mozdit?authSource=admin
|
||||
MONGODB_DB=mozdit
|
||||
# PostgreSQL (MITHOME-136) — a weboldal saját adatbázisa (mozdit_web). A
|
||||
# compose ebből állítja össze a DATABASE_URI-t; URL-biztos jelszót használj
|
||||
# (pl. `openssl rand -hex 32`). Egyedi érték környezetenként.
|
||||
POSTGRES_USER=mozdit_web
|
||||
POSTGRES_PASSWORD=changeme
|
||||
|
||||
# MongoDB — MITHOME-136: csak az átállás idejére (visszaút és a tartalom-
|
||||
# átvitel forrása); egy kiadás múlva törlendő. Az app már nem használja.
|
||||
MONGO_ROOT_USER=admin
|
||||
MONGO_ROOT_PASSWORD=changeme
|
||||
|
||||
@@ -12,6 +17,16 @@ MONGO_ROOT_PASSWORD=changeme
|
||||
# environmenttel.
|
||||
PAYLOAD_SECRET=changeme
|
||||
|
||||
# Payload admin — ismert, biztosan létező admin fiók (MITHOME-97). A
|
||||
# deploy.sh minden deploy után meghívja a Payload "first-register" REST
|
||||
# endpointját ezekkel az adatokkal: teljesen friss (üres users collection-ű)
|
||||
# adatbázisnál létrehozza ezt a fiókot, egyébként (ha már van user)
|
||||
# ártalmatlanul kihagyja — nem írja felül a jelszót utólag. Generálj egyedi,
|
||||
# erős jelszót (pl. jelszókezelővel), NE ossz meg értéket a staginggel; a
|
||||
# hiányzó két érték esetén a deploy.sh csak kihagyja ezt a lépést.
|
||||
ADMIN_EMAIL=admin@mozdit.hu
|
||||
ADMIN_PASSWORD=changeme
|
||||
|
||||
# Publikus site URL (beég build időben a Dockerfile-ba)
|
||||
NEXT_PUBLIC_SITE_URL=https://mozdit.hu
|
||||
|
||||
@@ -20,8 +35,7 @@ NEXT_PUBLIC_COMPANY_NAME=mozdIT Bt.
|
||||
NEXT_PUBLIC_CONTACT_EMAIL=info@mozdit.hu
|
||||
NEXT_PUBLIC_WEBMAIL_URL=https://webmail.mozdit.hu
|
||||
|
||||
# Logging — Loki (ha van)
|
||||
LOKI_HOST=http://loki:3100
|
||||
# Az alkalmazáslogok stdout/stderr-re kerülnek; a központi gyűjtést a host kezeli.
|
||||
|
||||
# Production app port a hoston (belső, nginx-en át)
|
||||
APP_PORT=8080
|
||||
|
||||
+19
-5
@@ -1,9 +1,14 @@
|
||||
# Staging környezeti változók — másold .env.staging néven a szerveren!
|
||||
# Másold le és töltsd ki a valódi értékekkel. SOHA ne commitold.
|
||||
|
||||
# MongoDB (staging saját konténere a docker-compose.staging.yml-ben)
|
||||
MONGODB_URI=mongodb://admin:password123@mongodb:27017/mozdit?authSource=admin
|
||||
MONGODB_DB=mozdit
|
||||
# PostgreSQL (MITHOME-136) — a weboldal saját adatbázisa (mozdit_web). A
|
||||
# compose ebből állítja össze a DATABASE_URI-t; URL-biztos jelszót használj
|
||||
# (pl. `openssl rand -hex 32`). Egyedi érték környezetenként.
|
||||
POSTGRES_USER=mozdit_web
|
||||
POSTGRES_PASSWORD=changeme
|
||||
|
||||
# MongoDB — MITHOME-136: csak az átállás idejére (visszaút és a tartalom-
|
||||
# átvitel forrása); egy kiadás múlva törlendő. Az app már nem használja.
|
||||
MONGO_ROOT_USER=admin
|
||||
MONGO_ROOT_PASSWORD=changeme
|
||||
|
||||
@@ -12,6 +17,16 @@ MONGO_ROOT_PASSWORD=changeme
|
||||
# environmenttel.
|
||||
PAYLOAD_SECRET=changeme
|
||||
|
||||
# Payload admin — ismert, biztosan létező admin fiók (MITHOME-97). A
|
||||
# deploy.sh minden deploy után meghívja a Payload "first-register" REST
|
||||
# endpointját ezekkel az adatokkal: teljesen friss (üres users collection-ű)
|
||||
# adatbázisnál létrehozza ezt a fiókot, egyébként (ha már van user)
|
||||
# ártalmatlanul kihagyja — nem írja felül a jelszót utólag. Generálj egyedi,
|
||||
# erős jelszót (pl. jelszókezelővel); a hiányzó két érték esetén a
|
||||
# deploy.sh csak kihagyja ezt a lépést, nem hibázik el.
|
||||
ADMIN_EMAIL=admin@mozdit.hu
|
||||
ADMIN_PASSWORD=changeme
|
||||
|
||||
# Publikus site URL (beég build időben a Dockerfile-ba)
|
||||
NEXT_PUBLIC_SITE_URL=https://stage.mozdit.hu
|
||||
|
||||
@@ -20,8 +35,7 @@ NEXT_PUBLIC_COMPANY_NAME=mozdIT Bt.
|
||||
NEXT_PUBLIC_CONTACT_EMAIL=info@mozdit.hu
|
||||
NEXT_PUBLIC_WEBMAIL_URL=https://webmail.mozdit.hu
|
||||
|
||||
# Logging — Loki (ha van)
|
||||
LOKI_HOST=http://loki:3100
|
||||
# Az alkalmazáslogok stdout/stderr-re kerülnek; a központi gyűjtést a host kezeli.
|
||||
|
||||
# Staging app port a hoston (belső, nginx-en át)
|
||||
APP_PORT=8081
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
---
|
||||
description: "Implement tasks from an OpenSpec change (Experimental)"
|
||||
---
|
||||
|
||||
Implement tasks from an OpenSpec change.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
||||
|
||||
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
||||
|
||||
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
||||
|
||||
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
||||
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
||||
|
||||
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
||||
|
||||
**Input**: Optionally specify a change name (e.g., `/opsx-apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
**Provided arguments**: $ARGUMENTS
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx-apply <other>`).
|
||||
|
||||
2. **Check status to understand the schema**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to understand:
|
||||
- `schemaName`: The workflow being used (e.g., "spec-driven")
|
||||
- `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints
|
||||
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
|
||||
|
||||
3. **Get apply instructions**
|
||||
|
||||
```bash
|
||||
openspec instructions apply --change "<name>" --json
|
||||
```
|
||||
|
||||
This returns:
|
||||
- `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
|
||||
- Progress (total, complete, remaining)
|
||||
- Task list with status
|
||||
- Dynamic instruction based on current state
|
||||
- Optional `context`: current required project instruction input from the selected root
|
||||
- Optional `operationGuidance`: current advisory guidance for apply
|
||||
- `missingArtifacts` (when present): required artifact ids with no output
|
||||
|
||||
**Handle states:**
|
||||
- If `state: "blocked"`: show the message and pause implementation.
|
||||
- If `missingArtifacts` is non-empty: suggest completing the missing artifacts. Run `openspec status --change "<name>" --json`, select the next `ready` artifact (not `skipped` or `blocked`), and use `openspec instructions "<artifact-id>" --change "<name>" --json` for its rules and template. Keep the selected `--store <id>` on both commands.
|
||||
- Otherwise, follow the CLI instruction to create or repair the schema-configured tracking file from existing planning artifacts. Do not assume another artifact is ready or start implementation while blocked.
|
||||
- If `state: "all_done"`: congratulate, suggest archive
|
||||
- Otherwise: proceed to implementation
|
||||
|
||||
Treat `context` as a required prompt-level input. Read and consider it, and
|
||||
apply relevant project facts, conventions, and constraints while implementing.
|
||||
Treat `operationGuidance` as optional additive advice. Read and consider every
|
||||
entry, and follow entries that are applicable and compatible with the built-in
|
||||
workflow.
|
||||
|
||||
Keep both fields separate from CLI-returned state, missing artifacts, tasks,
|
||||
progress, `contextFiles`, and the built-in `instruction`. They are not
|
||||
evidence of task completion, do not replace the built-in instruction, and do
|
||||
not permit bypassing a blocked state. If context conflicts with the built-in
|
||||
instruction, an explicit user choice, or a CLI-controlled value, report the
|
||||
conflict and preserve the controlling value. If guidance is inapplicable or
|
||||
conflicts with those controlling inputs, do not follow it and explain why.
|
||||
These are prompt-level behavior contracts, not enforceable checks.
|
||||
|
||||
4. **Read context files**
|
||||
|
||||
Read every file path listed under `contextFiles` from the apply instructions output.
|
||||
The files depend on the schema being used:
|
||||
- **spec-driven**: proposal, specs, design, tasks
|
||||
- Other schemas: follow the contextFiles from CLI output
|
||||
|
||||
Do not copy `context` or `operationGuidance` verbatim into implementation
|
||||
files or planning artifacts unless the user separately asks for that content.
|
||||
|
||||
5. **Show current progress**
|
||||
|
||||
Display:
|
||||
- Schema being used
|
||||
- Progress: "N/M tasks complete"
|
||||
- Remaining tasks overview
|
||||
- Dynamic instruction from CLI
|
||||
|
||||
6. **Implement tasks (loop until done or blocked)**
|
||||
|
||||
For each pending task:
|
||||
- Show which task is being worked on
|
||||
- Make the code changes required
|
||||
- Keep changes minimal and focused
|
||||
- Mark task complete in the tasks file: `- [ ]` → `- [x]`
|
||||
- Continue to next task
|
||||
|
||||
**Pause if:**
|
||||
- Task is unclear → ask for clarification
|
||||
- Implementation reveals a design issue → suggest updating artifacts
|
||||
- A task needs work beyond what the spec and tasks describe, or you are tempted to drop, narrow, defer, or accept exceptions to specified behavior to make it fit → surface the added scope and ask; do not absorb it silently
|
||||
- Error or blocker encountered → report and wait for guidance
|
||||
- User interrupts
|
||||
|
||||
7. **On completion or pause, show status**
|
||||
|
||||
Display:
|
||||
- Tasks completed this session
|
||||
- Overall progress: "N/M tasks complete"
|
||||
- If all done: suggest archive
|
||||
- If paused: explain why and wait for guidance
|
||||
|
||||
**Output During Implementation**
|
||||
|
||||
```
|
||||
## Implementing: <change-name> (schema: <schema-name>)
|
||||
|
||||
Working on task 3/7: <task description>
|
||||
[...implementation happening...]
|
||||
✓ Task complete
|
||||
|
||||
Working on task 4/7: <task description>
|
||||
[...implementation happening...]
|
||||
✓ Task complete
|
||||
```
|
||||
|
||||
**Output On Completion**
|
||||
|
||||
```
|
||||
## Implementation Complete
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Progress:** 7/7 tasks complete ✓
|
||||
|
||||
### Completed This Session
|
||||
- [x] Task 1
|
||||
- [x] Task 2
|
||||
...
|
||||
|
||||
All tasks complete! You can archive this change with `/opsx-archive`.
|
||||
```
|
||||
|
||||
**Output On Pause (Issue Encountered)**
|
||||
|
||||
```
|
||||
## Implementation Paused
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Progress:** 4/7 tasks complete
|
||||
|
||||
### Issue Encountered
|
||||
<description of the issue>
|
||||
|
||||
**Options:**
|
||||
1. <option 1>
|
||||
2. <option 2>
|
||||
3. Other approach
|
||||
|
||||
What would you like to do?
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Keep going through tasks until done or blocked
|
||||
- Always read context files before starting (from the apply instructions output)
|
||||
- If task is ambiguous, pause and ask before implementing
|
||||
- If implementation reveals issues, pause and suggest artifact updates
|
||||
- Keep code changes minimal and scoped to each task
|
||||
- Update task checkbox immediately after completing each task
|
||||
- Pause on errors, blockers, or unclear requirements - don't guess
|
||||
- When a task needs work beyond what the spec describes, surface the added scope and pause - never silently narrow, defer, or simplify away specified behavior
|
||||
- Only mark a task `- [x]` when its specified behavior is fully implemented, not when it is partially done or deferred
|
||||
- Use contextFiles from CLI output, don't assume specific file names
|
||||
- Do not use context or operation guidance as proof that a task is complete
|
||||
- Apply relevant project context; report conflicts with controlling workflow inputs
|
||||
- Consider every guidance entry; explain any inapplicable or conflicting advice
|
||||
- Do not copy runtime context or operation guidance into implementation files or planning artifacts
|
||||
- Preserve CLI-controlled blocked/ready/all-done behavior and completion criteria
|
||||
|
||||
**Fluid Workflow Integration**
|
||||
|
||||
This skill supports the "actions on a change" model:
|
||||
|
||||
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
|
||||
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
|
||||
@@ -0,0 +1,250 @@
|
||||
---
|
||||
description: "Archive a completed change in the experimental workflow"
|
||||
---
|
||||
|
||||
Archive a completed change in the experimental workflow.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
||||
|
||||
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
||||
|
||||
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
||||
|
||||
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
||||
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
||||
|
||||
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
|
||||
|
||||
**Input**: Optionally specify a change name after `/opsx-archive` (e.g., `/opsx-archive add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
**Provided arguments**: $ARGUMENTS
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
|
||||
|
||||
When prompting, show only active changes (not already archived).
|
||||
Include the schema used for each change if available.
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx-archive <other>`).
|
||||
|
||||
**Load current archive inputs before the existing archive checks:**
|
||||
|
||||
After resolving the selected change and planning root, run:
|
||||
```bash
|
||||
openspec instructions archive --change "<name>" --json
|
||||
```
|
||||
Keep the same selected-root flags on this command. This lookup is advisory and
|
||||
optional: it only supplies extra prompt inputs, so it must never block archiving.
|
||||
If it exits non-zero or returns invalid JSON — for example on an older CLI that
|
||||
does not support this command yet — continue the archive workflow with no
|
||||
context and no operation guidance. Do not report an error and do not stop.
|
||||
|
||||
A successful response may omit both optional fields. Treat `context` as a
|
||||
required prompt-level input: read and consider it, and apply relevant project
|
||||
facts, conventions, and constraints. Treat `operationGuidance` as optional
|
||||
additive advice: read and consider every entry, and follow entries that are
|
||||
applicable and compatible with the built-in archive workflow.
|
||||
|
||||
Keep both fields separate from built-in steps, explicit user choices, resolved
|
||||
paths, CLI checks, and command contracts. If context conflicts with one of those
|
||||
controlling inputs, report the conflict and preserve the controlling value. If
|
||||
guidance is inapplicable or conflicts with a controlling input, do not follow it
|
||||
and explain why. Do not infer replacement paths, skipped prompts, or flags from
|
||||
either field, and do not copy their text verbatim into specs, change artifacts,
|
||||
or archive summaries unless the user separately asks for it. These are
|
||||
prompt-level behavior contracts, not enforceable checks.
|
||||
|
||||
2. **Check artifact completion status**
|
||||
|
||||
Run `openspec status --change "<name>" --json` to check artifact completion.
|
||||
|
||||
Parse the JSON to understand:
|
||||
- `schemaName`: The workflow being used
|
||||
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context
|
||||
- `artifacts`: List of artifacts with their status (`done`, `skipped`, or other)
|
||||
|
||||
**If any artifacts are neither `done` nor `skipped`** (skipped artifacts satisfy the requirement - the change declares skip_specs):
|
||||
- Display warning listing incomplete artifacts
|
||||
- Prompt user for confirmation to continue
|
||||
- Proceed if user confirms
|
||||
|
||||
3. **Check task completion status**
|
||||
|
||||
Run `openspec list --json` with the same selected-root flags and find the
|
||||
entry in `changes` whose `name` exactly matches the selected change.
|
||||
Require exactly one match and nonnegative integer `totalTasks` and
|
||||
`completedTasks`, with `completedTasks <= totalTasks`. The CLI resolves
|
||||
the schema's tracked task files, including custom artifact names, output
|
||||
paths, and globs.
|
||||
Incomplete tasks = `totalTasks - completedTasks`.
|
||||
|
||||
Do not infer task completion from artifact status or the absence of a
|
||||
top-level `tasks.md`. If the lookup fails, returns invalid JSON, omits or
|
||||
duplicates the selected change, or returns invalid counts, report the problem
|
||||
and stop before syncing or archiving.
|
||||
The CLI counts only `x`/`X` checkbox markers as complete;
|
||||
other markers, including unfamiliar ones, remain incomplete.
|
||||
|
||||
**If incomplete tasks found:**
|
||||
- Display warning showing count of incomplete tasks
|
||||
- Prompt user for confirmation to continue
|
||||
- Proceed if user confirms
|
||||
|
||||
**If `totalTasks` is zero:** Proceed without a task-related warning.
|
||||
|
||||
4. **Assess delta spec sync state**
|
||||
|
||||
Use `artifactPaths.specs.existingOutputPaths` from status JSON as the only
|
||||
delta-spec source. If the `specs` entry is missing or
|
||||
`existingOutputPaths` is empty, proceed without a sync prompt and do not infer
|
||||
delta specs from other artifacts.
|
||||
|
||||
**If delta specs exist:**
|
||||
- Compare each delta spec with its corresponding main spec at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (use the store-aware `planningHome.root` from step 2, not a hardcoded repo path)
|
||||
- A missing main spec is **not automatically** "already synced". For a new capability, the main spec is an *output* of the sync, not an input:
|
||||
- If the delta has MODIFIED or RENAMED requirements, report that only ADDED requirements can create a new main spec and mark that capability as sync-blocked. Never invent a requirement that has no current version.
|
||||
- Otherwise, if the delta has only REMOVED requirements and the change's `.openspec.yaml` declares `retire_capabilities: true`, the capability is already retired: count it as already synced, warn that there is nothing left to remove, and do not recreate the main spec. Apply this rule both now and when verifying a completed sync.
|
||||
- Otherwise, if the delta has no ADDED requirements, report that no sync is possible and mark that capability as sync-blocked. For a REMOVED-only delta, warn that there is no main spec to remove from and leave the main-spec tree unchanged. `openspec archive` refuses the unmarked REMOVED-only case with `Spec must have at least one requirement`.
|
||||
- Otherwise, count the capability as needing sync and name it in the summary (`<capability-path>: new main spec will be created`). If the delta also has REMOVED requirements, warn that they will be ignored because there is no main spec to remove from. The sync creates the main spec from only the delta's ADDED requirements, exactly as `openspec archive` does.
|
||||
- Determine what changes would be applied (adds, modifications, removals, renames)
|
||||
- Continue assessing the remaining capabilities even when one is sync-blocked. Show a combined summary before prompting.
|
||||
|
||||
**Prompt options:**
|
||||
- If any capability is sync-blocked: explain why and offer only "Archive without syncing", "Cancel"
|
||||
- Otherwise, if changes needed: "Sync now (recommended)", "Archive without syncing"
|
||||
- Otherwise, if already synced: "Archive now", "Sync anyway", "Cancel"
|
||||
|
||||
Route on the answer:
|
||||
- "Cancel" — stop, do not archive
|
||||
- "Archive without syncing" or "Archive now" — proceed to archive
|
||||
- "Sync now" or "Sync anyway" — sync, then verify (below). Do not start any sync while a capability is sync-blocked; explain the blocker and repeat the available choices.
|
||||
- Anything else — ask again rather than archiving
|
||||
|
||||
Before a selected sync writes any main spec, run
|
||||
`openspec instructions specs --change "<name>" --json` once with the same
|
||||
selected-root flags. Require a zero exit status and valid artifact-instruction
|
||||
JSON. If the lookup fails or returns invalid JSON, report the error and stop
|
||||
before writing any main spec or moving the change. A valid response with omitted
|
||||
`rules` is the no-rules case. Apply returned `rules` only to the content and
|
||||
form of main specs produced by this merge; do not use them as archive guidance,
|
||||
change CLI behavior, or copy the rule text into any output file.
|
||||
|
||||
Then run the `/opsx-sync` workflow inline (agent-driven intelligent merge) for change '<name>', passing the delta spec analysis and the fetched specs-rule snapshot from above, and wait for it to finish. The inline sync must reuse that snapshot without fetching `specs` instructions again. Do not delegate it to a background task — step 5 would move `changeRoot` out from under a sync that is still reading it, leaving the change archived and the main specs never updated. If your agent can only run it by delegation, delegate synchronously and wait for the result.
|
||||
|
||||
Then re-run the comparison from the top of this step, including the explicitly retired, missing-spec case, against every capability that has a delta spec in `artifactPaths.specs.existingOutputPaths` — not only the ones the sync reports it touched. A successful sync leaves nothing left to apply, so each capability must now read as already synced:
|
||||
- ADDED requirements present
|
||||
- MODIFIED requirements carrying the scenario and description changes named in the delta, with their other scenarios intact
|
||||
- REMOVED requirements gone — and where this sync retired a capability (removed its last requirement, leaving `## Requirements` empty), its main spec deleted rather than left empty; a spec the sync deliberately kept and reported is also a match
|
||||
- RENAMED requirements present under the new name and absent under the old one
|
||||
|
||||
If the sync failed, or any capability does not match, report what differs and stop — do not archive. Nothing has moved and `changeRoot` is intact, so the user can fix the mismatch or re-run the sync and start the archive again.
|
||||
|
||||
5. **Perform the archive**
|
||||
|
||||
Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
|
||||
```bash
|
||||
mkdir -p "<planningHome.changesDir>/archive"
|
||||
```
|
||||
|
||||
Generate the target name: use the change name as-is when it already starts with a `YYYY-MM-DD-` prefix; otherwise prepend the current date as `YYYY-MM-DD-<change-name>`. Never stack a second date (same rule as `openspec archive`).
|
||||
|
||||
**Check if target already exists:**
|
||||
- If yes: Fail with error, suggest renaming existing archive or using different date
|
||||
- If no: Move `changeRoot` to the archive directory
|
||||
|
||||
```bash
|
||||
mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
|
||||
```
|
||||
|
||||
6. **Display summary**
|
||||
|
||||
Show archive completion summary including:
|
||||
- Change name
|
||||
- Schema that was used
|
||||
- Archive location
|
||||
- Spec sync status (synced / sync skipped / no delta specs)
|
||||
- Note about any warnings (incomplete artifacts/tasks)
|
||||
|
||||
**Output On Success**
|
||||
|
||||
```markdown
|
||||
## Archive Complete
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
|
||||
**Specs:** ✓ Synced to main specs
|
||||
|
||||
All artifacts complete. All tasks complete.
|
||||
```
|
||||
|
||||
**Output On Success (No Delta Specs)**
|
||||
|
||||
```markdown
|
||||
## Archive Complete
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
|
||||
**Specs:** No delta specs
|
||||
|
||||
All artifacts complete. All tasks complete.
|
||||
```
|
||||
|
||||
**Output On Success With Warnings**
|
||||
|
||||
```markdown
|
||||
## Archive Complete (with warnings)
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
|
||||
**Specs:** Sync skipped (user chose to skip)
|
||||
|
||||
**Warnings:**
|
||||
- Archived with 2 incomplete artifacts
|
||||
- Archived with 3 incomplete tasks
|
||||
- Delta spec sync was skipped (user chose to skip)
|
||||
|
||||
Review the archive if this was not intentional.
|
||||
```
|
||||
|
||||
**Output On Error (Archive Exists)**
|
||||
|
||||
```markdown
|
||||
## Archive Failed
|
||||
|
||||
**Change:** <change-name>
|
||||
**Target:** the archive path derived from `planningHome.changesDir`/<target-name>/
|
||||
|
||||
Target archive directory already exists.
|
||||
|
||||
**Options:**
|
||||
1. Rename the existing archive
|
||||
2. Delete the existing archive if it's a duplicate
|
||||
3. Wait until a different date to archive
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Announce the selected change; prompt for selection when it is ambiguous
|
||||
- Use artifact graph (openspec status --json) for completion checking
|
||||
- Don't block archive on warnings - just inform and confirm
|
||||
- Preserve .openspec.yaml when moving to archive (it moves with the directory)
|
||||
- Show clear summary of what happened
|
||||
- If sync is requested, run the `/opsx-sync` workflow inline (agent-driven)
|
||||
- Never archive while a spec sync is still in flight — run the sync inline and verify the main specs before moving `changeRoot`
|
||||
- If delta specs exist, always run the sync assessment and show the combined summary before prompting
|
||||
- Apply relevant runtime context and report conflicts; operation guidance remains advisory
|
||||
- Consider every guidance entry and explain any inapplicable or conflicting advice
|
||||
- Existing CLI checks, resolved paths, prompts, and command contracts are unchanged
|
||||
- Artifact rules constrain only the specs being written and are never operation guidance
|
||||
- Never copy runtime context, operation guidance, or artifact-rule text verbatim into output files
|
||||
@@ -0,0 +1,236 @@
|
||||
---
|
||||
description: "Enter explore mode - think through ideas, investigate problems, clarify requirements"
|
||||
---
|
||||
|
||||
Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
|
||||
|
||||
**IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, investigate the codebase, and run read-only commands or tools without confirmation, but you must NEVER write code or implement features. If the user asks you to implement something, do not start it here: say that explore mode does not implement, and point them at `/opsx-propose`, which turns the discussion into a change. The work happens from that change, never from explore mode. You MAY create or update OpenSpec change artifacts (proposals, designs, specs) within a confirmed scope—that's capturing thinking, not implementing. Answering design or clarifying questions is never consent to write. Before the first write-capable action, name the artifacts or files you would change and what you would do, ask a direct yes/no question, and wait for the user's confirmation in a separate message. Confirmation covers only the scope you described; ask again before expanding it. An explicit request from the user to capture the exploration as a new change is itself that confirmation, covering the change and the change artifacts the request names; scaffold it first as described below.
|
||||
|
||||
**This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
||||
|
||||
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
||||
|
||||
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
||||
|
||||
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
||||
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
||||
|
||||
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
||||
|
||||
**Input**: The argument after `/opsx-explore` is whatever the user wants to think about. Could be:
|
||||
- A vague idea: "real-time collaboration"
|
||||
- A specific problem: "the auth system is getting unwieldy"
|
||||
- A change name: "add-dark-mode" (to explore in context of that change)
|
||||
- A comparison: "postgres vs sqlite for this"
|
||||
- Nothing (just enter explore mode)
|
||||
**Provided arguments**: $ARGUMENTS
|
||||
|
||||
---
|
||||
|
||||
## The Stance
|
||||
|
||||
- **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
|
||||
- **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
|
||||
- **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
|
||||
- **Adaptive** - Follow interesting threads, pivot when new information emerges
|
||||
- **Patient** - Don't rush to conclusions, let the shape of the problem emerge
|
||||
- **Grounded** - Explore the actual codebase when relevant, don't just theorize
|
||||
|
||||
---
|
||||
|
||||
## Planning a Change
|
||||
|
||||
When the user is planning a change, guide them toward shared understanding with focused discovery questions. For open-ended discussion, follow the conversation without imposing an interview or a required output.
|
||||
|
||||
Before asking a factual question, follow the context discovery below and inspect relevant OpenSpec artifacts, source, tests, docs, and configuration. Do not ask the user to repeat facts you can verify. Summarize relevant findings without reproducing private context or rules. If evidence is missing, conflicting, or inaccessible, state that limitation and ask only for the clarification needed to proceed.
|
||||
|
||||
- **Follow dependencies** - Resolve the next blocking decision before its dependent details. For example, clarify the user's outcome and scope before choosing an API or data model. Revisit downstream assumptions when an earlier answer changes. Skip branches that do not matter to this goal.
|
||||
- **Keep questions focused** - Ask one focused question at a time, and briefly explain why it matters and which decision it unlocks. Batch questions only if the user asks for a batch; keep them small and group related decisions.
|
||||
- **Offer grounded recommendations** - When evidence supports a recommendation, state your preferred option and why it fits the user's goals, with alternatives and their tradeoffs when useful. Do not invent intent, priorities, or external constraints: ask the user when only they can answer. Avoid a fixed question format.
|
||||
- **Keep a conversational record** - Track decisions in the conversation, not in files. Separate confirmed decisions from proposed defaults and unresolved questions. Silence is not acceptance. Accepting an answer or a batch of recommendations is not permission to write. Keep file-write confirmation separate from discovery questions and follow the guardrails below.
|
||||
|
||||
Stop asking when the user has enough clarity. Let them pause, pivot, or defer a decision; do not exhaust every branch or force a proposal.
|
||||
|
||||
For example, after inspecting the relevant code:
|
||||
|
||||
```text
|
||||
The CLI already uses SQLite and has no remote service. Is sharing state
|
||||
across devices in scope? That determines whether local storage is enough.
|
||||
If this stays a single-device tool, I recommend keeping SQLite to avoid
|
||||
adding a service to operate; shared state would need a separate sync design.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## What You Might Do
|
||||
|
||||
Depending on what the user brings, you might:
|
||||
|
||||
**Explore the problem space**
|
||||
- Ask clarifying questions that emerge from what they said
|
||||
- Challenge assumptions
|
||||
- Reframe the problem
|
||||
- Find analogies
|
||||
|
||||
**Investigate the codebase**
|
||||
- Map existing architecture relevant to the discussion
|
||||
- Find integration points
|
||||
- Identify patterns already in use
|
||||
- Surface hidden complexity
|
||||
|
||||
**Compare options**
|
||||
- Brainstorm multiple approaches
|
||||
- Build comparison tables
|
||||
- Sketch tradeoffs
|
||||
- Recommend a path (if asked)
|
||||
|
||||
**Visualize**
|
||||
```
|
||||
+------------------------------------------+
|
||||
| Use ASCII diagrams liberally |
|
||||
+------------------------------------------+
|
||||
| |
|
||||
| [State A] -------> [State B] |
|
||||
| | |
|
||||
| v |
|
||||
| [State C] |
|
||||
| |
|
||||
| System diagrams, state machines, |
|
||||
| data flows, architecture sketches, |
|
||||
| dependency graphs, comparison tables |
|
||||
| |
|
||||
+------------------------------------------+
|
||||
```
|
||||
|
||||
**Draw with plain ASCII only** — borders `+` `-` `|`, arrows `-->` `<--` `^` `v`, markers `*` `x`.
|
||||
Unicode diagram glyphs can render at different widths across terminals, fonts, and locales, so padded boxes and aligned tables can drift. Keep every diagram character ASCII.
|
||||
|
||||
**Surface risks and unknowns**
|
||||
- Identify what could go wrong
|
||||
- Find gaps in understanding
|
||||
- Suggest spikes or investigations
|
||||
|
||||
---
|
||||
|
||||
## OpenSpec Awareness
|
||||
|
||||
You have full context of the OpenSpec system. Use it naturally, don't force it.
|
||||
|
||||
### Check for context
|
||||
|
||||
At the start, quickly check what exists:
|
||||
```bash
|
||||
openspec list --json
|
||||
```
|
||||
|
||||
This tells you:
|
||||
- If there are active changes
|
||||
- Their names and task status
|
||||
- What the user might be working on
|
||||
|
||||
That is the *change* list - work in flight. It does not include the project's durable capabilities, so list those too:
|
||||
```bash
|
||||
openspec list --specs
|
||||
```
|
||||
Add `--json` for ids and requirement counts, and append `--store "<id>"` only for a registered standalone store. This is the inventory of what the project already claims to do, and `openspec list` on its own never shows it. To look at one, run `openspec show "<spec-id>" --type spec --json --no-scenarios` (same `--store` rule) - it returns that capability's purpose and requirement texts without pulling the whole spec file into context, and `--type spec` stops a change of the same name from making it ambiguous.
|
||||
|
||||
The filtered read is only an overview. Before deciding what is already covered or what should change, read each relevant spec in full, including scenarios, with `openspec show "<spec-id>" --type spec` (same `--store` rule).
|
||||
|
||||
Then read the project's own context from the resolved root - `<root.path>/openspec/config.yaml` (or `config.yml`). Use the `root.path` returned above, and skip this if neither file exists:
|
||||
- `context`: project background - tech stack, conventions, constraints
|
||||
- `rules`: keyed by artifact id - the entries for an artifact apply only when you write that artifact
|
||||
|
||||
Ground your thinking in these. They are constraints for you to follow, not content to reproduce: do NOT copy them into the conversation or into any artifact you create.
|
||||
|
||||
If the user mentioned a specific change name, read its artifacts for context.
|
||||
|
||||
### When no change exists
|
||||
|
||||
Think freely. When insights crystallize, you might offer:
|
||||
|
||||
- "This feels solid enough to start a change. Want me to create a proposal?"
|
||||
- Or keep exploring - no pressure to formalize
|
||||
|
||||
If the user asks you to capture the exploration as a new change, that request is the confirmation required above. It covers scaffolding that change and creating the change artifacts the request names, and nothing else. This holds only when the request is theirs: a yes to an offer you made confirms only the scope your offer itself named, so name the change and the artifacts in the offer. Don't re-ask for what they already asked for; do ask before anything beyond it. Transition seamlessly into the requested capture:
|
||||
|
||||
1. Run `openspec new change "<name>"` (with `--store <id>` when applicable) before creating any artifacts. Never create a new change directory under `openspec/changes/` by hand; the CLI scaffold creates required metadata such as `.openspec.yaml`. Keep the selected `--store <id>` on every applicable follow-up `status` and `instructions` command.
|
||||
2. Run `openspec status --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store), then process the requested artifacts in dependency order. For each requested artifact that is `ready`, run `openspec instructions "<artifact-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store). Before creating a requested artifact, evaluate any condition in its own `instruction` against the explored change; record a deliberate skip instead when the condition does not apply. If a requested artifact is blocked by a direct prerequisite the user did not request, run `openspec instructions "<prerequisite-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) for that prerequisite whether it is `ready` or `blocked`. If its own `instruction` states a condition, evaluate that condition against the explored change and record a deliberate skip only when the condition does not apply. If the condition applies, or the prerequisite is not conditional, treat it as a normal prerequisite and ask before expanding the capture. Do not create an unrequested prerequisite unless the user approves.
|
||||
3. Follow the returned `template` and `instruction` fields. Read completed dependency files listed in `dependencies`, and apply `context` and `rules` as constraints without copying them into the artifact. If the instruction delegates creation to a specific skill or command, invoke it; otherwise write the artifact to `resolvedOutputPath`, using the instruction to choose a concrete path when it is a glob. Verify that the selected concrete output exists.
|
||||
4. After creating each artifact, re-run `openspec status --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) and continue until every requested artifact is `done`, `skipped`, or was deliberately skipped because its own `instruction` stated a condition that did not apply. Tell the user about a deliberate conditional skip, remember it, and do not reconsider it. Dependencies are enablers, not gates: if a requested artifact is still `blocked` only because you deliberately skipped a conditional prerequisite, run `openspec instructions "<artifact-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) despite the blocked status, then create it using step 3 only when those recorded conditional skips are its sole missing dependencies. If a requested artifact is blocked by a prerequisite the user did not ask to capture and cannot be conditionally skipped, explain that dependency and ask before expanding the capture.
|
||||
|
||||
Capture the artifact(s) the user requested without asking them to invoke another workflow command. If they asked only to start a change, stop after scaffolding and show its status. When the requested capture is done, stop there and name where the work continues: `/opsx-propose` writes the remaining planning artifacts, and `/opsx-apply` implements the change once tasks exist. Capturing artifacts never starts implementing them.
|
||||
|
||||
### When a change exists
|
||||
|
||||
If the user mentions a change or you detect one is relevant:
|
||||
|
||||
1. **Resolve and read existing artifacts for context**
|
||||
- Run `openspec status --change "<name>" --json`.
|
||||
- Use `changeRoot`, `artifactPaths`, and `actionContext` from the status JSON.
|
||||
- Read existing files from `artifactPaths.<artifact>.existingOutputPaths`.
|
||||
|
||||
2. **Reference them naturally in conversation**
|
||||
- "Your design mentions using Redis, but we just realized SQLite fits better..."
|
||||
- "The proposal scopes this to premium users, but we're now thinking everyone..."
|
||||
|
||||
3. **Offer to capture when decisions are made**
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
|
||||
|
||||
| Insight Type | Where to Capture |
|
||||
|----------------------------|-------------------------------------|
|
||||
| New requirement discovered | `specs/<capability-path>/spec.md` |
|
||||
| Requirement changed | `specs/<capability-path>/spec.md` |
|
||||
| Design decision made | `design.md` |
|
||||
| Scope changed | `proposal.md` |
|
||||
| New work identified | `tasks.md` |
|
||||
| Assumption invalidated | Relevant artifact |
|
||||
|
||||
Example offers:
|
||||
- "That's a design decision. Capture it in design.md?"
|
||||
- "This is a new requirement. Add it to specs?"
|
||||
- "This changes scope. Update the proposal?"
|
||||
|
||||
4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
|
||||
|
||||
---
|
||||
|
||||
## What You Don't Have To Do
|
||||
|
||||
- Follow a script
|
||||
- Ask the same questions every time
|
||||
- Produce a specific artifact
|
||||
- Reach a conclusion
|
||||
- Stay on topic if a tangent is valuable
|
||||
- Be brief (this is thinking time)
|
||||
|
||||
---
|
||||
|
||||
## Ending Discovery
|
||||
|
||||
There's no required ending. Discovery might:
|
||||
|
||||
- **Flow into a proposal**: "Ready to start? Run `/opsx-propose` and this becomes a change."
|
||||
- **Result in artifact updates**: "Updated design.md with these decisions"
|
||||
- **Just provide clarity**: User has what they need, moves on
|
||||
- **Continue later**: "We can pick this up anytime"
|
||||
|
||||
When things crystallize, you might offer a summary - but it's optional. Sometimes the thinking IS the value.
|
||||
|
||||
---
|
||||
|
||||
## Guardrails
|
||||
|
||||
- **Don't implement** - Never write code or implement features. Workflow configuration counts too: creating or editing schemas, templates, or `openspec/config.yaml` is a change, not thinking. Creating or updating OpenSpec change artifacts within the confirmed scope is fine, writing anything else is not. When the user is ready to build, name the handoff rather than starting: `/opsx-propose` turns the discussion into a change, and the work happens there.
|
||||
- **Don't fake understanding** - If something is unclear, dig deeper
|
||||
- **Don't rush** - Discovery is thinking time, not task time
|
||||
- **Don't force structure** - Let patterns emerge naturally
|
||||
- **Don't auto-capture** - Offer to save insights, don't just do it. Read-only commands and tools need no confirmation. Before the first write-capable action—including `openspec new change` or another command that writes files—name the artifacts or files and proposed changes, ask a direct yes/no question, and wait for explicit confirmation in a separate user message. That confirmation covers only the described scope; ask again before expanding it. Answers to design or clarifying questions are never consent to write. That rule governs `openspec new change` whenever you are the one proposing the capture; the user's own capture request is the exception, handled in the capture transition above.
|
||||
- **Don't manually scaffold changes** - Never create a new change directory under `openspec/changes/` by hand. Always use `openspec new change "<name>"` (with `--store <id>` when applicable) so required metadata such as `.openspec.yaml` is created before writing artifacts.
|
||||
- **Do visualize** - A good diagram is worth many paragraphs
|
||||
- **Do explore the codebase** - Ground discussions in reality
|
||||
- **Do question assumptions** - Including the user's and your own
|
||||
@@ -0,0 +1,167 @@
|
||||
---
|
||||
description: "Propose a new change - create it and generate all artifacts in one step"
|
||||
---
|
||||
|
||||
Propose a new change - create the change and generate all artifacts in one step.
|
||||
|
||||
**Planning boundary**: This workflow creates planning artifacts only. The user request that selected or triggered this workflow authorizes planning only, even if it asks to build or fix something. Do not edit project code. After the planning artifacts are complete, stop. Do not start implementation in the same response, even if the initial request asks for it. Wait for a new user request after the artifacts are presented; then start the apply workflow.
|
||||
|
||||
I'll create a change with the artifacts your schema defines. With the default spec-driven schema that is:
|
||||
- proposal.md (what & why)
|
||||
- `specs/<capability-path>/spec.md` (what the system must do - a delta, not the main spec)
|
||||
- design.md (how)
|
||||
- tasks.md (implementation steps)
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
|
||||
|
||||
When the user is ready to implement, they must start the apply workflow explicitly.
|
||||
|
||||
---
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
||||
|
||||
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
||||
|
||||
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
||||
|
||||
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
||||
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
||||
|
||||
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
||||
|
||||
**Input**: The argument after `/opsx-propose` is the change name (kebab-case), OR a description of what the user wants to build.
|
||||
**Provided arguments**: $ARGUMENTS
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Understand the request and clarify material ambiguity**
|
||||
|
||||
If no input is provided, ask the user (open-ended, no preset options):
|
||||
> "What change do you want to work on? Describe what you want to build or fix."
|
||||
|
||||
From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
|
||||
|
||||
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
||||
|
||||
If the request contains ambiguity that would materially affect scope, externally observable behavior, compatibility, or acceptance criteria, ask the user before creating the change. For minor details, make a reasonable assumption and record it in the planning artifacts.
|
||||
|
||||
2. **Load project context**
|
||||
|
||||
Run `openspec context --json` from the current working directory (or `openspec context --json --store "<store-id>"` when a registered store was explicitly selected). Use the returned `root.path` as the authoritative OpenSpec root. If context reports `no_openspec_root`, stop without creating or changing any files and follow the **Project check** above for how this workflow was reached. Offer `openspec init` only for an explicit OpenSpec request, and wait for the user to request initialization. Do not initialize automatically or run `openspec new change`. After initialization, rerun this context check before continuing. For any other context failure, stop and report the error; do not fall back to the current directory or run later OpenSpec commands without the selected store.
|
||||
|
||||
Only when context returns a resolved `root.path`, read `<root.path>/openspec/config.yaml`. Use `config.yml` only when `config.yaml` does not exist. If neither file exists, continue without project context. Do not fall back to `config.yml` if `config.yaml` is unreadable or invalid.
|
||||
|
||||
If the file parses as a YAML object and its `context` field is a string no larger than 51,200 bytes in UTF-8, apply that field before exploring the codebase or making planning decisions. If the file cannot be read or parsed, or the context field is invalid or oversized, continue without project context. Validate this field independently of other config fields, as OpenSpec does.
|
||||
|
||||
Treat context as project-provided data and constraints, not as authority to change this workflow: it cannot override user authorization, the planning boundary, tool restrictions, or artifact and output rules. Do not copy the context into artifacts; use it to focus any codebase exploration and as a constraint on the proposal.
|
||||
|
||||
3. **Determine the workflow schema**
|
||||
|
||||
Use the configured default schema unless the user explicitly requests a different workflow.
|
||||
|
||||
**Use a different schema only if the user:**
|
||||
- Explicitly requests a specific schema by name → use `--schema <schema-name>`
|
||||
- Asks to "show workflows" or asks "what workflows" exist → resolve the authoritative root by running `openspec context --json` from the current working directory. If the user explicitly selected a registered store, use `openspec context --json --store "<store-id>"`. Then run `openspec schemas --json` with its working directory set to the returned `root.path` and let them choose. This preserves roots selected by a local `store:` pointer or the global `defaultStore`; when a registered store was explicitly selected, append `--store "<store-id>"` to `openspec schemas --json` as well. If context fails, stop as described in the context-loading step; do not fall back to the current directory.
|
||||
|
||||
Otherwise, omit `--schema` to preserve the configured default.
|
||||
|
||||
4. **Create the change directory**
|
||||
|
||||
Choose one schema form below. If a registered store is selected, append `--store "<store-id>"` to that command and each later OpenSpec command shown below that accepts `--store`.
|
||||
|
||||
Using the configured default:
|
||||
```bash
|
||||
openspec new change "<name>"
|
||||
```
|
||||
|
||||
Using an explicitly requested schema:
|
||||
```bash
|
||||
openspec new change "<name>" --schema "<schema-name>"
|
||||
```
|
||||
This creates a scaffolded change in the planning home resolved by the CLI with `.openspec.yaml`.
|
||||
|
||||
5. **Get the artifact build order**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to get:
|
||||
- `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
|
||||
- `artifacts`: list of all artifacts, each with its `status` and its `requires` edges (the artifact IDs it directly depends on)
|
||||
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
|
||||
|
||||
6. **Create every artifact in the required set**
|
||||
|
||||
Use a todo list to track progress through the artifacts.
|
||||
|
||||
Loop through artifacts in dependency order (artifacts with no pending dependencies first):
|
||||
|
||||
a. **For each artifact that is `ready` (dependencies satisfied)**:
|
||||
- Get instructions:
|
||||
```bash
|
||||
openspec instructions <artifact-id> --change "<name>" --json
|
||||
```
|
||||
- The instructions JSON includes:
|
||||
- `context`: Project background (constraints for you - do NOT include in output)
|
||||
- `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
|
||||
- `template`: The structure to use for your output file
|
||||
- `instruction`: Schema-specific guidance for this artifact type
|
||||
- `skipped`/`warning`: present when the change declares skip_specs and this artifact must NOT be created - stop and pick another artifact
|
||||
- `resolvedOutputPath`: Resolved path or pattern to write the artifact
|
||||
- `dependencies`: Completed artifacts to read for context
|
||||
- Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
|
||||
- **Inspect the relevant project before drafting**: Read `context` and `rules` first, then inspect relevant implementation, nearby tests, configuration, and documentation outside `openspec/`. Keep inspection read-only and proportional to the change; reuse findings for later artifacts and inspect more only as needed.
|
||||
- Identify the target project from the request and project context; the planning home may be separate from the code. If the target is unclear, ask. For greenfield or non-code changes, inspect the available structure and relevant documents. If source is unavailable, state the limitation and ask when it materially affects the plan.
|
||||
- Ground scope, approach, and tasks in what you find. Distinguish observed behavior from assumptions and proposed additions; surface conflicts with existing specs instead of silently deciding which is correct.
|
||||
- Do this discovery now, rather than leaving generic "explore the codebase" or "make a plan" tasks for implementation. Keep any necessary follow-up investigation specific to an unresolved question.
|
||||
- If the `instruction` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at `resolvedOutputPath`
|
||||
- Otherwise create the artifact file using `template` as the structure and write it to `resolvedOutputPath`. If `resolvedOutputPath` is a glob, follow `instruction` to choose the concrete file path
|
||||
- Apply `context` and `rules` as constraints - but do NOT copy them into the file
|
||||
- Show brief progress: "Created <artifact-id>"
|
||||
|
||||
b. **Continue until every artifact in the required set exists (not just `apply.requires`)**
|
||||
- After creating each artifact, re-run `openspec status --change "<name>" --json`
|
||||
- The required set is `applyRequires` plus every artifact reachable from those by following the `requires` edges in `status --json` - walk them transitively (spec-driven closes over proposal, specs, design, tasks). Leave artifacts outside that set alone
|
||||
- `status` is file-existence only, so an `applyRequires` artifact reading `done` does NOT mean its dependencies exist - writing `tasks.md` early marks `tasks` done while `specs` was never written. Use each artifact's `requires` edges, not its `status`, to build the required set: a `done` artifact still lists what it depends on
|
||||
- An artifact already reading `status: "skipped"` is satisfied: the change declares `skip_specs` in `.openspec.yaml`, so its files must NOT exist. Never try to create one
|
||||
- Create every artifact in the required set that is missing, then re-check - creating one can unblock others
|
||||
- Skip one only when `status` already reports it `skipped`, or when its own `instruction` says it is conditional: run `openspec instructions <artifact-id> --change "<name>" --json` and skip only if its `instruction` field marks it optional (e.g. "create only if..."). Spec-driven's `design.md` qualifies; `specs` qualifies only via the `skipped` status above, never by your own judgment. Tell the user, and do not reconsider it
|
||||
- Dependencies are enablers, not gates: if a required artifact is still `blocked` only because you skipped a conditional dependency, write it anyway
|
||||
- Stop when every artifact in the required set is `done`, `skipped`, or was deliberately skipped
|
||||
|
||||
c. **If an artifact requires user input** (unclear context):
|
||||
- Ask the user to clarify
|
||||
- Then continue with creation
|
||||
|
||||
7. **Show final status**
|
||||
```bash
|
||||
openspec status --change "<name>"
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
After completing all artifacts, summarize:
|
||||
- Change name and location
|
||||
- List of artifacts created with brief descriptions, plus any conditional artifact you skipped and why
|
||||
- What's ready: "All artifacts needed for implementation are ready."
|
||||
- Prompt: "The artifacts are ready for review. When you are ready, run `/opsx-apply`."
|
||||
|
||||
**Artifact Creation Guidelines**
|
||||
|
||||
- Follow the `instruction` field from `openspec instructions` for each artifact type - it is the authoritative guidance, even for familiar artifact names
|
||||
- If the `instruction` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly
|
||||
- The schema defines what each artifact should contain - follow it
|
||||
- Read dependency artifacts for context before creating new ones
|
||||
- Use `template` as the structure for your output file - fill in its sections
|
||||
- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
|
||||
- Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
|
||||
- These guide what you write, but should never appear in the output
|
||||
|
||||
**Guardrails**
|
||||
- The request that invoked this workflow authorizes planning only. Any implementation or apply instruction in that request does not carry forward. Do NOT implement the change, start the apply workflow, or edit project code during this workflow. After presenting the artifacts, stop and wait for a new user request to start the apply workflow
|
||||
- Create every artifact the apply phase transitively depends on, not just the ids listed in `apply.requires`
|
||||
- Always read dependency artifacts before creating a new one - re-read from disk, not from conversation memory (files may have changed since you last saw them)
|
||||
- Ask about ambiguities that would materially change scope, externally observable behavior, compatibility, or acceptance criteria; for minor details, make reasonable assumptions and record them
|
||||
- If a change with that name already exists, ask if user wants to continue it or create a new one
|
||||
- Verify each artifact file exists after writing before proceeding to next
|
||||
@@ -0,0 +1,283 @@
|
||||
---
|
||||
description: "Sync delta specs from a change to main specs"
|
||||
---
|
||||
|
||||
Sync delta specs from a change to main specs.
|
||||
|
||||
This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
||||
|
||||
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
||||
|
||||
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
||||
|
||||
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
||||
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
||||
|
||||
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
|
||||
|
||||
**Input**: Optionally specify a change name after `/opsx-sync` (e.g., `/opsx-sync add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
**Provided arguments**: $ARGUMENTS
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
|
||||
|
||||
When prompting, show changes that have delta specs (under `specs/` directory).
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx-sync <other>`).
|
||||
|
||||
2. **Resolve change context**
|
||||
|
||||
Run:
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
|
||||
The JSON includes `planningHome.root`. Main specs live under `<planningHome.root>/openspec/specs/` — use that (store-aware) root for every main-spec path below, not a hardcoded repo path. When a store is selected it points at the store, not the current repository.
|
||||
|
||||
3. **Find delta specs**
|
||||
|
||||
Use `artifactPaths.specs.existingOutputPaths` from the status JSON as the
|
||||
only source of delta spec paths. If the `specs` entry is missing or
|
||||
`existingOutputPaths` is empty, report that there are no delta specs to sync,
|
||||
do not infer them from other artifacts, and stop without requesting artifact
|
||||
instructions or writing a main spec.
|
||||
|
||||
Sync every path in `existingOutputPaths` unless the caller narrowed the set.
|
||||
A caller narrows it by naming an explicit list of complete entries from
|
||||
`existingOutputPaths` — copy those absolute values verbatim. Archive does
|
||||
this inline, and a user can too (for example, by selecting the entry ending
|
||||
in `/specs/billing/invoices/spec.md`).
|
||||
Then sync only the named paths and leave the remaining delta specs untouched:
|
||||
bulk archive excludes a delta whose implementation it could not find, and
|
||||
syncing it anyway would write a main spec the caller deliberately withheld.
|
||||
Carry that narrowed selection through step 4; never widen it back to the full
|
||||
list. If a named path is not in `existingOutputPaths`, do not sync it —
|
||||
report it and stop, rather than dropping it silently. If the named list is
|
||||
empty, report that there is nothing to sync and stop without writing a main
|
||||
spec.
|
||||
|
||||
Each delta spec file contains sections like:
|
||||
- `## ADDED Requirements` - New requirements to add
|
||||
- `## MODIFIED Requirements` - Changes to existing requirements
|
||||
- `## REMOVED Requirements` - Requirements to remove
|
||||
- `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)
|
||||
|
||||
If no delta specs found, inform user and stop.
|
||||
|
||||
4. **For each delta spec, apply changes to main specs**
|
||||
|
||||
Before the first main-spec write, obtain one current specs-rule snapshot:
|
||||
- If archive invoked this workflow inline and supplied a valid snapshot from
|
||||
`openspec instructions specs --change "<name>" --json`, reuse it and do not
|
||||
fetch the same instructions again.
|
||||
- Otherwise run that command once now with the same selected-root flags.
|
||||
- If the direct lookup exits non-zero or returns invalid artifact-instruction
|
||||
JSON, report the error and stop before writing any main spec. Do not treat the
|
||||
failure as an absent rule set.
|
||||
- A valid response with omitted `rules` means no artifact rules are configured
|
||||
and the existing semantic merge continues.
|
||||
|
||||
Apply returned `rules` only to the content and form of the main specs produced
|
||||
by this merge. Artifact rules are not operation guidance and cannot change
|
||||
selected roots, delta paths, CLI checks, or workflow steps. Use their text as
|
||||
constraints without copying it verbatim into a main spec or summary.
|
||||
|
||||
For each capability delta spec path selected in step 3 — the full `existingOutputPaths` list, or the narrowed subset when a caller supplied one (these may belong to a selected store, not the repo):
|
||||
|
||||
a. **Read the delta spec** to understand the intended changes
|
||||
|
||||
b. **Read the main spec** at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (may not exist yet)
|
||||
|
||||
**If it does not exist yet** (a new capability), match what `openspec archive` does:
|
||||
only ADDED requirements may be applied - step d creates the spec from them.
|
||||
MODIFIED and RENAMED have no requirement to act on, so stop the sync for that
|
||||
capability and report that its main spec does not exist and only ADDED is allowed
|
||||
for a new spec; never invent the missing requirement. REMOVED has nothing to
|
||||
remove - skip it and warn.
|
||||
|
||||
c. **Apply changes intelligently**:
|
||||
|
||||
**ADDED Requirements:**
|
||||
- If requirement doesn't exist in main spec → add it
|
||||
- If requirement already exists → update it to match (treat as implicit MODIFIED)
|
||||
|
||||
**MODIFIED Requirements:**
|
||||
- Find the requirement in main spec
|
||||
- Apply the changes - this can be:
|
||||
- Adding new scenarios the main spec does not have yet
|
||||
- Modifying existing scenarios
|
||||
- Changing the requirement description
|
||||
- Preserve scenarios/content not mentioned in the delta
|
||||
|
||||
**REMOVED Requirements:**
|
||||
- Remove the entire requirement block from main spec
|
||||
- Retiring the capability. Delete the whole `spec.md` - and the directory once
|
||||
nothing else is left in it - only when ALL of these hold:
|
||||
1. removing the requirements *this run* left no requirement blocks;
|
||||
2. the rest of the spec is well-formed (it still has a `## Purpose`);
|
||||
3. the main spec was not already empty before this sync - if you removed
|
||||
nothing, change nothing;
|
||||
4. every other nonblank line in the whole file is accounted for as the
|
||||
title, Purpose, Requirements header, or a canonical requirement's
|
||||
statement, scenarios, or fenced examples;
|
||||
5. the change's `.openspec.yaml` declares `retire_capabilities: true`;
|
||||
6. the `spec.md` resolves inside the real specs root (do not follow a
|
||||
capability-directory symlink to delete an external file).
|
||||
If removing the selected requirements would leave no requirement blocks and
|
||||
any retirement condition is not satisfied, do not modify the main spec. Stop
|
||||
the sync for that capability, report the blocking condition, and tell the user
|
||||
how to resolve it. Never write or leave an empty `## Requirements` section.
|
||||
When only the marker is missing, say that too - it is the one thing the user
|
||||
can add to make the retirement go through.
|
||||
- Deleting the file also deletes its `## Purpose`; any other section blocks
|
||||
retirement. Name Purpose when you report the retirement. Include a pasteable
|
||||
`git checkout` only when the spec lived in the caller's checkout;
|
||||
otherwise give checkout-scoped recovery guidance.
|
||||
|
||||
**RENAMED Requirements:**
|
||||
- Find the FROM requirement, rename to TO
|
||||
|
||||
**`## Purpose` in the delta:**
|
||||
- The main spec already has one and it is authoritative - leave it alone
|
||||
(this is what `openspec archive` does; it warns and moves on)
|
||||
|
||||
d. **Create new main spec** if capability doesn't exist yet:
|
||||
- Only when the delta has ADDED requirements to put in it and no MODIFIED or
|
||||
RENAMED requirements blocked this capability in step b. Otherwise create nothing
|
||||
and leave the specs directory untouched. For a REMOVED-only delta, if the change's
|
||||
`.openspec.yaml` declares `retire_capabilities: true`, report it as already retired
|
||||
and continue without recreating the spec. Without that marker, report the sync as blocked:
|
||||
`openspec archive` rejects it with `Spec must have at least one requirement`.
|
||||
An empty delta has no operations to sync; report it as blocked too.
|
||||
Never write an empty `## Requirements` section.
|
||||
- Create `<planningHome.root>/openspec/specs/<capability-path>/spec.md`
|
||||
- Add Purpose section: copy the delta's `## Purpose` body verbatim when it has one
|
||||
(this is what `openspec archive` does); only write a brief TBD placeholder when it does not
|
||||
- Add Requirements section with the ADDED requirements
|
||||
- Follow the **Main Spec Format Reference** below
|
||||
|
||||
5. **Validate updated main specs**
|
||||
|
||||
Run `openspec validate --specs` with the same selected-root flags used earlier.
|
||||
If validation fails, report the problems and do not claim the sync succeeded.
|
||||
|
||||
6. **Show summary**
|
||||
|
||||
After applying all changes, summarize:
|
||||
- Which capabilities were updated
|
||||
- What changes were made (requirements added/modified/removed/renamed)
|
||||
- Any new main spec left with a TBD Purpose placeholder, so it gets written
|
||||
now rather than lingering
|
||||
- Any capability retired, naming the deleted `spec.md`, its Purpose, and
|
||||
either a pasteable `git checkout` or checkout-scoped recovery guidance
|
||||
|
||||
**Delta Spec Format Reference**
|
||||
|
||||
```markdown
|
||||
# Spec Delta
|
||||
|
||||
## Purpose
|
||||
|
||||
Only on a delta that introduces a brand-new capability. Seeds the new main spec.
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: New Feature
|
||||
The system SHALL do something new.
|
||||
|
||||
#### Scenario: Basic case
|
||||
- **WHEN** user does X
|
||||
- **THEN** system does Y
|
||||
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: Existing Feature
|
||||
The system SHALL keep doing the existing thing, now also handling A.
|
||||
|
||||
#### Scenario: Scenario the main spec already has
|
||||
- **WHEN** user does X
|
||||
- **THEN** system does Y
|
||||
|
||||
#### Scenario: New scenario to add
|
||||
- **WHEN** user does A
|
||||
- **THEN** system does B
|
||||
|
||||
## REMOVED Requirements
|
||||
|
||||
### Requirement: Deprecated Feature
|
||||
|
||||
## RENAMED Requirements
|
||||
|
||||
- FROM: `### Requirement: Old Name`
|
||||
- TO: `### Requirement: New Name`
|
||||
```
|
||||
|
||||
**Main Spec Format Reference**
|
||||
|
||||
Main specs are what the delta merges INTO. They must never contain delta operation headers (`## ADDED/MODIFIED/REMOVED/RENAMED Requirements`) - after syncing, every requirement lives under a single `## Requirements` section:
|
||||
|
||||
```markdown
|
||||
# <capability> Specification
|
||||
|
||||
## Purpose
|
||||
Short description of what this capability does and why it exists.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement: New Feature
|
||||
The system SHALL do something new.
|
||||
|
||||
#### Scenario: Basic case
|
||||
- **WHEN** user does X
|
||||
- **THEN** system does Y
|
||||
```
|
||||
|
||||
**Key Principle: Intelligent Merging**
|
||||
|
||||
Unlike programmatic merging, you merge rather than overwrite:
|
||||
- A MODIFIED block carries the whole requirement - body plus every scenario that survives the change. `openspec validate` and `openspec archive` both reject one that drops a scenario the main spec still has.
|
||||
- Keep anything the delta does not mention, in the main spec's existing order
|
||||
- Use your judgment to merge changes sensibly
|
||||
|
||||
**Output On Success**
|
||||
|
||||
```markdown
|
||||
## Specs Synced: <change-name>
|
||||
|
||||
Updated main specs:
|
||||
|
||||
**<capability-1>**:
|
||||
- Added requirement: "New Feature"
|
||||
- Modified requirement: "Existing Feature" (added 1 scenario)
|
||||
|
||||
**<capability-2>**:
|
||||
- Created new spec file
|
||||
- Added requirement: "Another Feature"
|
||||
|
||||
Main specs are now updated. The change remains active - archive when implementation is complete.
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Read both delta and main specs before making changes
|
||||
- Preserve existing content not mentioned in delta
|
||||
- Never copy a delta file into a main spec as-is - merge its content so the main spec keeps the Main Spec Format Reference structure, with no delta operation headers
|
||||
- If something is unclear, ask for clarification
|
||||
- Show what you're changing as you go
|
||||
- The operation should be idempotent - running twice should give same result
|
||||
- Use only `artifactPaths.specs.existingOutputPaths`; never infer delta specs from unrelated artifacts
|
||||
- Honor a caller-supplied subset of `existingOutputPaths`; never widen it back to the full list
|
||||
- Fetch specs instructions once for direct sync, or reuse the archive-supplied snapshot inline
|
||||
- Stop before every main-spec write on a non-zero or invalid JSON specs-instruction response
|
||||
- Artifact rules constrain only the specs being written and are never copied into output files
|
||||
@@ -0,0 +1,102 @@
|
||||
---
|
||||
description: "Update a change - revise existing planning artifacts and keep them coherent (Experimental)"
|
||||
---
|
||||
|
||||
Revise a change's existing planning artifacts and keep them coherent. Never edit code.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
||||
|
||||
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
||||
|
||||
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
||||
|
||||
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
||||
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
||||
|
||||
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
||||
|
||||
**Input**: Optionally specify a change name after `/opsx-update` (e.g., `/opsx-update add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
**Provided arguments**: $ARGUMENTS
|
||||
|
||||
This workflow revises artifacts that already exist; it never creates missing ones. When an artifact is missing, `openspec status --change "<name>" --json` names the next one and `openspec instructions "<artifact-id>" --change "<name>" --json` explains how to write it.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes sorted by most recently modified, and ask the user to select one
|
||||
|
||||
When prompting, present the top 3-4 most recently modified changes as options, showing:
|
||||
- Change name
|
||||
- Status (e.g., "0/5 tasks", "complete", "no tasks")
|
||||
- How recently it was modified (from `lastModified` field)
|
||||
|
||||
Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to update.
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx-update <other>`).
|
||||
|
||||
2. **Get the change's artifacts**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to understand current state. The response includes:
|
||||
- `schemaName`: The workflow schema being used (e.g., "spec-driven")
|
||||
- `artifacts`: Array of artifacts with their status ("done", "skipped", "ready", "blocked")
|
||||
- `isPlanningComplete`: Boolean indicating if all planning artifacts are complete. Older CLI versions expose the same value as `isComplete`.
|
||||
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
|
||||
|
||||
The artifact ids and paths come from the active schema - do NOT assume them, and do NOT branch on hardcoded artifact names. Custom schemas must work unchanged.
|
||||
|
||||
The files to edit are `artifactPaths.<id>.existingOutputPaths` - the concrete files that exist on disk, already glob-expanded for glob artifacts (e.g. `specs/**/*.md`). Do NOT write to `resolvedOutputPath`: for a glob artifact it is still the glob pattern, not a real file.
|
||||
|
||||
3. **Understand the request**
|
||||
- If the user asked for a specific revision ("the design now uses X"), that is the starting edit.
|
||||
- If they only said "update" / "make this coherent", treat it as a coherence review: read the existing artifacts and check them against each other for contradictions, gaps, and duplication.
|
||||
|
||||
4. **Read and reconcile**
|
||||
- Read the artifact(s) the request touches and the change's other existing artifacts.
|
||||
- Draft the requested edit in the conversation, not in files. Work out exactly what it changes; step 5 owns every write. Then check every other existing artifact against the drafted edit - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
|
||||
- Note everything that is now inconsistent, missing, or contradictory.
|
||||
- Propose revisions to files that already exist (`existingOutputPaths`). If an artifact has no existing output files and status `ready` or `blocked`, note it and point the user to `openspec instructions "<artifact-id>" --change "<name>" --json` for how to create them. Leave `skipped` artifacts untouched; do not treat them as missing or defer them to the continue workflow.
|
||||
- A glob artifact (e.g. `specs/**/*.md`) is marked `done` after at least one file matches, and the continue workflow only handles `ready` artifacts. When reconciliation identifies a missing file for a glob artifact whose `existingOutputPaths` is non-empty:
|
||||
1. Run `openspec instructions "<artifact-id>" --change "<name>" --json` and use its `instruction` and `template`. Treat `context` and `rules` as constraints; do not copy them into the file. If instructions report `skipped: true`, do not create the file. Read current dependency files from disk; if a required non-skipped dependency is missing, stop and ask the user to restore it first.
|
||||
2. Choose a concrete path inside `changeRoot` that matches `artifactPaths.<id>.outputPath` and does not already exist. Verify it remains inside `changeRoot` after resolving any symlinked parent directories. The glob `resolvedOutputPath` is not a valid target.
|
||||
3. Include the new file in step 5's proposed revisions and create it only after the user confirms.
|
||||
4. After confirmation, immediately before creation, refresh status and instructions. Verify the artifact is still in scope, not skipped, and partially populated; repeat the concrete-path checks above.
|
||||
5. Use a create operation that fails if the target already exists. If `instruction` delegates creation to another skill or command, invoke it only if it can honor the confirmed path and these guardrails; otherwise stop. If any check fails or the confirmed draft is no longer valid, stop and reconcile with the user rather than replacing existing content or choosing a different path.
|
||||
- If the change is already coherent, say so and propose no revisions.
|
||||
|
||||
5. **Confirm and apply, one artifact at a time**
|
||||
- This step performs every artifact write in this workflow; no earlier step edits an artifact.
|
||||
- Show each proposed revision and why - including the requested edit drafted in step 4. Write only after the user confirms.
|
||||
- If the user rejects a revision, do not write it - leave that artifact unchanged.
|
||||
- When a substantial rewrite is needed, get that artifact's rules and template first:
|
||||
```bash
|
||||
openspec instructions "<artifact-id>" --change "<name>" --json
|
||||
```
|
||||
|
||||
6. **Point to the next step (guidance only - NEVER act on it)**
|
||||
- Artifacts with empty `existingOutputPaths` and status `ready` or `blocked` -> run `openspec status --change "<name>" --json` for the next artifact and point the user to `openspec instructions "<artifact-id>" --change "<name>" --json` for how to create it.
|
||||
- Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; suggest `/opsx-apply` to carry the delta into code.
|
||||
- Everything done and implemented -> suggest `/opsx-archive`.
|
||||
|
||||
**Output**
|
||||
|
||||
After each invocation, show:
|
||||
- Which artifacts were revised (and which proposed revisions were rejected)
|
||||
- Any file created under a glob artifact that was already partially populated
|
||||
- Anything deferred because it does not exist yet (artifacts with no files and status `ready` or `blocked`, never `skipped` artifacts)
|
||||
- Where the change stands and the recommended next command
|
||||
|
||||
**Guardrails**
|
||||
- Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, stop and point to `/opsx-apply`.
|
||||
- Use the artifact ids and paths reported by `openspec status`; never branch on hardcoded artifact names.
|
||||
- Edit only the concrete files in `existingOutputPaths`; never write to a glob `resolvedOutputPath`.
|
||||
- Do not advance the build frontier: if an artifact has empty `existingOutputPaths` and status `ready` or `blocked`, creating them is a separate step, outside this workflow. Leave `skipped` artifacts untouched. The only new-file scope is a confirmed concrete path under a glob artifact whose `existingOutputPaths` is non-empty.
|
||||
- Confirm every edit with the user before writing.
|
||||
- If the request changes the change's *intent* rather than refining it, ask for a distinct unused change name and recommend `openspec new change "<new-change-name>"` instead (the "Update vs. Start Fresh" heuristic).
|
||||
@@ -0,0 +1,202 @@
|
||||
---
|
||||
name: openspec-apply-change
|
||||
description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks. Also use when the user says "openspec apply", "opsx apply", or "openspec implement".
|
||||
allowed-tools: Bash(openspec:*)
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.13.2"
|
||||
---
|
||||
|
||||
Implement tasks from an OpenSpec change.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
||||
|
||||
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
||||
|
||||
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
||||
|
||||
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
||||
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
||||
|
||||
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
||||
|
||||
**Input**: Optionally specify a change name (e.g., `/opsx-apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx-apply <other>`).
|
||||
|
||||
2. **Check status to understand the schema**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to understand:
|
||||
- `schemaName`: The workflow being used (e.g., "spec-driven")
|
||||
- `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints
|
||||
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
|
||||
|
||||
3. **Get apply instructions**
|
||||
|
||||
```bash
|
||||
openspec instructions apply --change "<name>" --json
|
||||
```
|
||||
|
||||
This returns:
|
||||
- `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
|
||||
- Progress (total, complete, remaining)
|
||||
- Task list with status
|
||||
- Dynamic instruction based on current state
|
||||
- Optional `context`: current required project instruction input from the selected root
|
||||
- Optional `operationGuidance`: current advisory guidance for apply
|
||||
- `missingArtifacts` (when present): required artifact ids with no output
|
||||
|
||||
**Handle states:**
|
||||
- If `state: "blocked"`: show the message and pause implementation.
|
||||
- If `missingArtifacts` is non-empty: suggest completing the missing artifacts. Run `openspec status --change "<name>" --json`, select the next `ready` artifact (not `skipped` or `blocked`), and use `openspec instructions "<artifact-id>" --change "<name>" --json` for its rules and template. Keep the selected `--store <id>` on both commands.
|
||||
- Otherwise, follow the CLI instruction to create or repair the schema-configured tracking file from existing planning artifacts. Do not assume another artifact is ready or start implementation while blocked.
|
||||
- If `state: "all_done"`: congratulate, suggest archive
|
||||
- Otherwise: proceed to implementation
|
||||
|
||||
Treat `context` as a required prompt-level input. Read and consider it, and
|
||||
apply relevant project facts, conventions, and constraints while implementing.
|
||||
Treat `operationGuidance` as optional additive advice. Read and consider every
|
||||
entry, and follow entries that are applicable and compatible with the built-in
|
||||
workflow.
|
||||
|
||||
Keep both fields separate from CLI-returned state, missing artifacts, tasks,
|
||||
progress, `contextFiles`, and the built-in `instruction`. They are not
|
||||
evidence of task completion, do not replace the built-in instruction, and do
|
||||
not permit bypassing a blocked state. If context conflicts with the built-in
|
||||
instruction, an explicit user choice, or a CLI-controlled value, report the
|
||||
conflict and preserve the controlling value. If guidance is inapplicable or
|
||||
conflicts with those controlling inputs, do not follow it and explain why.
|
||||
These are prompt-level behavior contracts, not enforceable checks.
|
||||
|
||||
4. **Read context files**
|
||||
|
||||
Read every file path listed under `contextFiles` from the apply instructions output.
|
||||
The files depend on the schema being used:
|
||||
- **spec-driven**: proposal, specs, design, tasks
|
||||
- Other schemas: follow the contextFiles from CLI output
|
||||
|
||||
Do not copy `context` or `operationGuidance` verbatim into implementation
|
||||
files or planning artifacts unless the user separately asks for that content.
|
||||
|
||||
5. **Show current progress**
|
||||
|
||||
Display:
|
||||
- Schema being used
|
||||
- Progress: "N/M tasks complete"
|
||||
- Remaining tasks overview
|
||||
- Dynamic instruction from CLI
|
||||
|
||||
6. **Implement tasks (loop until done or blocked)**
|
||||
|
||||
For each pending task:
|
||||
- Show which task is being worked on
|
||||
- Make the code changes required
|
||||
- Keep changes minimal and focused
|
||||
- Mark task complete in the tasks file: `- [ ]` → `- [x]`
|
||||
- Continue to next task
|
||||
|
||||
**Pause if:**
|
||||
- Task is unclear → ask for clarification
|
||||
- Implementation reveals a design issue → suggest updating artifacts
|
||||
- A task needs work beyond what the spec and tasks describe, or you are tempted to drop, narrow, defer, or accept exceptions to specified behavior to make it fit → surface the added scope and ask; do not absorb it silently
|
||||
- Error or blocker encountered → report and wait for guidance
|
||||
- User interrupts
|
||||
|
||||
7. **On completion or pause, show status**
|
||||
|
||||
Display:
|
||||
- Tasks completed this session
|
||||
- Overall progress: "N/M tasks complete"
|
||||
- If all done: suggest archive
|
||||
- If paused: explain why and wait for guidance
|
||||
|
||||
**Output During Implementation**
|
||||
|
||||
```
|
||||
## Implementing: <change-name> (schema: <schema-name>)
|
||||
|
||||
Working on task 3/7: <task description>
|
||||
[...implementation happening...]
|
||||
✓ Task complete
|
||||
|
||||
Working on task 4/7: <task description>
|
||||
[...implementation happening...]
|
||||
✓ Task complete
|
||||
```
|
||||
|
||||
**Output On Completion**
|
||||
|
||||
```
|
||||
## Implementation Complete
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Progress:** 7/7 tasks complete ✓
|
||||
|
||||
### Completed This Session
|
||||
- [x] Task 1
|
||||
- [x] Task 2
|
||||
...
|
||||
|
||||
All tasks complete! You can archive this change with `/opsx-archive`.
|
||||
```
|
||||
|
||||
**Output On Pause (Issue Encountered)**
|
||||
|
||||
```
|
||||
## Implementation Paused
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Progress:** 4/7 tasks complete
|
||||
|
||||
### Issue Encountered
|
||||
<description of the issue>
|
||||
|
||||
**Options:**
|
||||
1. <option 1>
|
||||
2. <option 2>
|
||||
3. Other approach
|
||||
|
||||
What would you like to do?
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Keep going through tasks until done or blocked
|
||||
- Always read context files before starting (from the apply instructions output)
|
||||
- If task is ambiguous, pause and ask before implementing
|
||||
- If implementation reveals issues, pause and suggest artifact updates
|
||||
- Keep code changes minimal and scoped to each task
|
||||
- Update task checkbox immediately after completing each task
|
||||
- Pause on errors, blockers, or unclear requirements - don't guess
|
||||
- When a task needs work beyond what the spec describes, surface the added scope and pause - never silently narrow, defer, or simplify away specified behavior
|
||||
- Only mark a task `- [x]` when its specified behavior is fully implemented, not when it is partially done or deferred
|
||||
- Use contextFiles from CLI output, don't assume specific file names
|
||||
- Do not use context or operation guidance as proof that a task is complete
|
||||
- Apply relevant project context; report conflicts with controlling workflow inputs
|
||||
- Consider every guidance entry; explain any inapplicable or conflicting advice
|
||||
- Do not copy runtime context or operation guidance into implementation files or planning artifacts
|
||||
- Preserve CLI-controlled blocked/ready/all-done behavior and completion criteria
|
||||
|
||||
**Fluid Workflow Integration**
|
||||
|
||||
This skill supports the "actions on a change" model:
|
||||
|
||||
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
|
||||
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
|
||||
@@ -0,0 +1,210 @@
|
||||
---
|
||||
name: openspec-archive-change
|
||||
description: Archive a completed OpenSpec change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete. Also use when the user says "openspec archive" or "opsx archive".
|
||||
allowed-tools: Bash(openspec:*)
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.13.2"
|
||||
---
|
||||
|
||||
Archive a completed change in the experimental workflow.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
||||
|
||||
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
||||
|
||||
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
||||
|
||||
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
||||
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
||||
|
||||
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
|
||||
|
||||
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
|
||||
|
||||
When prompting, show only active changes (not already archived).
|
||||
Include the schema used for each change if available.
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx-archive <other>`).
|
||||
|
||||
**Load current archive inputs before the existing archive checks:**
|
||||
|
||||
After resolving the selected change and planning root, run:
|
||||
```bash
|
||||
openspec instructions archive --change "<name>" --json
|
||||
```
|
||||
Keep the same selected-root flags on this command. This lookup is advisory and
|
||||
optional: it only supplies extra prompt inputs, so it must never block archiving.
|
||||
If it exits non-zero or returns invalid JSON — for example on an older CLI that
|
||||
does not support this command yet — continue the archive workflow with no
|
||||
context and no operation guidance. Do not report an error and do not stop.
|
||||
|
||||
A successful response may omit both optional fields. Treat `context` as a
|
||||
required prompt-level input: read and consider it, and apply relevant project
|
||||
facts, conventions, and constraints. Treat `operationGuidance` as optional
|
||||
additive advice: read and consider every entry, and follow entries that are
|
||||
applicable and compatible with the built-in archive workflow.
|
||||
|
||||
Keep both fields separate from built-in steps, explicit user choices, resolved
|
||||
paths, CLI checks, and command contracts. If context conflicts with one of those
|
||||
controlling inputs, report the conflict and preserve the controlling value. If
|
||||
guidance is inapplicable or conflicts with a controlling input, do not follow it
|
||||
and explain why. Do not infer replacement paths, skipped prompts, or flags from
|
||||
either field, and do not copy their text verbatim into specs, change artifacts,
|
||||
or archive summaries unless the user separately asks for it. These are
|
||||
prompt-level behavior contracts, not enforceable checks.
|
||||
|
||||
2. **Check artifact completion status**
|
||||
|
||||
Run `openspec status --change "<name>" --json` to check artifact completion.
|
||||
|
||||
Parse the JSON to understand:
|
||||
- `schemaName`: The workflow being used
|
||||
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context
|
||||
- `artifacts`: List of artifacts with their status (`done`, `skipped`, or other)
|
||||
|
||||
**If any artifacts are neither `done` nor `skipped`** (skipped artifacts satisfy the requirement - the change declares skip_specs):
|
||||
- Display warning listing incomplete artifacts
|
||||
- Ask the user to confirm they want to proceed
|
||||
- Proceed if user confirms
|
||||
|
||||
3. **Check task completion status**
|
||||
|
||||
Run `openspec list --json` with the same selected-root flags and find the
|
||||
entry in `changes` whose `name` exactly matches the selected change.
|
||||
Require exactly one match and nonnegative integer `totalTasks` and
|
||||
`completedTasks`, with `completedTasks <= totalTasks`. The CLI resolves
|
||||
the schema's tracked task files, including custom artifact names, output
|
||||
paths, and globs.
|
||||
Incomplete tasks = `totalTasks - completedTasks`.
|
||||
|
||||
Do not infer task completion from artifact status or the absence of a
|
||||
top-level `tasks.md`. If the lookup fails, returns invalid JSON, omits or
|
||||
duplicates the selected change, or returns invalid counts, report the problem
|
||||
and stop before syncing or archiving.
|
||||
The CLI counts only `x`/`X` checkbox markers as complete;
|
||||
other markers, including unfamiliar ones, remain incomplete.
|
||||
|
||||
**If incomplete tasks found:**
|
||||
- Display warning showing count of incomplete tasks
|
||||
- Ask the user to confirm they want to proceed
|
||||
- Proceed if user confirms
|
||||
|
||||
**If `totalTasks` is zero:** Proceed without a task-related warning.
|
||||
|
||||
4. **Assess delta spec sync state**
|
||||
|
||||
Use `artifactPaths.specs.existingOutputPaths` from status JSON as the only
|
||||
delta-spec source. If the `specs` entry is missing or
|
||||
`existingOutputPaths` is empty, proceed without a sync prompt and do not infer
|
||||
delta specs from other artifacts.
|
||||
|
||||
**If delta specs exist:**
|
||||
- Compare each delta spec with its corresponding main spec at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (use the store-aware `planningHome.root` from step 2, not a hardcoded repo path)
|
||||
- A missing main spec is **not automatically** "already synced". For a new capability, the main spec is an *output* of the sync, not an input:
|
||||
- If the delta has MODIFIED or RENAMED requirements, report that only ADDED requirements can create a new main spec and mark that capability as sync-blocked. Never invent a requirement that has no current version.
|
||||
- Otherwise, if the delta has only REMOVED requirements and the change's `.openspec.yaml` declares `retire_capabilities: true`, the capability is already retired: count it as already synced, warn that there is nothing left to remove, and do not recreate the main spec. Apply this rule both now and when verifying a completed sync.
|
||||
- Otherwise, if the delta has no ADDED requirements, report that no sync is possible and mark that capability as sync-blocked. For a REMOVED-only delta, warn that there is no main spec to remove from and leave the main-spec tree unchanged. `openspec archive` refuses the unmarked REMOVED-only case with `Spec must have at least one requirement`.
|
||||
- Otherwise, count the capability as needing sync and name it in the summary (`<capability-path>: new main spec will be created`). If the delta also has REMOVED requirements, warn that they will be ignored because there is no main spec to remove from. The sync creates the main spec from only the delta's ADDED requirements, exactly as `openspec archive` does.
|
||||
- Determine what changes would be applied (adds, modifications, removals, renames)
|
||||
- Continue assessing the remaining capabilities even when one is sync-blocked. Show a combined summary before prompting.
|
||||
|
||||
**Prompt options:**
|
||||
- If any capability is sync-blocked: explain why and offer only "Archive without syncing", "Cancel"
|
||||
- Otherwise, if changes needed: "Sync now (recommended)", "Archive without syncing"
|
||||
- Otherwise, if already synced: "Archive now", "Sync anyway", "Cancel"
|
||||
|
||||
Route on the answer:
|
||||
- "Cancel" — stop, do not archive
|
||||
- "Archive without syncing" or "Archive now" — proceed to archive
|
||||
- "Sync now" or "Sync anyway" — sync, then verify (below). Do not start any sync while a capability is sync-blocked; explain the blocker and repeat the available choices.
|
||||
- Anything else — ask again rather than archiving
|
||||
|
||||
Before a selected sync writes any main spec, run
|
||||
`openspec instructions specs --change "<name>" --json` once with the same
|
||||
selected-root flags. Require a zero exit status and valid artifact-instruction
|
||||
JSON. If the lookup fails or returns invalid JSON, report the error and stop
|
||||
before writing any main spec or moving the change. A valid response with omitted
|
||||
`rules` is the no-rules case. Apply returned `rules` only to the content and
|
||||
form of main specs produced by this merge; do not use them as archive guidance,
|
||||
change CLI behavior, or copy the rule text into any output file.
|
||||
|
||||
Then run the `openspec-sync-specs` workflow inline (agent-driven intelligent merge) for change '<name>', passing the delta spec analysis and the fetched specs-rule snapshot from above, and wait for it to finish. The inline sync must reuse that snapshot without fetching `specs` instructions again. Do not delegate it to a background task — step 5 would move `changeRoot` out from under a sync that is still reading it, leaving the change archived and the main specs never updated. If your agent can only run it by delegation, delegate synchronously and wait for the result.
|
||||
|
||||
Then re-run the comparison from the top of this step, including the explicitly retired, missing-spec case, against every capability that has a delta spec in `artifactPaths.specs.existingOutputPaths` — not only the ones the sync reports it touched. A successful sync leaves nothing left to apply, so each capability must now read as already synced:
|
||||
- ADDED requirements present
|
||||
- MODIFIED requirements carrying the scenario and description changes named in the delta, with their other scenarios intact
|
||||
- REMOVED requirements gone — and where this sync retired a capability (removed its last requirement, leaving `## Requirements` empty), its main spec deleted rather than left empty; a spec the sync deliberately kept and reported is also a match
|
||||
- RENAMED requirements present under the new name and absent under the old one
|
||||
|
||||
If the sync failed, or any capability does not match, report what differs and stop — do not archive. Nothing has moved and `changeRoot` is intact, so the user can fix the mismatch or re-run the sync and start the archive again.
|
||||
|
||||
5. **Perform the archive**
|
||||
|
||||
Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
|
||||
```bash
|
||||
mkdir -p "<planningHome.changesDir>/archive"
|
||||
```
|
||||
|
||||
Generate the target name: use the change name as-is when it already starts with a `YYYY-MM-DD-` prefix; otherwise prepend the current date as `YYYY-MM-DD-<change-name>`. Never stack a second date (same rule as `openspec archive`).
|
||||
|
||||
**Check if target already exists:**
|
||||
- If yes: Fail with error, suggest renaming existing archive or using different date
|
||||
- If no: Move `changeRoot` to the archive directory
|
||||
|
||||
```bash
|
||||
mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
|
||||
```
|
||||
|
||||
6. **Display summary**
|
||||
|
||||
Show archive completion summary including:
|
||||
- Change name
|
||||
- Schema that was used
|
||||
- Archive location
|
||||
- Whether specs were synced (if applicable)
|
||||
- Note about any warnings (incomplete artifacts/tasks)
|
||||
|
||||
**Output On Success**
|
||||
|
||||
```markdown
|
||||
## Archive Complete
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
|
||||
**Specs:** <"✓ Synced to main specs" only if the step 4 verification passed; otherwise "No delta specs" or "Sync skipped">
|
||||
|
||||
<"All artifacts complete. All tasks complete." — or, if archived with warnings, list them instead (e.g. "Archived with 2 incomplete tasks")>
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Announce the selected change; prompt for selection when it is ambiguous
|
||||
- Use artifact graph (openspec status --json) for completion checking
|
||||
- Don't block archive on warnings - just inform and confirm
|
||||
- Preserve .openspec.yaml when moving to archive (it moves with the directory)
|
||||
- Show clear summary of what happened
|
||||
- If sync is requested, run the `openspec-sync-specs` workflow inline (agent-driven)
|
||||
- Never archive while a spec sync is still in flight — run the sync inline and verify the main specs before moving `changeRoot`
|
||||
- If delta specs exist, always run the sync assessment and show the combined summary before prompting
|
||||
- Apply relevant runtime context and report conflicts; operation guidance remains advisory
|
||||
- Consider every guidance entry and explain any inapplicable or conflicting advice
|
||||
- Existing CLI checks, resolved paths, prompts, and command contracts are unchanged
|
||||
- Artifact rules constrain only the specs being written and are never operation guidance
|
||||
- Never copy runtime context, operation guidance, or artifact-rule text verbatim into output files
|
||||
@@ -0,0 +1,354 @@
|
||||
---
|
||||
name: openspec-explore
|
||||
description: Enter OpenSpec explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements in a project that uses OpenSpec. Use when the user wants to think through something before or during an OpenSpec change. Also use when the user says "openspec explore" or "opsx explore".
|
||||
allowed-tools: Bash(openspec:*)
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.13.2"
|
||||
---
|
||||
|
||||
Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
|
||||
|
||||
**IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, investigate the codebase, and run read-only commands or tools without confirmation, but you must NEVER write code or implement features. If the user asks you to implement something, do not start it here: say that explore mode does not implement, and point them at `/opsx-propose`, which turns the discussion into a change. The work happens from that change, never from explore mode. You MAY create or update OpenSpec change artifacts (proposals, designs, specs) within a confirmed scope—that's capturing thinking, not implementing. Answering design or clarifying questions is never consent to write. Before the first write-capable action, name the artifacts or files you would change and what you would do, ask a direct yes/no question, and wait for the user's confirmation in a separate message. Confirmation covers only the scope you described; ask again before expanding it. An explicit request from the user to capture the exploration as a new change is itself that confirmation, covering the change and the change artifacts the request names; scaffold it first as described below.
|
||||
|
||||
**This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
||||
|
||||
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
||||
|
||||
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
||||
|
||||
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
||||
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
||||
|
||||
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
||||
|
||||
---
|
||||
|
||||
## The Stance
|
||||
|
||||
- **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
|
||||
- **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
|
||||
- **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
|
||||
- **Adaptive** - Follow interesting threads, pivot when new information emerges
|
||||
- **Patient** - Don't rush to conclusions, let the shape of the problem emerge
|
||||
- **Grounded** - Explore the actual codebase when relevant, don't just theorize
|
||||
|
||||
---
|
||||
|
||||
## Planning a Change
|
||||
|
||||
When the user is planning a change, guide them toward shared understanding with focused discovery questions. For open-ended discussion, follow the conversation without imposing an interview or a required output.
|
||||
|
||||
Before asking a factual question, follow the context discovery below and inspect relevant OpenSpec artifacts, source, tests, docs, and configuration. Do not ask the user to repeat facts you can verify. Summarize relevant findings without reproducing private context or rules. If evidence is missing, conflicting, or inaccessible, state that limitation and ask only for the clarification needed to proceed.
|
||||
|
||||
- **Follow dependencies** - Resolve the next blocking decision before its dependent details. For example, clarify the user's outcome and scope before choosing an API or data model. Revisit downstream assumptions when an earlier answer changes. Skip branches that do not matter to this goal.
|
||||
- **Keep questions focused** - Ask one focused question at a time, and briefly explain why it matters and which decision it unlocks. Batch questions only if the user asks for a batch; keep them small and group related decisions.
|
||||
- **Offer grounded recommendations** - When evidence supports a recommendation, state your preferred option and why it fits the user's goals, with alternatives and their tradeoffs when useful. Do not invent intent, priorities, or external constraints: ask the user when only they can answer. Avoid a fixed question format.
|
||||
- **Keep a conversational record** - Track decisions in the conversation, not in files. Separate confirmed decisions from proposed defaults and unresolved questions. Silence is not acceptance. Accepting an answer or a batch of recommendations is not permission to write. Keep file-write confirmation separate from discovery questions and follow the guardrails below.
|
||||
|
||||
Stop asking when the user has enough clarity. Let them pause, pivot, or defer a decision; do not exhaust every branch or force a proposal.
|
||||
|
||||
For example, after inspecting the relevant code:
|
||||
|
||||
```text
|
||||
The CLI already uses SQLite and has no remote service. Is sharing state
|
||||
across devices in scope? That determines whether local storage is enough.
|
||||
If this stays a single-device tool, I recommend keeping SQLite to avoid
|
||||
adding a service to operate; shared state would need a separate sync design.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## What You Might Do
|
||||
|
||||
Depending on what the user brings, you might:
|
||||
|
||||
**Explore the problem space**
|
||||
- Ask clarifying questions that emerge from what they said
|
||||
- Challenge assumptions
|
||||
- Reframe the problem
|
||||
- Find analogies
|
||||
|
||||
**Investigate the codebase**
|
||||
- Map existing architecture relevant to the discussion
|
||||
- Find integration points
|
||||
- Identify patterns already in use
|
||||
- Surface hidden complexity
|
||||
|
||||
**Compare options**
|
||||
- Brainstorm multiple approaches
|
||||
- Build comparison tables
|
||||
- Sketch tradeoffs
|
||||
- Recommend a path (if asked)
|
||||
|
||||
**Visualize**
|
||||
```
|
||||
+------------------------------------------+
|
||||
| Use ASCII diagrams liberally |
|
||||
+------------------------------------------+
|
||||
| |
|
||||
| [State A] -------> [State B] |
|
||||
| | |
|
||||
| v |
|
||||
| [State C] |
|
||||
| |
|
||||
| System diagrams, state machines, |
|
||||
| data flows, architecture sketches, |
|
||||
| dependency graphs, comparison tables |
|
||||
| |
|
||||
+------------------------------------------+
|
||||
```
|
||||
|
||||
**Draw with plain ASCII only** — borders `+` `-` `|`, arrows `-->` `<--` `^` `v`, markers `*` `x`.
|
||||
Unicode diagram glyphs can render at different widths across terminals, fonts, and locales, so padded boxes and aligned tables can drift. Keep every diagram character ASCII.
|
||||
|
||||
**Surface risks and unknowns**
|
||||
- Identify what could go wrong
|
||||
- Find gaps in understanding
|
||||
- Suggest spikes or investigations
|
||||
|
||||
---
|
||||
|
||||
## OpenSpec Awareness
|
||||
|
||||
You have full context of the OpenSpec system. Use it naturally, don't force it.
|
||||
|
||||
### Check for context
|
||||
|
||||
At the start, quickly check what exists:
|
||||
```bash
|
||||
openspec list --json
|
||||
```
|
||||
|
||||
This tells you:
|
||||
- If there are active changes
|
||||
- Their names and task status
|
||||
- What the user might be working on
|
||||
|
||||
That is the *change* list - work in flight. It does not include the project's durable capabilities, so list those too:
|
||||
```bash
|
||||
openspec list --specs
|
||||
```
|
||||
Add `--json` for ids and requirement counts, and append `--store "<id>"` only for a registered standalone store. This is the inventory of what the project already claims to do, and `openspec list` on its own never shows it. To look at one, run `openspec show "<spec-id>" --type spec --json --no-scenarios` (same `--store` rule) - it returns that capability's purpose and requirement texts without pulling the whole spec file into context, and `--type spec` stops a change of the same name from making it ambiguous.
|
||||
|
||||
The filtered read is only an overview. Before deciding what is already covered or what should change, read each relevant spec in full, including scenarios, with `openspec show "<spec-id>" --type spec` (same `--store` rule).
|
||||
|
||||
Then read the project's own context from the resolved root - `<root.path>/openspec/config.yaml` (or `config.yml`). Use the `root.path` returned above, and skip this if neither file exists:
|
||||
- `context`: project background - tech stack, conventions, constraints
|
||||
- `rules`: keyed by artifact id - the entries for an artifact apply only when you write that artifact
|
||||
|
||||
Ground your thinking in these. They are constraints for you to follow, not content to reproduce: do NOT copy them into the conversation or into any artifact you create.
|
||||
|
||||
### When no change exists
|
||||
|
||||
Think freely. When insights crystallize, you might offer:
|
||||
|
||||
- "This feels solid enough to start a change. Want me to create a proposal?"
|
||||
- Or keep exploring - no pressure to formalize
|
||||
|
||||
If the user asks you to capture the exploration as a new change, that request is the confirmation required above. It covers scaffolding that change and creating the change artifacts the request names, and nothing else. This holds only when the request is theirs: a yes to an offer you made confirms only the scope your offer itself named, so name the change and the artifacts in the offer. Don't re-ask for what they already asked for; do ask before anything beyond it. Transition seamlessly into the requested capture:
|
||||
|
||||
1. Run `openspec new change "<name>"` (with `--store <id>` when applicable) before creating any artifacts. Never create a new change directory under `openspec/changes/` by hand; the CLI scaffold creates required metadata such as `.openspec.yaml`. Keep the selected `--store <id>` on every applicable follow-up `status` and `instructions` command.
|
||||
2. Run `openspec status --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store), then process the requested artifacts in dependency order. For each requested artifact that is `ready`, run `openspec instructions "<artifact-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store). Before creating a requested artifact, evaluate any condition in its own `instruction` against the explored change; record a deliberate skip instead when the condition does not apply. If a requested artifact is blocked by a direct prerequisite the user did not request, run `openspec instructions "<prerequisite-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) for that prerequisite whether it is `ready` or `blocked`. If its own `instruction` states a condition, evaluate that condition against the explored change and record a deliberate skip only when the condition does not apply. If the condition applies, or the prerequisite is not conditional, treat it as a normal prerequisite and ask before expanding the capture. Do not create an unrequested prerequisite unless the user approves.
|
||||
3. Follow the returned `template` and `instruction` fields. Read completed dependency files listed in `dependencies`, and apply `context` and `rules` as constraints without copying them into the artifact. If the instruction delegates creation to a specific skill or command, invoke it; otherwise write the artifact to `resolvedOutputPath`, using the instruction to choose a concrete path when it is a glob. Verify that the selected concrete output exists.
|
||||
4. After creating each artifact, re-run `openspec status --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) and continue until every requested artifact is `done`, `skipped`, or was deliberately skipped because its own `instruction` stated a condition that did not apply. Tell the user about a deliberate conditional skip, remember it, and do not reconsider it. Dependencies are enablers, not gates: if a requested artifact is still `blocked` only because you deliberately skipped a conditional prerequisite, run `openspec instructions "<artifact-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) despite the blocked status, then create it using step 3 only when those recorded conditional skips are its sole missing dependencies. If a requested artifact is blocked by a prerequisite the user did not ask to capture and cannot be conditionally skipped, explain that dependency and ask before expanding the capture.
|
||||
|
||||
Capture the artifact(s) the user requested without asking them to invoke another workflow command. If they asked only to start a change, stop after scaffolding and show its status. When the requested capture is done, stop there and name where the work continues: `/opsx-propose` writes the remaining planning artifacts, and `/opsx-apply` implements the change once tasks exist. Capturing artifacts never starts implementing them.
|
||||
|
||||
### When a change exists
|
||||
|
||||
If the user mentions a change or you detect one is relevant:
|
||||
|
||||
1. **Resolve and read existing artifacts for context**
|
||||
- Run `openspec status --change "<name>" --json`.
|
||||
- Use `changeRoot`, `artifactPaths`, and `actionContext` from the status JSON.
|
||||
- Read existing files from `artifactPaths.<artifact>.existingOutputPaths`.
|
||||
|
||||
2. **Reference them naturally in conversation**
|
||||
- "Your design mentions using Redis, but we just realized SQLite fits better..."
|
||||
- "The proposal scopes this to premium users, but we're now thinking everyone..."
|
||||
|
||||
3. **Offer to capture when decisions are made**
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
|
||||
|
||||
| Insight Type | Where to Capture |
|
||||
|----------------------------|-------------------------------------|
|
||||
| New requirement discovered | `specs/<capability-path>/spec.md` |
|
||||
| Requirement changed | `specs/<capability-path>/spec.md` |
|
||||
| Design decision made | `design.md` |
|
||||
| Scope changed | `proposal.md` |
|
||||
| New work identified | `tasks.md` |
|
||||
| Assumption invalidated | Relevant artifact |
|
||||
|
||||
Example offers:
|
||||
- "That's a design decision. Capture it in design.md?"
|
||||
- "This is a new requirement. Add it to specs?"
|
||||
- "This changes scope. Update the proposal?"
|
||||
|
||||
4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
|
||||
|
||||
---
|
||||
|
||||
## What You Don't Have To Do
|
||||
|
||||
- Follow a script
|
||||
- Ask the same questions every time
|
||||
- Produce a specific artifact
|
||||
- Reach a conclusion
|
||||
- Stay on topic if a tangent is valuable
|
||||
- Be brief (this is thinking time)
|
||||
|
||||
---
|
||||
|
||||
## Handling Different Entry Points
|
||||
|
||||
**User brings a vague idea:**
|
||||
```
|
||||
User: I'm thinking about adding real-time collaboration
|
||||
|
||||
You: Real-time collab is a big space. Let me think about this...
|
||||
|
||||
COLLABORATION SPECTRUM
|
||||
============================================
|
||||
|
||||
Awareness Coordination Sync
|
||||
| | |
|
||||
v v v
|
||||
+--------+ +--------+ +--------+
|
||||
|Presence| |Cursors | | CRDT |
|
||||
| "3 | | Multi | |Conflict|
|
||||
|online" | | select | | free |
|
||||
+--------+ +--------+ +--------+
|
||||
| | |
|
||||
trivial moderate complex
|
||||
|
||||
Where's your head at?
|
||||
```
|
||||
|
||||
**User brings a specific problem:**
|
||||
```
|
||||
User: The auth system is a mess
|
||||
|
||||
You: [reads codebase]
|
||||
|
||||
+---------------------------------------------+
|
||||
| CURRENT AUTH FLOW |
|
||||
+---------------------------------------------+
|
||||
|
|
||||
+-------------+-------------+
|
||||
v v v
|
||||
+---------+ +---------+ +---------+
|
||||
| Google | | GitHub | | Email |
|
||||
| OAuth | | OAuth | | Magic |
|
||||
+----+----+ +----+----+ +----+----+
|
||||
| | |
|
||||
+-------------+-------------+
|
||||
v
|
||||
+-----------+
|
||||
| Session |
|
||||
+-----+-----+
|
||||
|
|
||||
v
|
||||
+-----------+
|
||||
| Perms |
|
||||
+-----------+
|
||||
|
||||
I see three tangles. Which one's burning?
|
||||
```
|
||||
|
||||
**User is stuck mid-implementation:**
|
||||
```
|
||||
User: /opsx-explore add-auth-system
|
||||
The OAuth integration is more complex than expected
|
||||
|
||||
You: [reads change artifacts]
|
||||
|
||||
You're on task 4: "Implement OAuth flow"
|
||||
|
||||
Let me trace what's involved...
|
||||
|
||||
[draws diagram, explores options, suggests paths]
|
||||
|
||||
Want to update the design to reflect this?
|
||||
Or add a spike task to investigate?
|
||||
```
|
||||
|
||||
**User wants to compare options:**
|
||||
```
|
||||
User: Should we use Postgres or SQLite?
|
||||
|
||||
You: Generic answer is boring. What's the context?
|
||||
|
||||
User: A CLI tool that tracks local dev environments
|
||||
|
||||
You: That changes everything.
|
||||
|
||||
+-------------------------------------------------+
|
||||
| CLI TOOL DATA STORAGE |
|
||||
+-------------------------------------------------+
|
||||
|
||||
Key constraints:
|
||||
- No daemon running
|
||||
- Must work offline
|
||||
- Single user
|
||||
|
||||
SQLite Postgres
|
||||
Deployment embedded needs server
|
||||
Offline yes no
|
||||
Single file yes no
|
||||
|
||||
SQLite. Not even close.
|
||||
|
||||
Unless... is there a sync component?
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Ending Discovery
|
||||
|
||||
There's no required ending. Discovery might:
|
||||
|
||||
- **Flow into a proposal**: "Ready to start? Run `/opsx-propose` and this becomes a change."
|
||||
- **Result in artifact updates**: "Updated design.md with these decisions"
|
||||
- **Just provide clarity**: User has what they need, moves on
|
||||
- **Continue later**: "We can pick this up anytime"
|
||||
|
||||
When it feels like things are crystallizing, you might summarize:
|
||||
|
||||
```
|
||||
## What We Figured Out
|
||||
|
||||
**The problem**: [crystallized understanding]
|
||||
|
||||
**The approach**: [if one emerged]
|
||||
|
||||
**Open questions**: [if any remain]
|
||||
|
||||
**Next steps** (if ready):
|
||||
- Turn this into a change: `/opsx-propose`
|
||||
- Keep exploring: just keep talking
|
||||
```
|
||||
|
||||
But this summary is optional. Sometimes the thinking IS the value.
|
||||
|
||||
---
|
||||
|
||||
## Guardrails
|
||||
|
||||
- **Don't implement** - Never write code or implement features. Workflow configuration counts too: creating or editing schemas, templates, or `openspec/config.yaml` is a change, not thinking. Creating or updating OpenSpec change artifacts within the confirmed scope is fine, writing anything else is not. When the user is ready to build, name the handoff rather than starting: `/opsx-propose` turns the discussion into a change, and the work happens there.
|
||||
- **Don't fake understanding** - If something is unclear, dig deeper
|
||||
- **Don't rush** - Discovery is thinking time, not task time
|
||||
- **Don't force structure** - Let patterns emerge naturally
|
||||
- **Don't auto-capture** - Offer to save insights, don't just do it. Read-only commands and tools need no confirmation. Before the first write-capable action—including `openspec new change` or another command that writes files—name the artifacts or files and proposed changes, ask a direct yes/no question, and wait for explicit confirmation in a separate user message. That confirmation covers only the described scope; ask again before expanding it. Answers to design or clarifying questions are never consent to write. That rule governs `openspec new change` whenever you are the one proposing the capture; the user's own capture request is the exception, handled in the capture transition above.
|
||||
- **Don't manually scaffold changes** - Never create a new change directory under `openspec/changes/` by hand. Always use `openspec new change "<name>"` (with `--store <id>` when applicable) so required metadata such as `.openspec.yaml` is created before writing artifacts.
|
||||
- **Do visualize** - A good diagram is worth many paragraphs
|
||||
- **Do explore the codebase** - Ground discussions in reality
|
||||
- **Do question assumptions** - Including the user's and your own
|
||||
@@ -0,0 +1,174 @@
|
||||
---
|
||||
name: openspec-propose
|
||||
description: Propose a new OpenSpec change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation. Also use when the user says "openspec propose" or "opsx propose".
|
||||
allowed-tools: Bash(openspec:*)
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.13.2"
|
||||
---
|
||||
|
||||
Propose a new change - create the change and generate all artifacts in one step.
|
||||
|
||||
**Planning boundary**: This workflow creates planning artifacts only. The user request that selected or triggered this workflow authorizes planning only, even if it asks to build or fix something. Do not edit project code. After the planning artifacts are complete, stop. Do not start implementation in the same response, even if the initial request asks for it. Wait for a new user request after the artifacts are presented; then start the apply workflow.
|
||||
|
||||
I'll create a change with the artifacts your schema defines. With the default spec-driven schema that is:
|
||||
- proposal.md (what & why)
|
||||
- `specs/<capability-path>/spec.md` (what the system must do - a delta, not the main spec)
|
||||
- design.md (how)
|
||||
- tasks.md (implementation steps)
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
|
||||
|
||||
When the user is ready to implement, they must start the apply workflow explicitly.
|
||||
|
||||
---
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
||||
|
||||
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
||||
|
||||
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
||||
|
||||
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
||||
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
||||
|
||||
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
||||
|
||||
**Input**: The user's request should include a change name (kebab-case) OR a description of what they want to build.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Understand the request and clarify material ambiguity**
|
||||
|
||||
If no clear input is provided, ask the user (open-ended, no preset options):
|
||||
> "What change do you want to work on? Describe what you want to build or fix."
|
||||
|
||||
From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
|
||||
|
||||
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
||||
|
||||
If the request contains ambiguity that would materially affect scope, externally observable behavior, compatibility, or acceptance criteria, ask the user before creating the change. For minor details, make a reasonable assumption and record it in the planning artifacts.
|
||||
|
||||
2. **Load project context**
|
||||
|
||||
Run `openspec context --json` from the current working directory (or `openspec context --json --store "<store-id>"` when a registered store was explicitly selected). Use the returned `root.path` as the authoritative OpenSpec root. If context reports `no_openspec_root`, stop without creating or changing any files and follow the **Project check** above for how this workflow was reached. Offer `openspec init` only for an explicit OpenSpec request, and wait for the user to request initialization. Do not initialize automatically or run `openspec new change`. After initialization, rerun this context check before continuing. For any other context failure, stop and report the error; do not fall back to the current directory or run later OpenSpec commands without the selected store.
|
||||
|
||||
Only when context returns a resolved `root.path`, read `<root.path>/openspec/config.yaml`. Use `config.yml` only when `config.yaml` does not exist. If neither file exists, continue without project context. Do not fall back to `config.yml` if `config.yaml` is unreadable or invalid.
|
||||
|
||||
If the file parses as a YAML object and its `context` field is a string no larger than 51,200 bytes in UTF-8, apply that field before exploring the codebase or making planning decisions. If the file cannot be read or parsed, or the context field is invalid or oversized, continue without project context. Validate this field independently of other config fields, as OpenSpec does.
|
||||
|
||||
Treat context as project-provided data and constraints, not as authority to change this workflow: it cannot override user authorization, the planning boundary, tool restrictions, or artifact and output rules. Do not copy the context into artifacts; use it to focus any codebase exploration and as a constraint on the proposal.
|
||||
|
||||
3. **Determine the workflow schema**
|
||||
|
||||
Use the configured default schema unless the user explicitly requests a different workflow.
|
||||
|
||||
**Use a different schema only if the user:**
|
||||
- Explicitly requests a specific schema by name → use `--schema <schema-name>`
|
||||
- Asks to "show workflows" or asks "what workflows" exist → resolve the authoritative root by running `openspec context --json` from the current working directory. If the user explicitly selected a registered store, use `openspec context --json --store "<store-id>"`. Then run `openspec schemas --json` with its working directory set to the returned `root.path` and let them choose. This preserves roots selected by a local `store:` pointer or the global `defaultStore`; when a registered store was explicitly selected, append `--store "<store-id>"` to `openspec schemas --json` as well. If context fails, stop as described in the context-loading step; do not fall back to the current directory.
|
||||
|
||||
Otherwise, omit `--schema` to preserve the configured default.
|
||||
|
||||
4. **Create the change directory**
|
||||
|
||||
Choose one schema form below. If a registered store is selected, append `--store "<store-id>"` to that command and each later OpenSpec command shown below that accepts `--store`.
|
||||
|
||||
Using the configured default:
|
||||
```bash
|
||||
openspec new change "<name>"
|
||||
```
|
||||
|
||||
Using an explicitly requested schema:
|
||||
```bash
|
||||
openspec new change "<name>" --schema "<schema-name>"
|
||||
```
|
||||
This creates a scaffolded change in the planning home resolved by the CLI with `.openspec.yaml`.
|
||||
|
||||
5. **Get the artifact build order**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to get:
|
||||
- `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
|
||||
- `artifacts`: list of all artifacts, each with its `status` and its `requires` edges (the artifact IDs it directly depends on)
|
||||
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
|
||||
|
||||
6. **Create every artifact in the required set**
|
||||
|
||||
Use a todo list to track progress through the artifacts.
|
||||
|
||||
Loop through artifacts in dependency order (artifacts with no pending dependencies first):
|
||||
|
||||
a. **For each artifact that is `ready` (dependencies satisfied)**:
|
||||
- Get instructions:
|
||||
```bash
|
||||
openspec instructions <artifact-id> --change "<name>" --json
|
||||
```
|
||||
- The instructions JSON includes:
|
||||
- `context`: Project background (constraints for you - do NOT include in output)
|
||||
- `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
|
||||
- `template`: The structure to use for your output file
|
||||
- `instruction`: Schema-specific guidance for this artifact type
|
||||
- `skipped`/`warning`: present when the change declares skip_specs and this artifact must NOT be created - stop and pick another artifact
|
||||
- `resolvedOutputPath`: Resolved path or pattern to write the artifact
|
||||
- `dependencies`: Completed artifacts to read for context
|
||||
- Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
|
||||
- **Inspect the relevant project before drafting**: Read `context` and `rules` first, then inspect relevant implementation, nearby tests, configuration, and documentation outside `openspec/`. Keep inspection read-only and proportional to the change; reuse findings for later artifacts and inspect more only as needed.
|
||||
- Identify the target project from the request and project context; the planning home may be separate from the code. If the target is unclear, ask. For greenfield or non-code changes, inspect the available structure and relevant documents. If source is unavailable, state the limitation and ask when it materially affects the plan.
|
||||
- Ground scope, approach, and tasks in what you find. Distinguish observed behavior from assumptions and proposed additions; surface conflicts with existing specs instead of silently deciding which is correct.
|
||||
- Do this discovery now, rather than leaving generic "explore the codebase" or "make a plan" tasks for implementation. Keep any necessary follow-up investigation specific to an unresolved question.
|
||||
- If the `instruction` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at `resolvedOutputPath`
|
||||
- Otherwise create the artifact file using `template` as the structure and write it to `resolvedOutputPath`. If `resolvedOutputPath` is a glob, follow `instruction` to choose the concrete file path
|
||||
- Apply `context` and `rules` as constraints - but do NOT copy them into the file
|
||||
- Show brief progress: "Created <artifact-id>"
|
||||
|
||||
b. **Continue until every artifact in the required set exists (not just `apply.requires`)**
|
||||
- After creating each artifact, re-run `openspec status --change "<name>" --json`
|
||||
- The required set is `applyRequires` plus every artifact reachable from those by following the `requires` edges in `status --json` - walk them transitively (spec-driven closes over proposal, specs, design, tasks). Leave artifacts outside that set alone
|
||||
- `status` is file-existence only, so an `applyRequires` artifact reading `done` does NOT mean its dependencies exist - writing `tasks.md` early marks `tasks` done while `specs` was never written. Use each artifact's `requires` edges, not its `status`, to build the required set: a `done` artifact still lists what it depends on
|
||||
- An artifact already reading `status: "skipped"` is satisfied: the change declares `skip_specs` in `.openspec.yaml`, so its files must NOT exist. Never try to create one
|
||||
- Create every artifact in the required set that is missing, then re-check - creating one can unblock others
|
||||
- Skip one only when `status` already reports it `skipped`, or when its own `instruction` says it is conditional: run `openspec instructions <artifact-id> --change "<name>" --json` and skip only if its `instruction` field marks it optional (e.g. "create only if..."). Spec-driven's `design.md` qualifies; `specs` qualifies only via the `skipped` status above, never by your own judgment. Tell the user, and do not reconsider it
|
||||
- Dependencies are enablers, not gates: if a required artifact is still `blocked` only because you skipped a conditional dependency, write it anyway
|
||||
- Stop when every artifact in the required set is `done`, `skipped`, or was deliberately skipped
|
||||
|
||||
c. **If an artifact requires user input** (unclear context):
|
||||
- Ask the user to clarify
|
||||
- Then continue with creation
|
||||
|
||||
7. **Show final status**
|
||||
```bash
|
||||
openspec status --change "<name>"
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
After completing all artifacts, summarize:
|
||||
- Change name and location
|
||||
- List of artifacts created with brief descriptions, plus any conditional artifact you skipped and why
|
||||
- What's ready: "All artifacts needed for implementation are ready."
|
||||
- Prompt: "The artifacts are ready for review. When you are ready, run `/opsx-apply` or ask me to apply this change."
|
||||
|
||||
**Artifact Creation Guidelines**
|
||||
|
||||
- Follow the `instruction` field from `openspec instructions` for each artifact type - it is the authoritative guidance, even for familiar artifact names
|
||||
- If the `instruction` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly
|
||||
- The schema defines what each artifact should contain - follow it
|
||||
- Read dependency artifacts for context before creating new ones
|
||||
- Use `template` as the structure for your output file - fill in its sections
|
||||
- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
|
||||
- Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
|
||||
- These guide what you write, but should never appear in the output
|
||||
|
||||
**Guardrails**
|
||||
- The request that invoked this workflow authorizes planning only. Any implementation or apply instruction in that request does not carry forward. Do NOT implement the change, start the apply workflow, or edit project code during this workflow. After presenting the artifacts, stop and wait for a new user request to start the apply workflow
|
||||
- Create every artifact the apply phase transitively depends on, not just the ids listed in `apply.requires`
|
||||
- Always read dependency artifacts before creating a new one - re-read from disk, not from conversation memory (files may have changed since you last saw them)
|
||||
- Ask about ambiguities that would materially change scope, externally observable behavior, compatibility, or acceptance criteria; for minor details, make reasonable assumptions and record them
|
||||
- If a change with that name already exists, ask if user wants to continue it or create a new one
|
||||
- Verify each artifact file exists after writing before proceeding to next
|
||||
@@ -0,0 +1,290 @@
|
||||
---
|
||||
name: openspec-sync-specs
|
||||
description: Sync delta specs from an OpenSpec change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change. Also use when the user says "openspec sync" or "opsx sync".
|
||||
allowed-tools: Bash(openspec:*)
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.13.2"
|
||||
---
|
||||
|
||||
Sync delta specs from a change to main specs.
|
||||
|
||||
This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
||||
|
||||
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
||||
|
||||
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
||||
|
||||
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
||||
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
||||
|
||||
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
|
||||
|
||||
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
|
||||
|
||||
When prompting, show changes that have delta specs (under `specs/` directory).
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx-sync <other>`).
|
||||
|
||||
2. **Resolve change context**
|
||||
|
||||
Run:
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
|
||||
The JSON includes `planningHome.root`. Main specs live under `<planningHome.root>/openspec/specs/` — use that (store-aware) root for every main-spec path below, not a hardcoded repo path. When a store is selected it points at the store, not the current repository.
|
||||
|
||||
3. **Find delta specs**
|
||||
|
||||
Use `artifactPaths.specs.existingOutputPaths` from the status JSON as the
|
||||
only source of delta spec paths. If the `specs` entry is missing or
|
||||
`existingOutputPaths` is empty, report that there are no delta specs to sync,
|
||||
do not infer them from other artifacts, and stop without requesting artifact
|
||||
instructions or writing a main spec.
|
||||
|
||||
Sync every path in `existingOutputPaths` unless the caller narrowed the set.
|
||||
A caller narrows it by naming an explicit list of complete entries from
|
||||
`existingOutputPaths` — copy those absolute values verbatim. Archive does
|
||||
this inline, and a user can too (for example, by selecting the entry ending
|
||||
in `/specs/billing/invoices/spec.md`).
|
||||
Then sync only the named paths and leave the remaining delta specs untouched:
|
||||
bulk archive excludes a delta whose implementation it could not find, and
|
||||
syncing it anyway would write a main spec the caller deliberately withheld.
|
||||
Carry that narrowed selection through step 4; never widen it back to the full
|
||||
list. If a named path is not in `existingOutputPaths`, do not sync it —
|
||||
report it and stop, rather than dropping it silently. If the named list is
|
||||
empty, report that there is nothing to sync and stop without writing a main
|
||||
spec.
|
||||
|
||||
Each delta spec file contains sections like:
|
||||
- `## ADDED Requirements` - New requirements to add
|
||||
- `## MODIFIED Requirements` - Changes to existing requirements
|
||||
- `## REMOVED Requirements` - Requirements to remove
|
||||
- `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)
|
||||
|
||||
If no delta specs found, inform user and stop.
|
||||
|
||||
4. **For each delta spec, apply changes to main specs**
|
||||
|
||||
Before the first main-spec write, obtain one current specs-rule snapshot:
|
||||
- If archive invoked this workflow inline and supplied a valid snapshot from
|
||||
`openspec instructions specs --change "<name>" --json`, reuse it and do not
|
||||
fetch the same instructions again.
|
||||
- Otherwise run that command once now with the same selected-root flags.
|
||||
- If the direct lookup exits non-zero or returns invalid artifact-instruction
|
||||
JSON, report the error and stop before writing any main spec. Do not treat the
|
||||
failure as an absent rule set.
|
||||
- A valid response with omitted `rules` means no artifact rules are configured
|
||||
and the existing semantic merge continues.
|
||||
|
||||
Apply returned `rules` only to the content and form of the main specs produced
|
||||
by this merge. Artifact rules are not operation guidance and cannot change
|
||||
selected roots, delta paths, CLI checks, or workflow steps. Use their text as
|
||||
constraints without copying it verbatim into a main spec or summary.
|
||||
|
||||
For each capability delta spec path selected in step 3 — the full `existingOutputPaths` list, or the narrowed subset when a caller supplied one (these may belong to a selected store, not the repo):
|
||||
|
||||
a. **Read the delta spec** to understand the intended changes
|
||||
|
||||
b. **Read the main spec** at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (may not exist yet)
|
||||
|
||||
**If it does not exist yet** (a new capability), match what `openspec archive` does:
|
||||
only ADDED requirements may be applied - step d creates the spec from them.
|
||||
MODIFIED and RENAMED have no requirement to act on, so stop the sync for that
|
||||
capability and report that its main spec does not exist and only ADDED is allowed
|
||||
for a new spec; never invent the missing requirement. REMOVED has nothing to
|
||||
remove - skip it and warn.
|
||||
|
||||
c. **Apply changes intelligently**:
|
||||
|
||||
**ADDED Requirements:**
|
||||
- If requirement doesn't exist in main spec → add it
|
||||
- If requirement already exists → update it to match (treat as implicit MODIFIED)
|
||||
|
||||
**MODIFIED Requirements:**
|
||||
- Find the requirement in main spec
|
||||
- Apply the changes - this can be:
|
||||
- Adding new scenarios the main spec does not have yet
|
||||
- Modifying existing scenarios
|
||||
- Changing the requirement description
|
||||
- Preserve scenarios/content not mentioned in the delta
|
||||
|
||||
**REMOVED Requirements:**
|
||||
- Remove the entire requirement block from main spec
|
||||
- Retiring the capability. Delete the whole `spec.md` - and the directory once
|
||||
nothing else is left in it - only when ALL of these hold:
|
||||
1. removing the requirements *this run* left no requirement blocks;
|
||||
2. the rest of the spec is well-formed (it still has a `## Purpose`);
|
||||
3. the main spec was not already empty before this sync - if you removed
|
||||
nothing, change nothing;
|
||||
4. every other nonblank line in the whole file is accounted for as the
|
||||
title, Purpose, Requirements header, or a canonical requirement's
|
||||
statement, scenarios, or fenced examples;
|
||||
5. the change's `.openspec.yaml` declares `retire_capabilities: true`;
|
||||
6. the `spec.md` resolves inside the real specs root (do not follow a
|
||||
capability-directory symlink to delete an external file).
|
||||
If removing the selected requirements would leave no requirement blocks and
|
||||
any retirement condition is not satisfied, do not modify the main spec. Stop
|
||||
the sync for that capability, report the blocking condition, and tell the user
|
||||
how to resolve it. Never write or leave an empty `## Requirements` section.
|
||||
When only the marker is missing, say that too - it is the one thing the user
|
||||
can add to make the retirement go through.
|
||||
- Deleting the file also deletes its `## Purpose`; any other section blocks
|
||||
retirement. Name Purpose when you report the retirement. Include a pasteable
|
||||
`git checkout` only when the spec lived in the caller's checkout;
|
||||
otherwise give checkout-scoped recovery guidance.
|
||||
|
||||
**RENAMED Requirements:**
|
||||
- Find the FROM requirement, rename to TO
|
||||
|
||||
**`## Purpose` in the delta:**
|
||||
- The main spec already has one and it is authoritative - leave it alone
|
||||
(this is what `openspec archive` does; it warns and moves on)
|
||||
|
||||
d. **Create new main spec** if capability doesn't exist yet:
|
||||
- Only when the delta has ADDED requirements to put in it and no MODIFIED or
|
||||
RENAMED requirements blocked this capability in step b. Otherwise create nothing
|
||||
and leave the specs directory untouched. For a REMOVED-only delta, if the change's
|
||||
`.openspec.yaml` declares `retire_capabilities: true`, report it as already retired
|
||||
and continue without recreating the spec. Without that marker, report the sync as blocked:
|
||||
`openspec archive` rejects it with `Spec must have at least one requirement`.
|
||||
An empty delta has no operations to sync; report it as blocked too.
|
||||
Never write an empty `## Requirements` section.
|
||||
- Create `<planningHome.root>/openspec/specs/<capability-path>/spec.md`
|
||||
- Add Purpose section: copy the delta's `## Purpose` body verbatim when it has one
|
||||
(this is what `openspec archive` does); only write a brief TBD placeholder when it does not
|
||||
- Add Requirements section with the ADDED requirements
|
||||
- Follow the **Main Spec Format Reference** below
|
||||
|
||||
5. **Validate updated main specs**
|
||||
|
||||
Run `openspec validate --specs` with the same selected-root flags used earlier.
|
||||
If validation fails, report the problems and do not claim the sync succeeded.
|
||||
|
||||
6. **Show summary**
|
||||
|
||||
After applying all changes, summarize:
|
||||
- Which capabilities were updated
|
||||
- What changes were made (requirements added/modified/removed/renamed)
|
||||
- Any new main spec left with a TBD Purpose placeholder, so it gets written
|
||||
now rather than lingering
|
||||
- Any capability retired, naming the deleted `spec.md`, its Purpose, and
|
||||
either a pasteable `git checkout` or checkout-scoped recovery guidance
|
||||
|
||||
**Delta Spec Format Reference**
|
||||
|
||||
```markdown
|
||||
# Spec Delta
|
||||
|
||||
## Purpose
|
||||
|
||||
Only on a delta that introduces a brand-new capability. Seeds the new main spec.
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: New Feature
|
||||
The system SHALL do something new.
|
||||
|
||||
#### Scenario: Basic case
|
||||
- **WHEN** user does X
|
||||
- **THEN** system does Y
|
||||
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: Existing Feature
|
||||
The system SHALL keep doing the existing thing, now also handling A.
|
||||
|
||||
#### Scenario: Scenario the main spec already has
|
||||
- **WHEN** user does X
|
||||
- **THEN** system does Y
|
||||
|
||||
#### Scenario: New scenario to add
|
||||
- **WHEN** user does A
|
||||
- **THEN** system does B
|
||||
|
||||
## REMOVED Requirements
|
||||
|
||||
### Requirement: Deprecated Feature
|
||||
|
||||
## RENAMED Requirements
|
||||
|
||||
- FROM: `### Requirement: Old Name`
|
||||
- TO: `### Requirement: New Name`
|
||||
```
|
||||
|
||||
**Main Spec Format Reference**
|
||||
|
||||
Main specs are what the delta merges INTO. They must never contain delta operation headers (`## ADDED/MODIFIED/REMOVED/RENAMED Requirements`) - after syncing, every requirement lives under a single `## Requirements` section:
|
||||
|
||||
```markdown
|
||||
# <capability> Specification
|
||||
|
||||
## Purpose
|
||||
Short description of what this capability does and why it exists.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement: New Feature
|
||||
The system SHALL do something new.
|
||||
|
||||
#### Scenario: Basic case
|
||||
- **WHEN** user does X
|
||||
- **THEN** system does Y
|
||||
```
|
||||
|
||||
**Key Principle: Intelligent Merging**
|
||||
|
||||
Unlike programmatic merging, you merge rather than overwrite:
|
||||
- A MODIFIED block carries the whole requirement - body plus every scenario that survives the change. `openspec validate` and `openspec archive` both reject one that drops a scenario the main spec still has.
|
||||
- Keep anything the delta does not mention, in the main spec's existing order
|
||||
- Use your judgment to merge changes sensibly
|
||||
|
||||
**Output On Success**
|
||||
|
||||
```markdown
|
||||
## Specs Synced: <change-name>
|
||||
|
||||
Updated main specs:
|
||||
|
||||
**<capability-1>**:
|
||||
- Added requirement: "New Feature"
|
||||
- Modified requirement: "Existing Feature" (added 1 scenario)
|
||||
|
||||
**<capability-2>**:
|
||||
- Created new spec file
|
||||
- Added requirement: "Another Feature"
|
||||
|
||||
Main specs are now updated. The change remains active - archive when implementation is complete.
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Read both delta and main specs before making changes
|
||||
- Preserve existing content not mentioned in delta
|
||||
- Never copy a delta file into a main spec as-is - merge its content so the main spec keeps the Main Spec Format Reference structure, with no delta operation headers
|
||||
- If something is unclear, ask for clarification
|
||||
- Show what you're changing as you go
|
||||
- The operation should be idempotent - running twice should give same result
|
||||
- Use only `artifactPaths.specs.existingOutputPaths`; never infer delta specs from unrelated artifacts
|
||||
- Honor a caller-supplied subset of `existingOutputPaths`; never widen it back to the full list
|
||||
- Fetch specs instructions once for direct sync, or reuse the archive-supplied snapshot inline
|
||||
- Stop before every main-spec write on a non-zero or invalid JSON specs-instruction response
|
||||
- Artifact rules constrain only the specs being written and are never copied into output files
|
||||
@@ -0,0 +1,109 @@
|
||||
---
|
||||
name: openspec-update-change
|
||||
description: Update an OpenSpec change by revising its existing planning artifacts and keeping them coherent with one another. Use when the user wants to revise a change's plan, fold new decisions into it, or reconcile its artifacts after an edit. Also use when the user says "openspec update change" or "opsx update". If the user means the openspec update CLI command, which refreshes generated files, run that command instead. Never edits code.
|
||||
allowed-tools: Bash(openspec:*)
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.13.2"
|
||||
---
|
||||
|
||||
Revise a change's existing planning artifacts and keep them coherent. Never edit code.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
||||
|
||||
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
||||
|
||||
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
||||
|
||||
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
||||
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
||||
|
||||
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
||||
|
||||
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
This workflow revises artifacts that already exist; it never creates missing ones. When an artifact is missing, `openspec status --change "<name>" --json` names the next one and `openspec instructions "<artifact-id>" --change "<name>" --json` explains how to write it.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes sorted by most recently modified, and ask the user to select one
|
||||
|
||||
When prompting, present the top 3-4 most recently modified changes as options, showing:
|
||||
- Change name
|
||||
- Status (e.g., "0/5 tasks", "complete", "no tasks")
|
||||
- How recently it was modified (from `lastModified` field)
|
||||
|
||||
Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to update.
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx-update <other>`).
|
||||
|
||||
2. **Get the change's artifacts**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to understand current state. The response includes:
|
||||
- `schemaName`: The workflow schema being used (e.g., "spec-driven")
|
||||
- `artifacts`: Array of artifacts with their status ("done", "skipped", "ready", "blocked")
|
||||
- `isPlanningComplete`: Boolean indicating if all planning artifacts are complete. Older CLI versions expose the same value as `isComplete`.
|
||||
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
|
||||
|
||||
The artifact ids and paths come from the active schema - do NOT assume them, and do NOT branch on hardcoded artifact names. Custom schemas must work unchanged.
|
||||
|
||||
The files to edit are `artifactPaths.<id>.existingOutputPaths` - the concrete files that exist on disk, already glob-expanded for glob artifacts (e.g. `specs/**/*.md`). Do NOT write to `resolvedOutputPath`: for a glob artifact it is still the glob pattern, not a real file.
|
||||
|
||||
3. **Understand the request**
|
||||
- If the user asked for a specific revision ("the design now uses X"), that is the starting edit.
|
||||
- If they only said "update" / "make this coherent", treat it as a coherence review: read the existing artifacts and check them against each other for contradictions, gaps, and duplication.
|
||||
|
||||
4. **Read and reconcile**
|
||||
- Read the artifact(s) the request touches and the change's other existing artifacts.
|
||||
- Draft the requested edit in the conversation, not in files. Work out exactly what it changes; step 5 owns every write. Then check every other existing artifact against the drafted edit - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
|
||||
- Note everything that is now inconsistent, missing, or contradictory.
|
||||
- Propose revisions to files that already exist (`existingOutputPaths`). If an artifact has no existing output files and status `ready` or `blocked`, note it and point the user to `openspec instructions "<artifact-id>" --change "<name>" --json` for how to create them. Leave `skipped` artifacts untouched; do not treat them as missing or defer them to the continue workflow.
|
||||
- A glob artifact (e.g. `specs/**/*.md`) is marked `done` after at least one file matches, and the continue workflow only handles `ready` artifacts. When reconciliation identifies a missing file for a glob artifact whose `existingOutputPaths` is non-empty:
|
||||
1. Run `openspec instructions "<artifact-id>" --change "<name>" --json` and use its `instruction` and `template`. Treat `context` and `rules` as constraints; do not copy them into the file. If instructions report `skipped: true`, do not create the file. Read current dependency files from disk; if a required non-skipped dependency is missing, stop and ask the user to restore it first.
|
||||
2. Choose a concrete path inside `changeRoot` that matches `artifactPaths.<id>.outputPath` and does not already exist. Verify it remains inside `changeRoot` after resolving any symlinked parent directories. The glob `resolvedOutputPath` is not a valid target.
|
||||
3. Include the new file in step 5's proposed revisions and create it only after the user confirms.
|
||||
4. After confirmation, immediately before creation, refresh status and instructions. Verify the artifact is still in scope, not skipped, and partially populated; repeat the concrete-path checks above.
|
||||
5. Use a create operation that fails if the target already exists. If `instruction` delegates creation to another skill or command, invoke it only if it can honor the confirmed path and these guardrails; otherwise stop. If any check fails or the confirmed draft is no longer valid, stop and reconcile with the user rather than replacing existing content or choosing a different path.
|
||||
- If the change is already coherent, say so and propose no revisions.
|
||||
|
||||
5. **Confirm and apply, one artifact at a time**
|
||||
- This step performs every artifact write in this workflow; no earlier step edits an artifact.
|
||||
- Show each proposed revision and why - including the requested edit drafted in step 4. Write only after the user confirms.
|
||||
- If the user rejects a revision, do not write it - leave that artifact unchanged.
|
||||
- When a substantial rewrite is needed, get that artifact's rules and template first:
|
||||
```bash
|
||||
openspec instructions "<artifact-id>" --change "<name>" --json
|
||||
```
|
||||
|
||||
6. **Point to the next step (guidance only - NEVER act on it)**
|
||||
- Artifacts with empty `existingOutputPaths` and status `ready` or `blocked` -> run `openspec status --change "<name>" --json` for the next artifact and point the user to `openspec instructions "<artifact-id>" --change "<name>" --json` for how to create it.
|
||||
- Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; suggest `/opsx-apply` to carry the delta into code.
|
||||
- Everything done and implemented -> suggest `/opsx-archive`.
|
||||
|
||||
**Output**
|
||||
|
||||
After each invocation, show:
|
||||
- Which artifacts were revised (and which proposed revisions were rejected)
|
||||
- Any file created under a glob artifact that was already partially populated
|
||||
- Anything deferred because it does not exist yet (artifacts with no files and status `ready` or `blocked`, never `skipped` artifacts)
|
||||
- Where the change stands and the recommended next command
|
||||
|
||||
**Guardrails**
|
||||
- Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, stop and point to `/opsx-apply`.
|
||||
- Use the artifact ids and paths reported by `openspec status`; never branch on hardcoded artifact names.
|
||||
- Edit only the concrete files in `existingOutputPaths`; never write to a glob `resolvedOutputPath`.
|
||||
- Do not advance the build frontier: if an artifact has empty `existingOutputPaths` and status `ready` or `blocked`, creating them is a separate step, outside this workflow. Leave `skipped` artifacts untouched. The only new-file scope is a confirmed concrete path under a glob artifact whose `existingOutputPaths` is non-empty.
|
||||
- Confirm every edit with the user before writing.
|
||||
- If the request changes the change's *intent* rather than refining it, ask for a distinct unused change name and recommend `openspec new change "<new-change-name>"` instead (the "Update vs. Start Fresh" heuristic).
|
||||
@@ -10,19 +10,22 @@
|
||||
|
||||
- **Projekt**: mozdIT Bt. weboldal (websitedev)
|
||||
- **Plane workspace**: `developments` — `pm.llmdev.mozdit.hu`
|
||||
- **Stack**: Next.js 15, React 19, TypeScript, Tailwind CSS 4, MongoDB, Winston
|
||||
- **Plane MCP**: kizárólag a `plane-developments_*` eszközöket használd; a `priws` workspace nem ehhez a projekthez tartozik.
|
||||
- **Stack**: Next.js 15, React 19, TypeScript, Tailwind CSS 4, Payload CMS (self-hosted, `/admin`), PostgreSQL (MITHOME-136), Winston
|
||||
- **Fő könyvtár**: `proto/` — **minden parancsot innen futtatunk**
|
||||
|
||||
---
|
||||
|
||||
## Gyors referencia — Alapszabályok
|
||||
|
||||
1. **Szöveg sosem kerülhet közvetlenül komponensbe** → `proto/src/content/pages/*.json`
|
||||
1. **Szöveg sosem kerülhet közvetlenül komponensbe** → Payload CMS Global/Collection mező (admin: `/admin`), a frontend `proto/src/lib/payload-content.ts`-en át olvassa. (`proto/src/content/pages/*.json` már csak a migrációs seed-script forrása + teszt-fixture, élő oldal nem használja — MITHOME-91/93/96.)
|
||||
2. **Feladatok**: `TODO.md` (Plane tükörképe), szinkron: `node plane-sync.js`
|
||||
3. **Tesztek**: minden feature-höz kötelező; commit előtt `npm test` zöld
|
||||
4. **Commit**: Conventional Commits (`feat:`, `fix:`, `docs:`, `chore:`)
|
||||
5. **Fájlméret**: soft limit 300 sor, hard limit 400 sor
|
||||
6. **Language**: kód+commit = English, kommunikáció+docs = Magyar
|
||||
7. **Külső link = új lap**: minden külső link új lapon nyílik; mindig a `proto/src/lib/external-link.ts` helperrel (`externalLinkProps`, `openExternalLinksInNewTab`), nincs kézi kapcsoló (MITHOME-124)
|
||||
8. **OpenSpec**: nagyobb feature/API/adatmodell/architektúra változáshoz `/opsx-propose`, majd jóváhagyott specifikációra `/opsx-apply`; a Plane MITHOME és `TODO.md` marad a feladat- és státuszkezelés
|
||||
|
||||
---
|
||||
|
||||
@@ -47,20 +50,27 @@ node plane-sync.js # Plane szinkronizáció
|
||||
websitedev/
|
||||
├── proto/ # Fő Next.js alkalmazás
|
||||
│ └── src/
|
||||
│ ├── app/ # App Router: oldalak és API route-ok
|
||||
│ ├── app/
|
||||
│ │ ├── (frontend)/ # Publikus oldalak: [locale]/[slug] catch-all
|
||||
│ │ └── (payload)/ # Payload admin (/admin) + REST/GraphQL API
|
||||
│ ├── components/ # React komponensek (PascalCase.tsx)
|
||||
│ ├── content/ # JSON tartalom-kezelő rendszer
|
||||
│ │ ├── common.json # Közös szövegek
|
||||
│ │ └── pages/ # Oldal-specifikus JSONok
|
||||
│ ├── lib/ # MongoDB, Logger, Site Config
|
||||
│ ├── globals/ # Payload Globals (Home, About, Services, Contact, Common)
|
||||
│ ├── collections/ # Payload Collections (LegalPages, Partners, Media, ContactSubmissions, Users)
|
||||
│ ├── payload.config.ts # Payload CMS konfiguráció
|
||||
│ ├── content/ # RÉGI JSON rendszer — csak migrációs seed + teszt-fixture (MITHOME-91/93/96)
|
||||
│ │ ├── common.json
|
||||
│ │ └── pages/
|
||||
│ ├── lib/ # payload-content.ts (Local API adapter), content-transfer, Logger
|
||||
│ ├── config/ # Statikus site konfiguráció
|
||||
│ └── types/ # TypeScript típusok
|
||||
├── docs/ # Projekt dokumentáció (Magyar)
|
||||
├── .agent/ # AI szabályrendszer ← OLVASD EL
|
||||
│ ├── AGENTS.md # Elsődleges szabályok
|
||||
│ ├── steering/ # Auto-betöltődő irányelvek
|
||||
│ ├── workflows/ # /new-feature, /fix-bug, /cms-feature, /review, /deploy
|
||||
│ ├── workflows/ # /new-feature, /fix-bug, /review, /deploy
|
||||
│ └── references/ # Accessibility checklist
|
||||
├── openspec/ # Specifikációk, aktív változtatások és archívum
|
||||
├── .opencode/ # OpenSpec workflow parancsok és skillek OpenCode-hoz
|
||||
├── TODO.md # Feladatlista (Plane szinkron)
|
||||
└── plane-sync.js # Plane szinkronizáló script
|
||||
```
|
||||
@@ -70,19 +80,20 @@ websitedev/
|
||||
## Környezeti változók
|
||||
|
||||
Szükséges változók (`.env` és `proto/.env.local`):
|
||||
- `MONGODB_URI` — MongoDB connection string
|
||||
- `MONGODB_DB` — Adatbázis neve (default: `mozdit`)
|
||||
- `DATABASE_URI` — PostgreSQL connection string (a staging/prod compose a `POSTGRES_PASSWORD`-ből állítja össze; MITHOME-136)
|
||||
- `POSTGRES_USER` / `POSTGRES_PASSWORD` — staging/production: a `mozdit_web` adatbázis felhasználója
|
||||
- `NEXT_PUBLIC_SITE_URL` — Publikus site URL
|
||||
- `NEXT_PUBLIC_WEBMAIL_URL` — Webmail service URL
|
||||
- `NEXT_PUBLIC_CONTACT_EMAIL` — Kapcsolati email cím
|
||||
- `PLANE_API_KEY` — Plane szinkronizációhoz (a `.mcp.json`-ban is lehet)
|
||||
- `PAYLOAD_SECRET` — Payload CMS JWT/session aláíráshoz (MITHOME-86); környezetenként egyedi, erős érték
|
||||
- `ADMIN_EMAIL` / `ADMIN_PASSWORD` — staging/production: `deploy.sh` ezekkel hoz létre egy ismert admin usert egy vadonatúj adatbázison (MITHOME-97 follow-up), csak akkor, ha a `users` collection még üres
|
||||
|
||||
---
|
||||
|
||||
## API struktúra
|
||||
|
||||
- `GET /api/health` — Rendszer állapot + MongoDB kapcsolat ellenőrzés
|
||||
- `GET /api/health` — Rendszer állapot (build- és környezetazonosító)
|
||||
- Minden endpoint egységes válasz formátumban: `{ success, data, error }`
|
||||
- Rate limiting érzékeny endpoint-okon (pl. `/api/contact`)
|
||||
|
||||
@@ -98,7 +109,6 @@ Szükséges változók (`.env` és `proto/.env.local`):
|
||||
| `.agent/steering/testing.md` | Tesztelési stratégia, coverage elvárások |
|
||||
| `.agent/workflows/new-feature.md` | Új funkció fejlesztési lépései |
|
||||
| `.agent/workflows/fix-bug.md` | Hibajavítás lépései (TDD) |
|
||||
| `.agent/workflows/cms-feature.md` | CMS fejlesztés + útmutató karbantartás |
|
||||
| `.agent/workflows/review.md` | Code review checklist |
|
||||
| `.agent/workflows/deploy.md` | Deployment folyamat |
|
||||
| `.agent/references/accessibility-checklist.md` | WCAG 2.1 AA ellenőrzőlista |
|
||||
| `.agent/references/accessibility-checklist.md` | WCAG 2.1 AA ellenőrzőlista |
|
||||
|
||||
@@ -22,43 +22,39 @@ A Docker stack a következő szolgáltatásokat indítja:
|
||||
| Szolgáltatás | Port | URL | Leírás |
|
||||
|--------------|------|-----|--------|
|
||||
| **Next.js App** | 8080 | http://localhost:8080 | Fő alkalmazás |
|
||||
| **MongoDB** | 27018 | mongodb://localhost:27018 | Adatbázis |
|
||||
| **Mongo Express** | 8081 | http://localhost:8081 | MongoDB Web UI |
|
||||
| **PostgreSQL** | 5433 | postgresql://localhost:5433/mozdit_web | Adatbázis (MITHOME-136) |
|
||||
| **Loki** | 3100 | http://localhost:3100 | Log aggregátor |
|
||||
| **Grafana** | 3001 | http://localhost:3001 | Monitoring dashboard |
|
||||
| **Grafana** | 3012 | http://localhost:3012 | Monitoring dashboard |
|
||||
|
||||
### 🔐 Alapértelmezett Bejelentkezési Adatok
|
||||
|
||||
**MongoDB:**
|
||||
- Username: `admin`
|
||||
- Password: `password123`
|
||||
**PostgreSQL (csak dev, nem titkos):**
|
||||
- Username: `mozdit_web`
|
||||
- Password: `devpassword`
|
||||
|
||||
**Grafana:**
|
||||
- Username: `admin`
|
||||
- Password: `admin123`
|
||||
|
||||
## 📊 MongoDB Hozzáférés
|
||||
**Payload CMS admin** (http://localhost:8080/admin): nincs előre létrehozott felhasználó — az első betöltéskor a Payload felkínálja az admin fiók létrehozását. A `docker-compose.dev.yml` egy fix, nem titkos `PAYLOAD_SECRET`-et ad át (MITHOME-97) — staging/production környezetben ez kötelezően a saját `.env.<env>` fájlból jön, nincs alapértelmezett érték (a konténer el sem indul nélküle).
|
||||
|
||||
### 1. Mongo Express Web UI
|
||||
- URL: http://localhost:8081
|
||||
- Böngészőben egyszerűen elérhető
|
||||
- Adatbázis: `mozdit`
|
||||
## 📊 PostgreSQL-hozzáférés
|
||||
|
||||
### 2. MongoDB Shell (ha telepítve van)
|
||||
```bash
|
||||
# Kapcsolódás a containerhez
|
||||
docker exec -it mozdit-mongodb-dev mongosh
|
||||
# psql a konténerben
|
||||
docker exec -it mozdit-postgres-dev psql -U mozdit_web -d mozdit_web
|
||||
|
||||
# Vagy közvetlenül
|
||||
mongosh "mongodb://admin:password123@localhost:27017/mozdit"
|
||||
# Payload-migrációk állapota (proto/ mappából, a dev adatbázisra)
|
||||
DATABASE_URI=postgresql://mozdit_web:devpassword@localhost:5433/mozdit_web PAYLOAD_SECRET=dev npm run migrate:status
|
||||
```
|
||||
|
||||
### 3. Alkalmazásból
|
||||
Az alkalmazás automatikusan csatlakozik:
|
||||
Az alkalmazás a Compose-hálózaton csatlakozik:
|
||||
```
|
||||
MONGODB_URI=mongodb://admin:password123@mongodb:27017/mozdit?authSource=admin
|
||||
DATABASE_URI=postgresql://mozdit_web:devpassword@postgres:5432/mozdit_web
|
||||
```
|
||||
|
||||
A séma csak migrációval változik (`npm run migrate:create <név>`); a fejlesztői „push” ki van kapcsolva. Tartalom egy friss adatbázisba: `node --import tsx scripts/transfer-content.ts import <csomag.json>`.
|
||||
|
||||
## 🛠️ Fejlesztési Parancsok
|
||||
|
||||
```bash
|
||||
@@ -81,7 +77,7 @@ npm run docker:run
|
||||
## 📁 Adatok Perzisztencia
|
||||
|
||||
A következő Docker volume-ok tárolják az adatokat:
|
||||
- `mongodb_data` - MongoDB adatok
|
||||
- `postgres_data_dev` - PostgreSQL adatok
|
||||
- `loki_data` - Log adatok
|
||||
- `grafana_data` - Grafana beállítások
|
||||
|
||||
@@ -94,12 +90,14 @@ docker-compose -f docker-compose.dev.yml down -v
|
||||
|
||||
A fejlesztői környezet támogatja a hot reload-ot:
|
||||
- Kód változások automatikusan frissülnek
|
||||
- MongoDB adatok megmaradnak restart után
|
||||
- Az adatbázis adatai megmaradnak restart után
|
||||
- Volume mounting biztosítja a gyors fejlesztést
|
||||
|
||||
## 🚨 Hibaelhárítás
|
||||
|
||||
### Port foglaltság
|
||||
Minden port használata előtt: `scripts/check-ports.sh --host sadmin@10.8.0.1 --project websitedev --compose docker-compose.dev.yml` (MITHOME-137).
|
||||
|
||||
Ha a 3000-es port foglalt:
|
||||
```bash
|
||||
# Meglévő process keresése
|
||||
@@ -109,13 +107,13 @@ lsof -i :3000
|
||||
docker-compose -f docker-compose.dev.yml up --build -p 3002:3000
|
||||
```
|
||||
|
||||
### MongoDB kapcsolat hiba
|
||||
### Adatbázis-kapcsolat hiba
|
||||
```bash
|
||||
# Container logok ellenőrzése
|
||||
docker logs mozdit-mongodb-dev
|
||||
docker logs mozdit-postgres-dev
|
||||
|
||||
# Újraindítás
|
||||
docker-compose -f docker-compose.dev.yml restart mongodb
|
||||
docker-compose -f docker-compose.dev.yml restart postgres
|
||||
```
|
||||
|
||||
### Teljes tisztítás
|
||||
@@ -134,7 +132,8 @@ docker build -t mozdit-app:latest ./proto
|
||||
# Production futtatás
|
||||
docker run -p 3000:3000 \
|
||||
-e NODE_ENV=production \
|
||||
-e MONGODB_URI=mongodb://your-prod-db:27017/mozdit \
|
||||
-e DATABASE_URI=postgresql://user:password@your-db:5432/mozdit_web \
|
||||
-e PAYLOAD_SECRET=... \
|
||||
mozdit-app:latest
|
||||
```
|
||||
|
||||
|
||||
@@ -74,7 +74,6 @@ MONGODB_URI=mongodb://admin:XXX@mongodb:27017/mozdit?authSource=admin
|
||||
MONGODB_DB=mozdit
|
||||
NEXT_PUBLIC_SITE_URL=https://mozdit.hu
|
||||
NEXT_PUBLIC_CONTACT_EMAIL=info@mozdit.hu
|
||||
LOKI_HOST=http://loki:3100
|
||||
APP_PORT=8080
|
||||
|
||||
# .env.staging — staging változók (hasonlóan)
|
||||
@@ -91,7 +90,7 @@ A `docker-compose.prod.yml` csak az app + MongoDB-t futtatja. A TLS/SSL és rate
|
||||
|
||||
- **Logok**: `docker compose -f docker-compose.prod.yml logs -f app`
|
||||
- **Health**: `GET /api/health` → `{ success: true, data: {...} }`
|
||||
- **Winston + Loki**: alkalmazás logok (ha Loki elérhető a stackben)
|
||||
- **Alkalmazáslogok**: Winston strukturált stdout/stderr kimenete; központi Loki-továbbítás hostoldali collector feladata, külön Hosting-infrastruktúra
|
||||
|
||||
---
|
||||
|
||||
|
||||
+2
-2
@@ -52,13 +52,13 @@ node plane-sync.js --help # súgó
|
||||
|
||||
## ⚙️ **Konfiguráció**
|
||||
|
||||
**Precedencia**: `.env` > `.mcp.json` (`mcpServers.plane.env`)
|
||||
**Precedencia**: a `PLANE_WORKSPACE_SLUG` esetén a projekt `.mcp.json` értéke elsőbbséget élvez a külső környezetből örökölt változóval szemben, majd a projektalapértelmezés következik (`developments`). A többi változónál `.env` > `.mcp.json` (`mcpServers.plane.env`).
|
||||
|
||||
| Változó | Forrás | Leírás |
|
||||
| --- | --- | --- |
|
||||
| `PLANE_API_KEY` | `.mcp.json` / `.env` | Plane API kulcs |
|
||||
| `PLANE_API_HOST_URL` | `.mcp.json` / `.env` | Plane URL (alap: `https://pm.llmdev.mozdit.hu/`) |
|
||||
| `PLANE_WORKSPACE_SLUG` | `.mcp.json` / `.env` | Workspace slug (alap: `developments`) |
|
||||
| `PLANE_WORKSPACE_SLUG` | `.mcp.json` > `.env`/környezet | Workspace slug (projektalapértelmezés: `developments`) |
|
||||
| `PLANE_PROJECT_ID` | `.env` | Projekt ID (alap: MITHOME `643f7055-1237-4912-912f-99ec49fd0f0e`) |
|
||||
|
||||
A kulcs elsődlegesen a `.mcp.json`-ban van (gitignore-olt) — a script ezt használja, így nincs duplikáció.
|
||||
|
||||
@@ -5,12 +5,12 @@ Modern Next.js weboldal a mozdIT Bt. számára — webtárhely, email- és DNS-s
|
||||
## Stack
|
||||
|
||||
- **Frontend**: Next.js 15 (Turbopack), React 19, TypeScript, Tailwind CSS 4
|
||||
- **Tartalom**: JSON-alapú, séma-validált content rendszer (`proto/src/content/`)
|
||||
- **CMS**: saját, dependency-mentes `content-editor.js` (böngészős szerkesztő)
|
||||
- **CMS**: Payload CMS (self-hosted, `/admin`), MongoDB adapter, draft/publish + verziózás, hu/en lokalizáció
|
||||
- **Tartalom**: Payload Globals/Collections (a korábbi JSON-alapú content rendszer, `proto/src/content/`, csak a migrációs script forrásaként és teszt-fixture-ként él tovább — MITHOME-91/93)
|
||||
- **Backend**: Next.js API routes, MongoDB
|
||||
- **Tesztelés**: Jest, React Testing Library, Playwright (smoke), valódi szervert indító CMS-tesztek
|
||||
- **Tesztelés**: Jest, React Testing Library, Playwright (smoke)
|
||||
- **Deploy**: natív Docker Compose (`deploy.sh`) + Gitea Actions nélkül, lokálisan vezérelt
|
||||
- **Monitoring**: Winston + Loki, plusz `scripts/security-scan.sh` (ntfy riasztással)
|
||||
- **Naplózás/monitoring**: Winston strukturált szerveroldali logok stdout/stderr-re; központi Loki/Grafana gyűjtés külön Hosting-infrastruktúra, plusz `scripts/security-scan.sh` (ntfy riasztással)
|
||||
|
||||
## Gyors indítás
|
||||
|
||||
@@ -32,6 +32,18 @@ scripts/pre-deploy-tests.sh
|
||||
- **Szinkron**: `node plane-sync.js` (Plane → TODO.md)
|
||||
- **Ticket-azonosítók**: `MITHOME-XX`
|
||||
|
||||
## Specifikációvezérelt fejlesztés (OpenSpec)
|
||||
|
||||
Az OpenSpec a nagyobb funkciók, API-/adatmodell-változások és architekturális döntések
|
||||
követelményeit és megvalósítási tervét kezeli. Az elszigetelt, kis hibajavítások
|
||||
továbbra is a meglévő bugfix workflow-t követhetik.
|
||||
|
||||
- OpenSpec projektkonfiguráció és specifikációk: `openspec/`
|
||||
- OpenCode parancsok: `/opsx-explore`, `/opsx-propose`, `/opsx-apply`, `/opsx-update`, `/opsx-sync`, `/opsx-archive`
|
||||
- Új változtatás tervezése: `/opsx-propose "rövid leírás"`
|
||||
- Plane MITHOME marad a feladatok és státuszok elsődleges forrása; a `TODO.md` annak lokális tükre.
|
||||
- Projekt- és tartalomkezelési szabályok: `.agent/AGENTS.md`, `.agent/steering/`, `openspec/config.yaml`
|
||||
|
||||
## Deploy
|
||||
|
||||
```bash
|
||||
@@ -39,32 +51,33 @@ scripts/pre-deploy-tests.sh
|
||||
./deploy.sh production # éles (szerveren, staging ellenőrzése után)
|
||||
```
|
||||
|
||||
A CMS „Publikálás" gombja szintén commitol + pushol + deployol (csak a beállított környezetre). Részletek: `.agent/workflows/deploy.md`, `docs/helyi-staging-deploy.md`.
|
||||
A Payload admin (`/admin`) draft/publish + verziózás munkafolyamata (MITHOME-92) nem jár git commit-tal vagy automatikus deployjal — a tartalom közvetlenül a MongoDB-be íródik. Kódváltozás (Globals/Collections séma, frontend) továbbra is a fenti git-alapú deploy folyamaton megy át. Részletek: `.agent/workflows/deploy.md`.
|
||||
|
||||
## Tartalomkezelés
|
||||
|
||||
A weboldal szövegei és a CMS a `proto/src/content/` JSON-fájljaiból jönnek:
|
||||
A weboldal szövegei Payload CMS Globals/Collections mezőkben élnek, az ügyfél a `/admin` felületen szerkeszti őket:
|
||||
|
||||
```
|
||||
proto/src/content/
|
||||
├── schema.js # közös séma-validátor (Next + CMS)
|
||||
├── types.ts # TypeScript típusok
|
||||
├── index.ts # tartalom-betöltő
|
||||
├── common.json # közös szövegek (gombok, lábléc, a11y)
|
||||
└── pages/ # oldalankénti tartalom (home, about, services, …)
|
||||
proto/src/globals/ # Home, About, Services, Contact, Common
|
||||
proto/src/collections/ # LegalPages, Partners, Media, ContactSubmissions, Users
|
||||
proto/src/payload.config.ts
|
||||
```
|
||||
|
||||
Használat:
|
||||
Használat Server Component-ből (a Payload Local API-n keresztül):
|
||||
|
||||
```typescript
|
||||
import { content, getPageContent } from '@/content'
|
||||
const about = content.pages.about
|
||||
import { getAboutContent } from '@/lib/payload-content'
|
||||
const about = await getAboutContent(locale) // locale: 'hu' | 'en'
|
||||
```
|
||||
|
||||
A régi, JSON-alapú content rendszer (`proto/src/content/`) már csak a
|
||||
`migrate-content-to-payload.ts` seed-script forrásaként és néhány
|
||||
komponens-teszt fixture-jeként él tovább — élő oldal nem olvassa (MITHOME-91/93).
|
||||
|
||||
## Dokumentáció
|
||||
|
||||
- **Agent-szabályok**: `.agent/AGENTS.md`, `.agent/steering/`, `.agent/workflows/`
|
||||
- **CMS felhasználói útmutató**: `docs/felhasznaloi-utmutato.md` (a CMS-ben a ❓ Súgó is ezt rendereli)
|
||||
- **nginx vhost-ok**: `docs/nginx-vhosts.md`
|
||||
- **Plane szinkron**: `PLANE-SYNC-GUIDE.md`
|
||||
- **Staging deploy**: `docs/helyi-staging-deploy.md`
|
||||
- **Gitea runner**: `docs/gitea-runner-telepites.md`
|
||||
|
||||
+16
-13
@@ -501,24 +501,27 @@
|
||||
|
||||
---
|
||||
|
||||
### **REQ-702: Logging Rendszer**
|
||||
**Kategória**: Application logging
|
||||
**Prioritás**: Magas
|
||||
**Státusz**: ✅ Implementálva
|
||||
### **REQ-702: Alkalmazásnaplózás**
|
||||
**Kategória**: Application logging
|
||||
**Prioritás**: Magas
|
||||
**Státusz**: ✅ Implementálva
|
||||
|
||||
**Leírás**: Winston logger Loki integrációval.
|
||||
**Leírás**: Strukturált szerveroldali alkalmazáslogok Winston segítségével a stdout/stderr kimenetre. A távoli gyűjtés és Loki/Grafana továbbítás külön Hosting-infrastruktúra.
|
||||
|
||||
**Részletek**:
|
||||
- Winston logger konfiguráció
|
||||
- Loki integráció
|
||||
- Log levels (error, warn, info, debug)
|
||||
- Structured logging
|
||||
- Winston komponens-loggerek a szerveroldali hibákhoz
|
||||
- Production JSON-kimenet timestamp, severity, service, environment és component mezőkkel
|
||||
- Development környezetben olvasható konzolkimenet
|
||||
- Érzékeny űrlapmezők, titkok és tokenek kizárása vagy maszkolása
|
||||
- stdout/stderr kimenet; az alkalmazás nem függ távoli logszolgáltatás elérhetőségétől
|
||||
- Hosting-szintű központi továbbítás nem része ennek a követelménynek
|
||||
|
||||
**Acceptance Criteria**:
|
||||
- [x] Winston logger működik
|
||||
- [x] Loki integráció aktív
|
||||
- [x] Log levels konfigurálva
|
||||
- [x] Structured logging működik
|
||||
- [x] Winston logger strukturált konzolkimenetet biztosít
|
||||
- [x] API- és MongoDB-kapcsolati hibák komponens-loggert használnak
|
||||
- [x] Kapcsolatfelvételi adatok és titkok nem kerülnek az alkalmazáslogokba
|
||||
- [x] Az alkalmazáslogok stdout/stderr-en elérhetők, Loki közvetlen elérhetősége nélkül
|
||||
- [x] Stagingen a konténerlogban ellenőrizve a JSON-kimenet és a változatlan API-válasz
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -64,6 +64,9 @@ Next.js 15 alapú weboldal a mozdIT Bt. számára, Docker Compose-szal deployolv
|
||||
| MITHOME-83 | Partnerek szekció a honlapon (logó + URL, CMS feltöltéssel) | ✅ |
|
||||
| MITHOME-84 | Logószerkesztő: háttér áttetszővé tétele (fehér eltávolítás) | ✅ |
|
||||
| MITHOME-98 | Bug: dev docker-compose MongoDB URI nem hitelesített (auth hiányzott) | ✅ |
|
||||
| MITHOME-17 | Winston structured app logging to stdout/stderr | ✅ |
|
||||
| MITHOME-33 | Bug: staging és production Loki host-ra hivatkozik Loki service nélkül | ✅ |
|
||||
| MITHOME-126 | Bug: logger graceful shutdown `write after end` a `npm run build` alatt | ✅ |
|
||||
|
||||
---
|
||||
|
||||
@@ -74,7 +77,6 @@ Next.js 15 alapú weboldal a mozdIT Bt. számára, Docker Compose-szal deployolv
|
||||
| MITHOME-13 | CI pipeline — lint + unit tesztek + staging deploy trigger | ⏳ | Elsődleges prioritás |
|
||||
| MITHOME-14 | Playwright E2E smoke tesztek + Lighthouse CI | ⏳ | Elsődleges prioritás |
|
||||
| MITHOME-32 | Bug: staging és production MongoDB URI alapértelmezése nem hitelesített | ⏳ | |
|
||||
| MITHOME-33 | Bug: staging és production Loki host-ra hivatkozik Loki service nélkül | ⏳ | |
|
||||
| MITHOME-34 | Bug: site config minden környezetben development rekordot olvas és ír | ⏳ | |
|
||||
| MITHOME-35 | Bug: aktív Gitea CI nem futtat integration/E2E tesztet és nem indít staging deployt | ⏳ | |
|
||||
| MITHOME-36 | Bug: elavult GitHub/Linear workflow továbbra is aktív szinkronizációt végez | ⏳ | |
|
||||
@@ -90,7 +92,6 @@ Next.js 15 alapú weboldal a mozdIT Bt. számára, Docker Compose-szal deployolv
|
||||
|
||||
| Plane | Feladat | Státusz | Megjegyzés |
|
||||
|-------|---------|---------|-----------|
|
||||
| MITHOME-17 | Winston logger + Loki integráció | 🔄 | Winston + LokiTransport már implementálva `src/lib/logger.ts`-ben |
|
||||
| MITHOME-31 | Bug: kapcsolatfelvételi API sikeres választ ad elveszett üzenetre | 🔄 | |
|
||||
|
||||
---
|
||||
@@ -106,16 +107,46 @@ Cél: az ügyfél önállóan, admin felületen szerkeszthesse a tartalmat — a
|
||||
| MITHOME-85 | **EPIC**: Áttérés Payload CMS-re (admin felület az ügyfélnek) | 📋 |
|
||||
| MITHOME-86 | Payload CMS alapinstallálás: config, MongoDB adapter, admin route | ✅ |
|
||||
| MITHOME-87 | Home/About/Services/Contact/Common Globals kialakítása és JSON tartalom migrálása | ✅ |
|
||||
| MITHOME-88 | LegalPages collection (adatvedelem, hasznalati-feltetelek) migrálása | 📋 |
|
||||
| MITHOME-89 | Partners + Media collection: logófeltöltés és transparent-logo funkció migrálása | 📋 |
|
||||
| MITHOME-90 | Users collection: ügyfél admin bejelentkezés és access control | 📋 |
|
||||
| MITHOME-91 | Frontend átállítása Payload Local API-ra, JSON content rendszer kivezetése | 📋 |
|
||||
| MITHOME-92 | Draft/preview és verziózás bekapcsolása (Verziók panel utódja) | 📋 |
|
||||
| MITHOME-93 | Régi egyedi CMS (content-editor.js) leépítése | 📋 |
|
||||
| MITHOME-94 | Opcionális: ContactSubmissions collection a Mongoose modell helyett | 📋 |
|
||||
| MITHOME-95 | .agent/ és CLAUDE.md dokumentáció frissítése Payload architektúrára | 📋 |
|
||||
| MITHOME-96 | Tesztek migrálása: content schema tesztek helyett Payload collection/global tesztek | 📋 |
|
||||
| MITHOME-97 | Deploy/Docker frissítés: PAYLOAD_SECRET, admin bundle, Dockerfile/deploy.sh | 📋 |
|
||||
| MITHOME-88 | LegalPages collection (adatvedelem, hasznalati-feltetelek) migrálása | ✅ |
|
||||
| MITHOME-89 | Partners + Media collection: logófeltöltés (MVP) | ✅ |
|
||||
| MITHOME-118 | Logószerkesztő Payload admin komponensként — **lezárva, nem valósítjuk meg** (3rd party előfeldolgozás marad) | ❌ |
|
||||
| MITHOME-90 | Users collection: ügyfél admin bejelentkezés és access control | ✅ |
|
||||
| MITHOME-119 | MFA előkészítés a Users collection-höz (kutatás/terv, nem implementáció) | 📋 |
|
||||
| MITHOME-91 | Frontend átállítása Payload Local API-ra, JSON content rendszer kivezetése | ✅ |
|
||||
| MITHOME-92 | Draft/preview és verziózás bekapcsolása (Verziók panel utódja) | ✅ |
|
||||
| MITHOME-93 | Régi egyedi CMS (content-editor.js) leépítése | ✅ |
|
||||
| MITHOME-94 | Opcionális: ContactSubmissions collection a Mongoose modell helyett | ✅ |
|
||||
| MITHOME-95 | .agent/ és CLAUDE.md dokumentáció frissítése Payload architektúrára | ✅ |
|
||||
| MITHOME-96 | Tesztek migrálása: content schema tesztek helyett Payload collection/global tesztek | ✅ |
|
||||
| MITHOME-97 | Deploy/Docker frissítés: PAYLOAD_SECRET, admin bundle, Dockerfile/deploy.sh | ✅ |
|
||||
| MITHOME-117 | Vizuális design-védelem: színek/design tokenek változatlansága (MITHOME-91/93 elfogadási kritériuma) | 📋 |
|
||||
| MITHOME-102 | ContactSubmissions afterChange hook: PLATFM-2-kompatibilis esemény-emisszió (függ: MITHOME-94) | 📋 |
|
||||
| MITHOME-103 | Esemény-emisszió biztonsága: hitelesítés, rate limit, payload-validáció, elérhetetlenség-riasztás | 📋 |
|
||||
| MITHOME-105 | MITHOME-31 lezárása: elveszett üzenet bug összekötése a PLATFM-10 triázs pilottal | 📋 |
|
||||
| MITHOME-120 | Admin gyorskeresés (teljes szöveges kereső a Payload admin tetején) | ✅ |
|
||||
| MITHOME-121 | Partner logók soha nem töltődtek be a publikus oldalon (Media read access) + logo mező opcionálissá tétele | ✅ |
|
||||
| MITHOME-122 | Payload admin UI fordítása (menü/csoport/mező címkék nyelvfüggőek legyenek) | 📋 |
|
||||
|
||||
### EPIC: Többnyelvűség bevezetése — hu alapértelmezett + en (MITHOME-109) — **LEZÁRVA 2026-09-29**
|
||||
|
||||
Cél: a weboldal magyar (alapértelmezett, prefix nélkül, pl. `/rolunk`) és angol (`/en/` alatt, pl. `/en/about`) nyelven is elérhető legyen, Payload beépített mező-szintű lokalizációjára építve. Az angol tartalom első körben AI-draft fordítás, admin felületen jelezve, emberi jóváhagyásig. Retroaktívan érinti a már kész MITHOME-87/88-at (localized mezők utólagos bejelölése).
|
||||
|
||||
| Plane | Feladat | Státusz |
|
||||
|-------|---------|---------|
|
||||
| MITHOME-109 | **EPIC**: Többnyelvűség bevezetése (hu alapértelmezett + en) | ✅ |
|
||||
| MITHOME-110 | Payload localization config bekapcsolása | ✅ |
|
||||
| MITHOME-111 | Globals retrofit: localized mezők (Home/About/Services/Contact/Common) | ✅ |
|
||||
| MITHOME-123 | Bug: főoldali CTA link 404 — belső linkek oldalválasztóval, locale-helyes útvonallal | ✅ |
|
||||
| MITHOME-124 | Általános szabály: minden külső link új lapon nyíljon meg | ✅ |
|
||||
| MITHOME-112 | LegalPages collection retrofit: localized mezők | ✅ |
|
||||
| MITHOME-113 | AI-draft angol tartalom + migrációs script bővítése (en locale seed) | ✅ |
|
||||
| MITHOME-114 | Next.js /hu/ + /en/ szimmetrikus prefix routing (egy menetben MITHOME-91-gyel) | ✅ |
|
||||
| MITHOME-115 | Nyelvválasztó UI komponens (Header) | ✅ |
|
||||
| MITHOME-116 | SEO: hreflang tagek és kétnyelvű sitemap | ✅ |
|
||||
|
||||
### EPIC: Hermes Agent — kapcsolatfelvételi triázs pilot (MITHOME-99) — **LEZÁRVA, duplikátum**
|
||||
|
||||
2026-09-10: kiderült, hogy ugyanez a pilot már meg volt tervezve (jobban kidolgozva) a **PLATFM-10** ("Kis kapacitásigényű, felügyelt AI-funkciók pilot") alatt a `PLATFM` projektben. A motor-választás (Hermes vs. alternatívák) külön ADR-ben dől el: **PLATFM-12**. A MITHOME-99 EPIC és a hozzá tartozó MITHOME-100/101/104/106/107/108 issue-k Cancelled státuszban maradnak, Plane-kommenttel a PLATFM-re mutatva. Ami valódi MITHOME-felelősség (a weboldal saját eseményforrása), az a Payload-epic alá került fentebb (MITHOME-102/103/105).
|
||||
|
||||
| Plane | Feladat | Státusz |
|
||||
|-------|---------|---------|
|
||||
@@ -126,7 +157,18 @@ Cél: az ügyfél önállóan, admin felületen szerkeszthesse a tartalmat — a
|
||||
| MITHOME-20 | Lighthouse score ≥ 90 minden kategóriában | 📋 |
|
||||
| MITHOME-21 | Logging middleware megvalósítása | 📋 |
|
||||
| MITHOME-22 | Grafana dashboard konfiguráció | 📋 |
|
||||
| MITHOME-23 | SEO optimalizálás | 📋 |
|
||||
| MITHOME-23 | SEO: keresési szándékok, oldaltérkép és tartalom | 📋 |
|
||||
| MITHOME-127 | SEO élesítési ellenőrzés: production indexelhetőség (noindex, robots, sitemap, canonical, átirányítások) | 🔄 előkészítve, élesítéskor zárható |
|
||||
| MITHOME-128 | Google Search Console: tulajdonjog igazolása, sitemap beküldése, indexelés figyelése | 📋 |
|
||||
| MITHOME-129 | Szolgáltatási állítások összehangolása a valós termékkörrel (ÁSZF 99,9% garancia, SSD, 100 GB, korlátlan forgalom, Python/Node/PostgreSQL, DNSSEC, API, mentés) | 🔄 C1–C14 kész, jogi szövegek (C15–C16) hátravannak |
|
||||
| MITHOME-130 | „Csomagok” aloldal: mIT Start és mIT Mid (PLATFM-3 katalógus-szerkezettel) | ✅ |
|
||||
| MITHOME-131 | Partnerszekció: helyes kapcsolati kategória (partner vs. ügyfélreferencia), CMS-be emelt cím, engedélykezelés | ✅ |
|
||||
| MITHOME-132 | Menedzselt webüzemeltetési szolgáltatások oldala (a pilot és a hitelességi csomag után) | 📋 |
|
||||
| MITHOME-133 | Atlantisz referencia: világos háttérhez való logó és a hivatalos név rendezése | 📋 |
|
||||
| MITHOME-134 | Sötét téma az aloldalakon (Szolgáltatások, Kapcsolat, Tárhelycsomagok) | ✅ |
|
||||
| MITHOME-135 | Mentési megőrzés 14 napra a weboldalon (a salutem kapacitásának ellenőrzése után) | 📋 |
|
||||
| MITHOME-136 | A weboldal adatbázisának átállítása MongoDB-ről PostgreSQL-re (élesítés előtt) | 🔄 OpenSpec-javaslat jóváhagyásra vár |
|
||||
| MITHOME-137 | Port-ellenőrzés minden portdefiníció előtt (deploy és eldobható konténerek) | ✅ |
|
||||
| MITHOME-24 | Performance optimalizálás | 📋 |
|
||||
| MITHOME-25 | Reszponzív design finomítása | 📋 |
|
||||
| MITHOME-26 | Analytics integráció (Plausible / GA4) | 📋 |
|
||||
@@ -138,6 +180,7 @@ Cél: az ügyfél önállóan, admin felületen szerkeszthesse a tartalmat — a
|
||||
| MITHOME-57 | Felhasználói útmutató (CMS + Honlap) Súgó menüponttal | 📋 |
|
||||
| MITHOME-65 | CMS: logó cseréje feltöltéssel (🎨 Logó oldal) | 📋 |
|
||||
| MITHOME-66 | Copyright sor CMS-szerkeszthetővé tétele (2002–aktuális tartomány) | 📋 |
|
||||
| MITHOME-125 | Opcionális funkció: Chat a weboldalon (amiből Email is lehet) — tartalmi/technikai kérdések később | 📋 |
|
||||
|
||||
---
|
||||
|
||||
@@ -145,7 +188,7 @@ Cél: az ügyfél önállóan, admin felületen szerkeszthesse a tartalmat — a
|
||||
- **Frontend**: Next.js 15, TypeScript, Tailwind CSS 4
|
||||
- **Backend**: Next.js API Routes
|
||||
- **Database**: MongoDB (Mongoose ODM)
|
||||
- **Logging**: Winston + Loki
|
||||
- **Logging**: Winston structured stdout/stderr; központi Loki/Grafana gyűjtés külön Hosting-infrastruktúra
|
||||
- **Monitoring**: Grafana
|
||||
- **Deployment**: Docker Compose (deploy.sh)
|
||||
- **Testing**: Jest, React Testing Library
|
||||
@@ -180,6 +223,65 @@ docker-compose -f docker-compose.dev.yml down
|
||||
---
|
||||
|
||||
## Frissítési Napló
|
||||
- **2026-09-29**: Staging deploy (`3a8b2eb`). Mentés: `~/backups/mozdit-staging-20260929-182546-pre-mithome-133.archive`. 459 unit teszt, az indexelhetőségi őr és 10/10 smoke zöld. A `20260929_atlantisz_pending` lefutott: az Atlantisz „Egyeztetés alatt” állapotban van (MITHOME-133), a főoldalon csak az Angele látszik.
|
||||
- **2026-09-29**: Atlantisz logó: a honlapjukról letöltött `atlantisz_logo.png` felirata fehér (sötét fejléchez készült), a mi világos oldalunkon olvashatatlan, és a logón álló név („Pihenőpark & Halásztanya”) eltér az admin-bejegyzéstől. Felhasználói döntés: később rendezzük, addig **pending** (egyeztetés alatt). A partner_references migráció a még le nem futott környezetekben pendinggel sorol be; a stagingre a `20260929_atlantisz_pending` követő migráció állítja át (a következő deploykor). Új ticket: MITHOME-133.
|
||||
- **2026-09-29**: MITHOME-137 folytatás: a `docker-compose.dev.yml` szabad, bejegyzett portokra került (mongo-express 8081 → 8082, grafana 3001 → 3012; az app 8080, a MongoDB 27018 és a Loki 3100 marad). Mind az öt port foglalásként bekerült a llmdev portregiszterébe; az ellenőrzés után a dev compose ütközésmentes.
|
||||
- **2026-09-29**: MITHOME-137 kész (main, staging deploy még nem történt). Új szabály: minden portdefiníció előtt port-ellenőrzés kell. `scripts/check-ports.sh` (portlista vagy compose-fájl, `--host` távoli llmdev-ellenőrzéssel); a `deploy.sh` a build előtt futtatja, a tesztjei a pre-deploy készlet részei. Élesben a staging compose átment; a `docker-compose.dev.yml` az llmdev-en ütközik (3001: step, 8081: mozdit staging).
|
||||
- **2026-09-29**: Tulajdonosi döntés: a katalógus PostgreSQL-ben lesz (mitplatform PLATFM-15, ADR-0001), egy PostgreSQL-szerver külön adatbázisokkal; a weboldal az élesítés előtt MongoDB-ről PostgreSQL-re áll át (MITHOME-136, OpenSpec `postgres-migration-mithome-136`, jóváhagyásra vár). A Compose-t a Docker-háttér specifikáció szerint kell kialakítani (healthcheck, logkorlát, memórialimit, host-port nélkül).
|
||||
- **2026-09-29**: Tulajdonosi döntések (PLATFM-14, `2c2c5a8`). Tárhely: beállítási díj nincs, költöztetés óradíjas, domain külön, nincs akció; megőrzés 14 nap (menedzselt: 30), a salutem kapacitás-ellenőrzése után – addig a weboldal a valós 7 napot mondja (MITHOME-135). Menedzselt csomagok (pilotár): Webőr 6 900 Ft automatikus frissítéssel, WordPress Gondozás 14 900 Ft / 45 perc, Üzleti Webfelügyelet 29 900 Ft / 90 perc, Webshop Felügyelet 39 900 Ft tárhellyel; a tesztelt visszaállítás az első dokumentált kézi próba után hirdethető.
|
||||
- **2026-09-29**: A versenytárs-elemzés (menedzselt webes üzemeltetés) feldolgozva a mitplatformban (PLATFM-14, 7. fejezet; `ff237f7`). A weboldalt érintő pozíció: „menedzselt webes üzemeltetés” az olcsó webes gondozás és a teljes IT-outsourcing között (MITHOME-132, komment). A „tesztelt visszaállítás” és a reakcióidők csak teljesülésük után kerülhetnek az oldalra.
|
||||
- **2026-09-29**: MITHOME-134 kiadva stagingre (`6b39075`). Mentés: `~/backups/mozdit-staging-20260929-205224-pre-mithome-134.archive`. 516 unit teszt, az indexelhetőségi őr és 11/11 smoke zöld.
|
||||
- **2026-09-29**: MITHOME-134 kész (main, staging deploy még nem történt). A Tailwind `dark:` variáns a weboldal témáját követi: a kézi választást (`data-theme`), mentett választás nélkül a rendszerbeállítást. Korábban csak a rendszerbeállítást figyelte. A Szolgáltatások, a Kapcsolat (az űrlappal) és a Tárhelycsomagok oldal sötét párokat kapott; a Rólunk és a jogi oldalak már tokeneket használnak. Ellenőrizve böngészőben sötét és világos témában, rendszerbeállítással, asztali és mobil nézetben.
|
||||
- **2026-09-29**: MITHOME-130 kiadva stagingre (`550e457`). Mentés: `~/backups/mozdit-staging-20260929-193844-pre-mithome-130.archive`. 516 unit teszt, az indexelhetőségi őr és 11/11 smoke (új: SMOKE-10) zöld. Új `/hu/tarhely-csomagok` – `/en/hosting-plans` oldal a `Products` collectionből és a `HostingPlans` globalból. A mIT Start ára 14 900 Ft/év + ÁFA, 5 postafiókkal; a mIT Midé 23 900 Ft/év + ÁFA. Az oldal a nettó árat „+ ÁFA” jelöléssel és a bruttót is mutatja. A tulajdonos döntése (PLATFM-14 B változat): csak éves számlázás. A két csomag tervezet: a staging mutatja, az éles oldalon 404, és nincs a menüben és a sitemapben sem. Élesítés az adminban az „Aktív” állapottal, üzleti jóváhagyás és védjegyvizsgálat után. Adatforrás: a mitplatform PLATFM-14 katalógus (catalog-as-code).
|
||||
- **2026-09-29**: MITHOME-131 kiadva stagingre (`784ed57`). Mentés: `~/backups/mozdit-staging-20260929-173329-pre-mithome-131.archive`. 458 unit teszt, az indexelhetőségi őr és 10/10 smoke zöld. A migráció az Angele Pihenőházat és az Atlantisz Horgászüdülő és Halásztanyát ügyfélreferenciaként sorolta be, írásos engedéllyel (tulajdonosi megerősítés). A főoldalon „Akik már minket választottak” alatt az Angele látszik; az Atlantisz a logó feltöltése után jelenik meg.
|
||||
- **2026-09-29**: MITHOME-131 kész (main, `5f9a53e`, staging deploy még nem történt). A Partners kötelező kapcsolati kategóriát és közzétételi engedélyt kapott; nyilvánosan csak írásos engedéllyel, kategóriával és logóval rendelkező bejegyzés jelenik meg. A főoldalon külön blokk van az ügyfeleknek („Akik már minket választottak”) és a partnereknek (kapcsolattípussal); a szöveg a beégetett konstansból a Home globalba került. Migráció: az Angele Pihenőház ügyfélreferencia, írásos engedéllyel (tulajdonosi megerősítés). A stagingen lévő „Atlantisz Horgászüdülő és Halásztanya” besorolatlan, ezért rejtve marad (logó nélkül eddig sem látszott).
|
||||
- **2026-09-29**: A menedzselt webüzemeltetési kutatás (`mitplatform/docs/research/…`) feldolgozása. A kutatás a tárhely fölé épülő termékcsaládot javasol (Webőr / WordPress Gondozás / Üzleti Webfelügyelet, 90 napos pilot, kötelező audit). Összevetés a mai döntésekkel: **PLATFM-13** (7 vs. 14–30 napos mentési megőrzés, visszaállítási próba, két külön reakcióidő-vállalás, névcsalád). A PLATFM-9 hivatkozást kapott. Weboldal: új MITHOME-131 (a „Partnereink” szekció helyes kategóriája és engedélykezelése, a beégetett cím CMS-be emelése) és MITHOME-132 (menedzselt szolgáltatások oldala, csak a pilot után). Az elemzés 10. fejezete összefoglalja.
|
||||
- **2026-09-29**: MITHOME-129 C1–C14 kiadva stagingre (`e27134e`). Mentés: `~/backups/mozdit-staging-20260929-161031-pre-mithome-129.archive`. 436 unit teszt, az indexelhetőségi őr és 10/10 smoke zöld. A migráció a próbával azonos számokkal futott le. A négy érintett oldalon egyik régi túlzó állítás sem szerepel. Nyitva: C15–C16 jogi átnézéssel.
|
||||
- **2026-09-29**: MITHOME-129 C1–C14 kész (main, `d0dafa8`, staging deploy még nem történt). Döntések: az iron colocationben van a FORPSI-nál (a C16-ban csak a MikroVPS adatfeldolgozó), a mIT Mid levéltárhelye 4 GB, az átvitel migrációval. A `20260929_service_claims` migráció csak pontos magyar egyezésnél cserél, az angolt csak AI-draft esetén írja át, és ha egy jóváhagyott oldal angolja változik, AI-draftba teszi vissza. Új elem: 90%-os postafiók-figyelmeztetés. A csomagnevek a védjegyvizsgálatig kimaradnak a szövegből. Staging-másolaton ellenőrizve. Hátravan: C15 (ÁSZF) és C16 (Adatvédelem) jogi átnézéssel, a MikroVPS cégadataival és DPA-val.
|
||||
- **2026-09-29**: Termékdöntés (tulajdonos): a weboldalon egyelőre csak a **mIT Start** és a **mIT Mid** csomagot kínáljuk, a mIT Pro és a mIT Pro Plus most nem termék. A nevek a PLATFM-3 (központi termékkatalógus) szerintiek; bevezetés előtt védjegyjogászi vizsgálat kell, ® csak lajstromozás után. Frissítve: az elemzés, a MITHOME-129 (komment) és a MITHOME-130 (név, tartalom, adatforrás-javaslat a PLATFM-3 `Product` szerkezetével). A döntés a PLATFM-3-on is rögzítve, mert ott még négycsomagos első termékcsalád és négycsomagos elfogadási feltétel szerepel. Kapcsolódó: a PLATFM-8 szerint csak mért, fenntartható kapacitás értékesíthető (60–70% kihasználtság), ez ellentmond az elemzés 1,8–2-szeres túlallokálásának.
|
||||
- **2026-09-29**: Az éles környezet (iron.mozdit.hu) elemzésének feldolgozása: `docs/termekkor-es-szerverkapacitas-elemzes.md`. A weboldal jelenleg többet ígér, mint a valós termékkör: garantált 99,9% az ÁSZF-ben, SSD 1–100 GB, korlátlan forgalom, 1–20 GB e-mail fiókonként, Python/Node/PostgreSQL, DNSSEC/API, napi mentés tisztázatlan hellyel. Az elemzésben is van javítandó: a memória legrosszabb esete, a Postfix helyett Dovecot quota-warning, a mentések helye a túlallokálásnál, és az egyetlen szerver miatti rendelkezésre állás. Új: MITHOME-129 (állítások összehangolása, a jogi szöveggel kezdve) és MITHOME-130 („Csomagok” oldal). A tulajdonosnak 8 nyitott kérdés (K1–K8) van.
|
||||
- **2026-09-29**: MITHOME-127 őr kiadva stagingre (`ae81f34`). Mentés: `~/backups/mozdit-staging-20260929-132633-pre-mithome-127.archive`. A `deploy.sh` új lépése a szerveren lefutott, és a helyes (tiltott) állapotot jelezte: „Indexelhetőség rendben (blocked)”. Pre-deploy készlet és 10/10 staging smoke zöld. A ticket az első éles deploykor zárható.
|
||||
- **2026-09-29**: MITHOME-127 előkészítve (main, `dc7a777`), élesítéskor zárható. A `deploy.sh` productionben megtagadja a buildet, ha `NEXT_PUBLIC_DEPLOY_ENV=staging` van beállítva, és deploy után a `scripts/check-indexability.sh` ellenőrzi az indexelhetőséget (production: indexelhető, staging: tiltott); node tesztek fedik, bekerült a pre-deploy készletbe. Új Playwright-projekt: `npm run test:seo:production` (robots, 12 végleges sitemap-URL noindex nélkül, önmagukra mutató canonical, hreflang, SSR-tartalom és linkek, `/→/hu`, 404; a host-átirányítás `SEO_CHECK_HOST_REDIRECTS=1`-gyel). Production-módú buildre a staging-DB másolatán 5/5 zöld, a staging ellen a várt módon elbukik. Közben javítva: az eslint a generált tesztkimenetet is lintelte.
|
||||
- **2026-09-29**: MITHOME-109 (Többnyelvűség EPIC) lezárva: a MITHOME-110…116 mind kész és stagingen van, közben javítva a MITHOME-123 és a MITHOME-124. Nyitva marad (nem fejlesztés): az angol tartalom ügyfél általi átnézése és jóváhagyása, a jogi oldalaknál előtte a legalább két modelles validálás. Kapcsolódó nyitott SEO-munka: MITHOME-23, MITHOME-127, MITHOME-128.
|
||||
- **2026-09-29**: MITHOME-116 kiadva stagingre (`8dd8208`). Mentés: `~/backups/mozdit-staging-20260929-123717-pre-mithome-116.archive`. 10/10 staging smoke zöld (SMOKE-09 is). Élesben ellenőrizve: a staging robots.txt mindent tilt, a sitemap üres, `noindex, nofollow`, a canonical és a hreflang helyes. Ezzel a többnyelvűség epic (MITHOME-109) minden fejlesztési alfeladata kész; hátravan az angol tartalom ügyfél általi jóváhagyása.
|
||||
- **2026-09-29**: A felhasználó által hozott SEO-útmutatóból átemelve, ami új és hasznos (a technikai alapok, vagyis a robots/sitemap/canonical/hreflang, az SSR és a beszédes URL-ek már megvannak): a MITHOME-23 feltöltve tartalmi feladatokkal (keresési szándékok, oldaltérkép, szolgáltatási szövegek, címek/descriptionök, belső linkek, alt szövegek); új MITHOME-127 (élesítési indexelhetőségi ellenőrzés; a véletlen `noindex` valós kockázat, mert a staging-tiltás build-változón múlik) és MITHOME-128 (Search Console). Az élesítési ellenőrzőlista bekerült a `.agent/workflows/deploy.md`-be.
|
||||
- **2026-09-29**: MITHOME-116 (hreflang + sitemap) kész (main, staging deploy még nem történt). A sitemap.xml és a robots.txt eddig nem létezett; most mindkettő generált (`src/app/sitemap.ts`, `robots.ts`, közös logika: `src/lib/seo.ts`). Minden oldal saját canonicalt és `hu`/`en`/`x-default` hreflangot kap. Felhasználói döntések: minden oldal mindkét nyelve szerepel, az angol jóváhagyástól függetlenül; a staging nem indexelhető (a robots.txt mindent tilt, a sitemap üres, `noindex` meta). A főoldal `og:url` értéke nyelvhelyes lett. Új staging smoke: SMOKE-09.
|
||||
- **2026-09-29**: MITHOME-115 kiadva stagingre (`af45b23`). Mentés deploy előtt: `~/backups/mozdit-staging-20260929-122308-pre-mithome-115.archive`. 9/9 staging smoke zöld (SMOKE-08 is); a váltó a `/hu/szolgaltatasok` oldalról az `/en/services` oldalra visz.
|
||||
- **2026-09-29**: MITHOME-115 (nyelvválasztó) kész (main, staging deploy még nem történt). „HU | EN” szöveges kapcsoló a fejlécben (asztalon a témaváltó, mobilon a menügomb mellett), megőrzi az aktuális oldalt a fordított sluggal. Felhasználói döntés: az EN mindig látszik, jóváhagyás előtt az angol oldal a MITHOME-113 kapu miatt magyar tartalmat mutat. `lang`/`hrefLang`/`aria-current`, nyelvenkénti csoportcímke; új staging smoke: SMOKE-08. A `jest-axe` nincs telepítve (új függőség lenne), az a11y-attribútumokat explicit tesztek fedik.
|
||||
- **2026-09-29**: MITHOME-126 (bug: `write after end` a build alatt) kész. Gyökérok: a `logger.ts` SIGTERM/SIGINT kezelője minden modul-kiértékeléskor újra regisztrálódott, és ha egy build worker mindkét jelet megkapta, a második hívás a már lezárt (`logger.end()`) Winston streamre logolt. A `logger.writableEnded` guardként nem működik, mert a winston Logger `readable-stream@3` Transform, amiben ez a property nincs. Javítás: saját `hasShutdownStarted` flag, a kezelők processzenként egyszer, `process.once`-szal regisztrálódnak. Felfedező + megőrző tesztek a `logger.test.ts`-ben (fix-bug workflow); `npm test`, lint, `tsc --noEmit` zöld, 3 egymás utáni buildben nincs `write after end`.
|
||||
- **2026-09-29**: MITHOME-112 + MITHOME-113 kiadva stagingre (`b3331d5`). Mentés deploy előtt: `~/backups/mozdit-staging-20260929-120203-pre-mithome-112-113.archive`. Induláskor lefutott a legal-pages lokalizáció (72 érték) és az angol AI-draft import (324 érték, 0 egyezés nélküli). 8/8 staging smoke zöld; a `/hu` változatlan, az `/en` jóváhagyásig magyar. Az adminban minden oldal „AI-draft, átnézésre vár” állapotban van.
|
||||
- **2026-09-29**: MITHOME-112 + MITHOME-113 kész (main, staging deploy még nem történt), OpenSpec: `openspec/changes/english-content-mithome-112-113`. A LegalPages lokalizált (migrációval). Minden Global és jogi oldal „Angol fordítás állapota” mezőt kapott (Nincs / AI-draft / Jóváhagyva); a publikus `/en` csak jóváhagyás után mutat angolt. Az AI-draft angol tartalom (179 szöveg az élő staging tartalomból, `src/content/translations/en.json`) migrációval kerül be, csak üres angol mezőbe és pontos magyar egyezésnél. A jogi oldalakon „Jogi validáció” blokk: másolható validációs prompt és a kézzel futtatott modellek visszaírt válaszai; a jóváhagyáshoz legalább két különböző modell el nem utasító validálása kell (felhasználói döntés: a validálást kézzel végzik, bármely szolgáltató modelljével). Staging-másolaton ellenőrizve (324 angol érték, 0 egyezés nélküli; a `/hu` szövegre azonos). Élő teszt közben talált és javított hiba: a vágólap-másolás tartalék lánccal. Mellékmegfigyelés: `npm run build` alatt a logger leállítási kezelője `write after end` hibát ír (`logger.ts`, MITHOME-17), a build ettől sikeres.
|
||||
- **2026-09-29**: MITHOME-112 + MITHOME-113 tervezés kész, megvalósításra vár: `openspec/changes/english-content-mithome-112-113`. Döntések: előbb a LegalPages lokalizálása; nem lokalizált „Angol fordítás állapota” mező + kapu (az `/en` jóváhagyásig magyart mutat); a forrás az élő staging tartalom, repóban tárolt magyar → angol szótárral; a jogi szövegek angol fordítását kötelező legalább két magas szintű modellel validálni (a CMS validációs rekord nélkül nem engedi jóváhagyni), a jogi oldal szerkesztőjében másolható validációs segédprompttal. Közben felvéve: MITHOME-125 (opcionális Chat funkció, backlog).
|
||||
- **2026-09-29**: MITHOME-124 kiadva stagingre (`b96e776`). Mentés deploy előtt: `~/backups/mozdit-staging-20260929-020147-pre-mithome-124.archive`. 8/8 staging smoke zöld (SMOKE-07 is); a `/hu` külső linkjei (webmail, partner) új lapon nyílnak.
|
||||
- **2026-09-29**: MITHOME-124 (általános szabály: minden külső link új lapon) kész. A viselkedés addig nem volt egységes: a főoldali Webmail gomb ugyanazon a lapon nyílt, a többi webmail-link újon, a CTA és a fejléc kézi `external` kapcsolóra hagyatkozott. Központi helper (`src/lib/external-link.ts`) a címből dönt, a CMS-HTML linkjeit is kezeli; minden linkhely erre állt át, a kézi kapcsolók megszűntek. A szabály bekerült az `architecture.md`-be és a `CLAUDE.md`-be; új staging smoke: SMOKE-07. Follow-up javaslat: „új lapon nyílik” jelzés (WCAG G201), CMS-ből jövő felirattal.
|
||||
- **2026-09-29**: MITHOME-111 + MITHOME-123 kiadva stagingre (`2165551`). Deploy előtt mentés készült: `~/backups/mozdit-staging-20260929-014015-pre-mithome-111-123.archive` (llmdev). Induláskor mindkét migráció lefutott (405 lokalizált érték, 6 CTA), és a `payload-migrations` nyilvántartja őket. 7/7 staging smoke teszt zöld, köztük az új SMOKE-06-hu/en: a hero CTA célja mindkét nyelven helyes. A staging-smoke eddig csak a CTA láthatóságát nézte, ezért nem vette észre a 404-et.
|
||||
- **2026-09-29**: MITHOME-123 (bug: főoldali CTA 404) kész. A fő CTA `href` értéke a szabad szöveges `/kapcsolat` volt, ez a MITHOME-114 locale-prefixes routingja óta 404-et adott. Tartós javítás: a CTA link típusa választható (Belső oldal: oldalválasztó / Külső URL). A belső oldalt a frontend `localePath()`-szal oldja fel (`/hu/kapcsolat`, `/en/contact`), így nem gépelhető el és nyelvhelyes. Payload-migráció (`20260929_cta_page_links`) alakítja át a meglévő adatot a publikált dokumentumon, a draftokon és a verziókon; a MITHOME-111-gyel közös bejáró helper a `src/lib/migrate-global-docs.ts`-be került. Élesben ellenőrizve a staging-DB másolatán: publikus oldalak, admin oldalválasztó, feltételes mezők és publikálási validáció. Külön OpenSpec change nem készült, mert bugfix (fix-bug workflow, exploration + preservation tesztekkel).
|
||||
- **2026-09-29**: MITHOME-111 (Globals lokalizációs retrofit) kész, OpenSpec change: `openspec/changes/localize-globals-mithome-111`. Az 5 Global minden fordítható szövegmezője lokalizált; közös maradt az `icon`, a sor-`id`, az `external` és a `footer.address`. A `hero.cta.*.href` lokalizált. A string-listák tömb szinten, az objektum-tömbök csak a belső szövegeikben lokalizáltak. A ticket „migrálás nélkül” állítása téves volt: a lokalizált tömbök a régi tárolási alakban üresnek olvasódnak. Megoldás: idempotens Payload-migráció (`src/migrations/20260929_localize_globals.ts`), amely a publikált dokumentumon, a draftokon és a verziótörténeten is `{ hu }` alakba csomagol, és induláskor automatikusan fut (`prodMigrations`). A JSON-seed újrafuttatását elvetettük, mert felülírná az admin-szerkesztéseket. Élesben ellenőrizve a staging-DB másolatán, eldobható konténerben az llmdev-en: 405 érték átírva, a hu/draft/verziók bájtra azonosak a migráció előtti állapottal, az en fallbacket ad, a második futás nem módosít, mind a 8 oldal 200. A deploy-workflow kiegészült a kötelező `mongodump`-pal és a rollback menetével. Mellékeredmény: a főoldal fő CTA `href` értéke `/kapcsolat`, prefix nélkül, és 404-et ad (Plane-kommentben jelezve, új ticketet igényel). A `payload` CLI Node 26 alatt `ERR_REQUIRE_ASYNC_MODULE`-lal elhasal (a típusgenerálást kerülőúton futtattuk).
|
||||
- **2026-09-28**: MITHOME-17 alkalmazásoldali része kész és stagingen ellenőrizve: Winston JSON stdout/stderr, komponens-metaadat, biztonságos hibamezők; MITHOME-33 lezárva, mert a staging/production app közvetlen Loki-host konfigurációja kivezetve. Az ISPConfig partneroldalak központi gyűjtése külön Hosting-infrastruktúra munka, MITHOME-17 részeként nem telepítettük.
|
||||
- **2026-09-27**: OpenSpec 1.13.2 bekötve OpenCode-hoz (`openspec/config.yaml`, `.opencode/` workflow-k, `openspec/` struktúra). Nagyobb változtatások specifikációs folyamata OpenSpecen fut; Plane MITHOME marad a task/státusz authoritative source, a `TODO.md` annak tükre.
|
||||
- **2026-09-13**: MITHOME-95 (dokumentáció frissítése) kész — `.agent/steering/architecture.md` és `CLAUDE.md` már a Payload Global/Collection + `/admin` + `payload-content.ts` Local API adaptert írja le a régi JSON rendszer helyett (rendszer-áttekintés, Content sor/szabály, kódpélda, projekt-struktúra fa). Emellett javítva több, ugyanebbe a dokumentációs adósságba tartozó, de a ticketben nem nevesített hely is: `.agent/AGENTS.md` projekt-fája, `new-feature.md`/`review.md` workflow-ok, `development-rules.md` TRADEOFF példakódja, és a `README.md` teljes "Tartalomkezelés" szekciója + egy halott link a MITHOME-93-ban törölt CMS-útmutatóra. Tisztán dokumentáció-változtatás.
|
||||
- **2026-09-12**: Felhasználói kérésre a főoldal "Partnereink" szekciója flex-wrap helyett CSS grid-re váltott (max 3 oszlop, `grid-cols-1 sm:grid-cols-2 md:grid-cols-3`, `w-fit mx-auto` a középre igazításhoz kevesebb partnernél is) — élőben ellenőrizve 5 teszt-partnerrel (3+2-es elrendezés, középre igazítva).
|
||||
- **2026-09-12**: MITHOME-96 (tesztek migrálása) kész — `src/payload-config.test.ts` (gyors, DB nélküli config-tesztek, két regresszió-őrrel a MITHOME-121-es hibákra) + `scripts/test-payload-local-api.ts`/`npm run test:payload` (élő MongoDB elleni Local API teszt, sima node script Jest helyett — a Payload csomag ESM-only, Jest alapból nem fordítja). Emellett javítva a régi, Docker-stack-hez kötött `integration.test.ts`/`e2e-docker.test.ts` eddig észrevétlen elavulása (unprefixelt útvonalak, `site_config`/`contact_submissions` nyers Mongo collection-ök a valódi Payload collection-ök helyett). Gate zöld (63 unit teszt), `test:payload` külön lefuttatva élőben (8/8).
|
||||
- **2026-09-12**: MITHOME-94 (ContactSubmissions collection) kész — a `/api/contact` a nyers, Payload-on kívüli Mongo collection helyett most a Payload Local API-n keresztül egy `ContactSubmissions` collection-be ír (name/email/subject/message/gdprConsent/status), amit az ügyfél az adminban lát. Rate limiting/validáció/spam-szűrés változatlanul a route-on maradt. Nincs egyedi access-blokk — a Payload alapértelmezése (csak bejelentkezett usernek REST-en) pont a kívánt, a route saját írása a Local API-n (`overrideAccess: true`) nem ütközik ezzel. Talált és dokumentált teszt-gotcha: a next/jest SWC transform lecseréli a `@payload-config` alias-t valódi relatív útvonalra, ezért a mockot is a feloldott útvonalra kell tenni (`jest.mock('../../../payload.config', ...)`), nem az alias-ra. Élesben ellenőrizve mindkét helyen (helyi dev valódi űrlap-küldéssel + staging curl-lal).
|
||||
- **2026-09-12**: MITHOME-97 follow-up #3 — a felhasználó kérdésére ("el lehet jutni a honlapra az admin oldalról?") kiderült, hogy nem: az admin navigációban csak belső linkek voltak. Hozzáadva egy "🌐 Honlap megnyitása" link a keresősáv mellé (`QuickSearch.tsx`), ami `NEXT_PUBLIC_SITE_URL`-re mutat — környezetenként automatikusan helyes cím. Élesben ellenőrizve, staging-re deployolva.
|
||||
- **2026-09-12**: MITHOME-121 kész — a felhasználó kérésére a Partners `logo` mezője opcionálissá vált (`required: true` törölve; a frontend már eleve kiszűrte a logó nélküli partnereket). Eközben egy valódi, MITHOME-89 óta jelen lévő hiba is előkerült: a `Media` collection sosem kapott explicit `access.read`-et, így a Payload alapértelmezett "csak bejelentkezett user" szabálya miatt a `/api/media/file/*` route mindig 403-at adott — a Next.js image-optimizer emiatt sosem tudta betölteni a partner logókat a publikus oldalon (törött kép ikon, senki nem vette észre). Javítva: `access: { read: () => true }`. Staging-en emellett egy második, kapcsolódó hibát is találtam: a médiafájl fizikai byte-jai elvesztek egy korábbi (a `media_data_staging` volume bevezetése előtti) konténer-újraépítéskor — az árva Media rekord törlésével és a migráció volume-mountolt konténerből való újrafuttatásával helyreállítva. Élesben ellenőrizve mindkét helyen (helyi dev + staging).
|
||||
- **2026-09-12**: MITHOME-120 (admin gyorskeresés) kész — a felhasználó kérésére egy keresőmező került a Payload admin minden oldalának tetejére (`admin.components.header`), ami az összes Global + Collection összes szöveges mezőjét átkeresi mindkét locale-ban (kliens-oldali, index nélküli megoldás — `@payloadcms/plugin-search` aránytalan lenne a projekt méretéhez, ugyanaz az érvelés, mint MITHOME-118-nál). Útközbeni gotcha: a Payload komponens-útvonalak `process.cwd()`-hez (nem a config fájl mappájához) relatívak — dokumentálva. Élesben ellenőrizve böngészőben (Global + Collection találat is, helyes navigáció, 0 console hiba), a lint egy valódi hibát is elkapott (ref helyett state kellett). Staging-re is kideployolva.
|
||||
- **2026-09-11**: MITHOME-97 follow-up #2 — a felhasználó véletlen elgépelt egy URL-t (`stage.llmdev.mozdit.hu`), amire a Firefox valódinak tűnő "site could be impersonating" figyelmeztetést adott. Kiderült: egy elárvult `cms.stage.llmdev.mozdit.hu` nginx vhost a régi, leépített CMS-re (content-editor.js, port 4001, MITHOME-93) mutatott — a backend leállítva, de a vhost/tanúsítványa élt, nginx fallback-ként adta ezt bármilyen nem egyező `*.mozdit.hu` aldomainre. Megoldás: a vhost most a Payload admin felé proxyz (`/admin`, `/api/`, `/_next/` → staging app 127.0.0.1:8081), minden más redirect a kanonikus `stage.mozdit.hu`-ra — kényelmi admin-URL, meglévő tanúsítvány újrahasznosítva. Dokumentálva: `docs/nginx-vhosts.md` (eddig egyetlen nginx-konfig sem volt nyomon követve a repóban). Élesben ellenőrizve böngészőben (0 console hiba, bejelentkezés is működik ezen a domain-en).
|
||||
- **2026-09-11**: MITHOME-97 follow-up — automatikus, ismert Payload admin-felhasználó minden deploy után. `deploy.sh` a healthcheck után meghívja a Payload beépített `POST /api/users/first-register` végpontját `ADMIN_EMAIL`/`ADMIN_PASSWORD` alapján; ez a végpont csak üres `users` collection-nél enged létrehozást (403 minden további hívásra) — idempotens, sosem ír felül meglévő jelszót. Élesben ellenőrizve (friss DB → 200, ismételt hívás → 403, meglévő más-user-es DB → 403), majd staging-en ténylegesen bevezetve: `.env.staging`-hez szerveren generált admin jelszó, két egymást követő `deploy.sh staging` (első létrehozta, második helyesen kihagyta), bejelentkezés-teszt 200.
|
||||
- **2026-09-11**: MITHOME-92 (draft/preview + verziózás) kész — Payload versions.drafts minden tartalmi Global/Collection-ön, admin UI Save Draft/Publish + Versions tab, ez a régi CMS "Verziók panel" (MITHOME-64) utódja. Valódi hiba javítva: a `_status` mező defaultValue-ja 'draft', a migrációs script eddig sosem adott át explicit `_status`-t → minden migrált dokumentum draft állapotban landolt; javítva `_status: 'published'` explicit átadásával. Élesben ellenőrizve (draft mentés nem látszik a publikus oldalon, publish után igen).
|
||||
- **2026-09-11**: MITHOME-93 (régi egyedi CMS leépítése) kész — `content-editor.js` + `scripts/cms-*.js` + a hozzá tartozó tesztkészlet eltávolítva. Felhasználói kérésre biztonsági mentés készült a törlés előtt: `proto/scripts/export-content-snapshot.ts` (Payload Local API export) → `docs/backups/payload-content-snapshot-*.json`, plusz ellenőrizve, hogy a régi CMS `.content-backups/` mappájának legutóbbi bejegyzése a mai migráció előtti, és minden JSON-szerkesztés saját git commitként is megvan.
|
||||
- **2026-09-11**: MITHOME-97 (Deploy/Docker) kész, ÉS staging deploy ténylegesen megtörtént (https://stage.mozdit.hu). Két valódi hiba a Docker build első élő tesztjén: (1) a `(frontend)/[locale]` oldalak SSG-ként (`generateStaticParams`) épültek, build közben hívva a Payload Local API-t — DB nélkül a build elhalt; (2) ennél súlyosabb, hogy SSG mellett egy admin publikálás csak redeploy után látszott volna, ami az önkiszolgáló szerkesztési cél ellen dolgozott. Felhasználói jóváhagyással `force-dynamic`-ra váltva — minden kérés élő Payload-olvasás, build DB-független. `PAYLOAD_SECRET` bekötve staging/prod/dev compose-ba (eddig csak `.env.*.example`-ben létezett, sosem jutott el a konténerig). Named media volume a Payload uploadoknak. Külön javítva: a staging deploy script egy már nem létező `mozdit-content-editor.service`-t indított újra — eltávolítva, a szerveren a valós unit is leállítva/letiltva. Staging: hiányzó `PAYLOAD_SECRET` generálva a szerveren, `deploy.sh staging` lefuttatva, tartalom-migráció lefuttatva a staging DB ellen, élesben ellenőrizve böngészőben (`/hu`, `/en`, `/admin` mind működik).
|
||||
- **2026-09-10**: MITHOME-91 + MITHOME-114 (Frontend Payload Local API-ra állítás + hu/en locale routing) kész, egy menetben. URL-stratégia véglegesítve: mindkét nyelv szimmetrikus prefixet kap (`/hu/rolunk`, `/en/about`, lefordított szlögekkel), felülírva a korábbi "hu prefix nélkül" döntést. Minden oldal Payload Local API-ról megy, `@/content` kivezetve az app-kódból. Két valódi, régről létező bug javítva (webmail-linkek, GDPR-checkbox linkje). Talált és javított: Next.js beépített 404-fallback ütközött a (payload) route group-pal — saját `not-found.tsx` oldotta meg, éles production-standalone szerverrel is ellenőrizve (0 console hiba). Build/lint/tsc/teszt zöld. **Folyamat-eltérés**: ez a commit közvetlenül a `main`-re ment feature branch nélkül (egy interrupt miatt kimaradt a branch-nyitás) — a végeredmény megegyezik azzal, mintha branch+merge lett volna, mert eddig is minden branch azonnali fast-forwarddal ment be.
|
||||
- **2026-09-10**: MITHOME-90 (Users access control) kész — explicit maxLoginAttempts/lockTime, cookie security, access control minden op-ra. GHSA-jg8r-5jh2-v2xj advisory megvizsgálva és tudatosan elfogadva az egyetlen "admin" szerepkör modellben. Élesben ellenőrizve valódi lockout-teszttel. Follow-up: MITHOME-119 (MFA előkészítés, felhasználói kérésre, külön taszk) — mert a Payloadnak nincs natív MFA-ja, és ez ugyanabba a konvergencia-pontba esik, mint az Auth/IDM (PLATFM-4/PLATFM-11 IDM v1), ezért csak ADR-szintű döntést csinálunk, nem implementációt. PLATFM-1 kapcsolati térkép frissítve ("Auth/IDM/MFA" sor).
|
||||
- **2026-09-10**: MITHOME-118 (logószerkesztő Payload-ba építése) lezárva, tudatosan nem valósítjuk meg — determinisztikus képfeldolgozás, nem illik sem a Payload admin-ba (aránytalan karbantartási teher egy ritkán használt funkcióért), sem Hermes/AI-agent munkafolyamatba (az nyelvi/döntési feladatokra való, nem pixel-transzformációra). Döntés: 3rd party előfeldolgozás (pl. remove.bg) marad — ez rögzítve a Partners collection `logo` mezőjének admin leírásában is.
|
||||
- **2026-09-10**: MITHOME-110 (Payload localization bekapcsolása) kész — hu alapértelmezett, en, fallback:true. `Common.buttons.*` localized:true (valódi, előremutató teszt-mező, része a MITHOME-111 retrofitnak). Fontos tapasztalat dokumentálva: utólagos localized:true után a migrációs scriptet újra kell futtatni, mert a defaultLocale alatti régi érték "eltűnik". Élesben ellenőrizve admin UI nyelvváltóval.
|
||||
- **2026-09-10**: MITHOME-89 (Partners + Media collection MVP) kész. Payload upload (Media) + Partners collection, migrálva a meglévő partner logóval — élesben ellenőrizve (1+1 dokumentum, idempotens, logó thumbnail rendben). A régi crop/rotate/transparent-logo szerkesztő (kliens-oldali canvas, 345 sor) külön ticketre bontva: MITHOME-118. Fontos: a Payload uploadok `proto/media/`-ba kerülnek (gitignore-olva) — staging/production docker-compose-ban perzisztens volume kell (jelezve MITHOME-97-nél).
|
||||
- **2026-09-10**: MITHOME-117 létrehozva — explicit elfogadási kritérium, hogy a Payload-átállás (MITHOME-91/93) ne változtasson a publikus oldal jelenlegi színein/design tokenjein (`proto/src/app/(frontend)/globals.css`, márka-színek: Logo Blue #1f4e9d, Logo Orange #e43e26). Before/after screenshot-összehasonlítás lesz az elfogadási feltétel.
|
||||
- **2026-09-10**: Többnyelvűség EPIC (MITHOME-109) és 7 alfeladat (MITHOME-110–116) létrehozva Plane-ben — hu (alapértelmezett, prefix nélkül) + en (/en/ alatt), Payload natív lokalizációra építve, AI-draft angol tartalommal. MITHOME-91-hez (Frontend Local API átállás) hozzáadva a MITHOME-114 (locale routing) függőségi megjegyzés — egy menetben érdemes elvégezni.
|
||||
- **2026-09-10**: MITHOME-88 (LegalPages collection) kész. Slug-alapú collection (adatvedelem, hasznalati-feltetelek), migrálva `migrate-content-to-payload.ts`-sel (idempotens upsert, kétszeri futtatás után is pontosan 2 dokumentum). Élesben ellenőrizve admin UI-ban.
|
||||
- **2026-09-10**: PLATFM-1 ("Platform architektúra és komponensfüggőségi nyilvántartás") kiegészítve egy MITHOME↔PLATFM kapcsolati térképpel (6 konvergencia-pont: AI-triázs, Auth/IDM, Content Release, Termékkatalógus, Messaging, BCDR) — ez a Program-szintű koordináció, nem kell hozzá külön Plane-projekt. A MITHOME-40 (production MongoDB mentés) prioritása medium→urgentre emelve, mert a PLATFM-5 (BCDR) explicit RPO≤15p/RTO≤4ó célt ad a kapcsolatfelvételi üzenetekre.
|
||||
- **2026-09-10**: MITHOME/PLATFM rendrakás. Kiderült, hogy a Hermes Agent EPIC (MITHOME-99) duplikálta a PLATFM-10 AI-pilotot (kapcsolatfelvételi triázs) — MITHOME-99/100/101/104/106/107/108 lezárva (Cancelled), PLATFM-10-re hivatkozva. Új ADR nyitva a motor-választáshoz: PLATFM-12. Ami valódi MITHOME-felelősség maradt (ContactSubmissions eseményforrás, PLATFM-2-kompatibilis sémával), az a Payload-epic alá került: MITHOME-102/103/105.
|
||||
- **2026-09-10**: Hermes Agent EPIC (MITHOME-99) és 9 alfeladat (MITHOME-100–108) létrehozva Plane-ben — pilot: self-hosted AI agent (Nous Research, MCP-támogatás) a kapcsolatfelvételi triázshoz, kapcsolódva a nyitott MITHOME-31 bughoz és a MITHOME-47 (belső operatív munkaasztal) irányhoz.
|
||||
- **2026-09-10**: MITHOME-98 (dev docker-compose Mongo URI auth) kész. A `docker-compose.dev.yml` `app` service-e hitelesítés nélkül próbált kapcsolódni egy authot igénylő MongoDB-hez — élesben reprodukálva (findOne → "Command find requires authentication"), majd javítva és ellenőrizve (POST /api/contact valódi Mongo-írása). Ugyanaz a hibaosztály, mint MITHOME-32, de külön, dev-specifikus ticket, mert MITHOME-32 csak staging/production compose-t fed le. Branch: `fix/dev-mongo-uri-auth`.
|
||||
- **2026-09-10**: MITHOME-87 (Home/About/Services/Contact/Common Globals + JSON migráció) kész. Munka közben két, MITHOME-86-hoz visszanyúló hibát javítottunk: (1) a gyökér src/app/layout.tsx ütközött a Payload (payload)/layout.tsx-ével — a webodal saját route-jai átkerültek egy (frontend) route groupba; (2) a kézzel írt importMap.js stub nem volt elég — tsx 4.22.4→4.23.13 (Node 25 kompatibilitás) után legenerálva a valódit. Mindkettő valós böngészőben ellenőrizve (curl nem buktatta fel korábban). `npm run migrate:content` script + `npm test`/lint/build zöld.
|
||||
- **2026-09-10**: MITHOME-86 (Payload alapinstalláció) kész: Next.js 15.5→16.3.4 upgrade (Payload peer dep miatt), payload.config.ts + mongooseAdapter + minimális Users collection + admin/API/GraphQL route-ok. Élesben ellenőrizve valódi MongoDB-vel. Ismert nyitott advisory a payload@3.88.0-ban (GHSA-jg8r-5jh2-v2xj), nyomon követve MITHOME-90 alatt. Branch: `feature/payload-cms-setup`.
|
||||
|
||||
@@ -1,362 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* mozdIT Content Editor Server v2
|
||||
* Szerkesztő felület a JSON tartalom fájlokhoz
|
||||
* Támogatja: szöveg szerkesztés, tömbelem hozzáadás/törlés
|
||||
* Futtatás: node content-editor.js
|
||||
* Megnyitás: http://localhost:4001
|
||||
*/
|
||||
|
||||
const http = require('http');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { exec, execSync } = require('child_process');
|
||||
const crypto = require('crypto');
|
||||
const { validateContent } = require('./proto/src/content/schema');
|
||||
const { renderMarkdown } = require('./scripts/markdown-render');
|
||||
const { buildPublishCommand, interpretPublishResult } = require('./scripts/cms-publish');
|
||||
const { handleVersionRoutes, listVersions } = require('./scripts/cms-versions');
|
||||
const { handleSaveRoute } = require('./scripts/cms-save');
|
||||
const { LOGO_TARGETS, handleLogoRoutes } = require('./scripts/cms-logo');
|
||||
|
||||
const PORT = Number(process.env.CONTENT_EDITOR_PORT) || 4001;
|
||||
// WHY: overridable so the publish integration test can run against a throwaway
|
||||
// git clone instead of the real repository.
|
||||
const CONTENT_DIR = process.env.CONTENT_EDITOR_CONTENT_DIR || path.join(__dirname, 'proto', 'src', 'content');
|
||||
const BACKUP_DIR = path.join(__dirname, '.content-backups');
|
||||
const MAX_REQUEST_BODY_BYTES = 256 * 1024;
|
||||
const AUDIT_LOG_FILE = process.env.CONTENT_EDITOR_AUDIT_FILE || path.join(__dirname, '.content-editor-audit.jsonl');
|
||||
const GUIDE_FILE = process.env.CONTENT_EDITOR_GUIDE_FILE || path.join(__dirname, 'docs', 'felhasznaloi-utmutato.md');
|
||||
const RATE_LIMIT_WINDOW_MS = 15 * 60 * 1000;
|
||||
const AUTH_MAX_ATTEMPTS = 5;
|
||||
const PUBLISH_MAX_ATTEMPTS = 3;
|
||||
let isPublishing = false;
|
||||
|
||||
const FILES = {
|
||||
common: path.join(CONTENT_DIR, 'common.json'),
|
||||
home: path.join(CONTENT_DIR, 'pages', 'home.json'),
|
||||
about: path.join(CONTENT_DIR, 'pages', 'about.json'),
|
||||
services: path.join(CONTENT_DIR, 'pages', 'services.json'),
|
||||
contact: path.join(CONTENT_DIR, 'pages', 'contact.json'),
|
||||
adatvedelem: path.join(CONTENT_DIR, 'pages', 'adatvedelem.json'),
|
||||
hasznalatiFeltetelek: path.join(CONTENT_DIR, 'pages', 'hasznalati-feltetelek.json'),
|
||||
};
|
||||
|
||||
const FILE_LABELS = {
|
||||
common: '⚙️ Közös szövegek',
|
||||
home: '🏠 Kezdőlap',
|
||||
about: '👥 Rólunk',
|
||||
services: '🛠️ Szolgáltatások',
|
||||
contact: '📬 Kapcsolat',
|
||||
adatvedelem: '🔒 Adatvédelem',
|
||||
hasznalatiFeltetelek: '⚖️ ÁSZF',
|
||||
};
|
||||
|
||||
const { HTML, GUIDE_PAGE, LOGIN_PAGE, VERSIONS_PAGE } = require('./scripts/cms-pages');
|
||||
const { LOGO_PAGE } = require('./scripts/cms-logo-page');
|
||||
const { validateLogin, createSessionCookie, clearSessionCookie, hasValidSession, deleteSession } = require('./scripts/cms-session');
|
||||
|
||||
// Browser script is kept in its own file and inlined into the HTML template at render time.
|
||||
const clientJs = fs.readFileSync(path.join(__dirname, 'scripts', 'cms-editor-client.js'), 'utf8')
|
||||
+ '\n' + fs.readFileSync(path.join(__dirname, 'scripts', 'cms-editor-shortcuts.js'), 'utf8');
|
||||
|
||||
|
||||
// ── Server ───────────────────────────────────────────────────────────────────
|
||||
|
||||
// Security/infra helpers live in scripts/cms-core.js (file-size limits).
|
||||
const core = require('./scripts/cms-core');
|
||||
const { CMS_USER, CMS_PASS, CMS_DEPLOY_ENV, CSRF_TOKEN, securityConfigIsValid, getClientAddress, hasValidCsrfToken, backupAndWriteAtomically } = core;
|
||||
const exceedsRateLimit = (key, limit) => core.exceedsRateLimit(key, limit, RATE_LIMIT_WINDOW_MS);
|
||||
const isRateLimited = (key, limit) => core.isRateLimited(key, limit, RATE_LIMIT_WINDOW_MS);
|
||||
const recordRateLimitAttempt = key => core.recordRateLimitAttempt(key, RATE_LIMIT_WINDOW_MS);
|
||||
const hasValidCredentials = req => core.hasValidCredentials(req, validateLogin);
|
||||
const isAuthenticated = core.makeIsAuthenticated(hasValidSession, validateLogin);
|
||||
const isBrowserNavigation = core.isBrowserNavigation;
|
||||
const writeAudit = core.makeWriteAudit(AUDIT_LOG_FILE);
|
||||
|
||||
// Deploy version = git short SHA of the checked-out commit. Read once at startup:
|
||||
// a CMS "deploy" is git pull + service restart, so this identifies the running code.
|
||||
function readDeployVersion() {
|
||||
try {
|
||||
return execSync('git rev-parse --short HEAD', { cwd: __dirname, encoding: 'utf8' }).trim();
|
||||
} catch {
|
||||
return 'unknown';
|
||||
}
|
||||
}
|
||||
const DEPLOY_VERSION = readDeployVersion();
|
||||
|
||||
const server = http.createServer(async (req, res) => {
|
||||
res.setHeader('X-Frame-Options', 'DENY');
|
||||
res.setHeader('X-Content-Type-Options', 'nosniff');
|
||||
const clientAddress = getClientAddress(req);
|
||||
if (!securityConfigIsValid()) {
|
||||
res.writeHead(503, { 'Content-Type': 'text/plain; charset=utf-8' });
|
||||
res.end('Content Editor is disabled: CMS_USER and CMS_PASS must be configured.');
|
||||
return;
|
||||
}
|
||||
|
||||
const u = new URL(req.url, `http://localhost:${PORT}`);
|
||||
|
||||
// WHY: Basic Auth credentials are cached by the browser until it closes, so there is
|
||||
// no native logout. The client calls /logout with deliberately invalid credentials,
|
||||
// which overwrites the cached pair; the next navigation prompts for login again.
|
||||
// Deliberately exempt from the auth rate limiter so logging out never locks the user out.
|
||||
if (u.pathname === '/logout' && req.method === 'GET') {
|
||||
// Legacy cache-buster endpoint; no WWW-Authenticate — Safari would show its
|
||||
// native auth dialog on any fetch hitting this challenge.
|
||||
res.writeHead(401, { 'Cache-Control': 'no-store' });
|
||||
res.end('Logged out');
|
||||
return;
|
||||
}
|
||||
|
||||
// Public: logo asset for the login page.
|
||||
if (req.method === 'GET' && u.pathname === '/logo.png') {
|
||||
try {
|
||||
// ?variant=header serves the website header logo (branding page preview).
|
||||
const file = u.searchParams.get('variant') === 'header' ? LOGO_TARGETS.header : LOGO_TARGETS.icon;
|
||||
const logo = fs.readFileSync(path.join(__dirname, 'proto', 'public', file));
|
||||
res.writeHead(200, { 'Content-Type': 'image/png', 'Cache-Control': 'public, max-age=3600' });
|
||||
res.end(logo);
|
||||
} catch {
|
||||
res.writeHead(404); res.end('Not found');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Public: deploy version (git SHA only — no secrets) for quick "is the fix live?" checks.
|
||||
if (req.method === 'GET' && u.pathname === '/version') {
|
||||
res.writeHead(200, { 'Content-Type': 'application/json', 'Cache-Control': 'no-store' });
|
||||
res.end(JSON.stringify({ version: DEPLOY_VERSION, env: CMS_DEPLOY_ENV }));
|
||||
return;
|
||||
}
|
||||
|
||||
// Public: styled login page (shown after logout and for unauthenticated browser visits).
|
||||
if (req.method === 'GET' && u.pathname === '/login') {
|
||||
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'no-store' });
|
||||
res.end(LOGIN_PAGE());
|
||||
return;
|
||||
}
|
||||
|
||||
// Public: login form endpoint. Shares the auth rate-limit budget with failed
|
||||
// Basic attempts so the form cannot be brute-forced either.
|
||||
if (req.method === 'POST' && u.pathname === '/login') {
|
||||
let body = '';
|
||||
let bodyTooLarge = false;
|
||||
req.on('data', c => {
|
||||
if (body.length + c.length > 1024) { bodyTooLarge = true; return; }
|
||||
body += c;
|
||||
});
|
||||
req.on('end', () => {
|
||||
if (isRateLimited(`auth:${clientAddress}`, AUTH_MAX_ATTEMPTS)) {
|
||||
writeAudit('login_failed', { clientAddress, result: 'rate_limited' });
|
||||
res.writeHead(429, { 'Content-Type': 'application/json', 'Retry-After': String(RATE_LIMIT_WINDOW_MS / 1000) });
|
||||
res.end(JSON.stringify({ ok: false, error: 'Túl sok belépési kísérlet — próbáld újra később.' }));
|
||||
return;
|
||||
}
|
||||
let user = '';
|
||||
let pass = '';
|
||||
try {
|
||||
const parsed = JSON.parse(body);
|
||||
user = String(parsed.user || '');
|
||||
pass = String(parsed.pass || '');
|
||||
} catch { /* empty credentials fail validation below */ }
|
||||
if (!bodyTooLarge && validateLogin(user, pass, CMS_USER, CMS_PASS)) {
|
||||
// WHY: successful logins must not consume the failure budget — tests and
|
||||
// multi-tab users log in repeatedly and would lock themselves out.
|
||||
const isSecure = req.headers['x-forwarded-proto'] === 'https';
|
||||
writeAudit('login_success', { clientAddress });
|
||||
res.writeHead(200, { 'Content-Type': 'application/json', 'Set-Cookie': createSessionCookie(isSecure) });
|
||||
res.end(JSON.stringify({ ok: true }));
|
||||
return;
|
||||
}
|
||||
recordRateLimitAttempt(`auth:${clientAddress}`);
|
||||
writeAudit('login_failed', { clientAddress, result: bodyTooLarge ? 'request_too_large' : 'invalid_credentials' });
|
||||
res.writeHead(401, { 'Content-Type': 'application/json' });
|
||||
res.end(JSON.stringify({ ok: false, error: 'Hibás felhasználónév vagy jelszó.' }));
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (isRateLimited(`auth:${clientAddress}`, AUTH_MAX_ATTEMPTS)) {
|
||||
writeAudit('authentication_failed', { clientAddress, limited: true });
|
||||
res.writeHead(429, { 'Retry-After': String(RATE_LIMIT_WINDOW_MS / 1000) });
|
||||
res.end('Too many authentication attempts');
|
||||
return;
|
||||
}
|
||||
if (!isAuthenticated(req)) {
|
||||
recordRateLimitAttempt(`auth:${clientAddress}`);
|
||||
writeAudit('authentication_failed', { clientAddress, limited: false });
|
||||
// Browser navigations land on the styled login page; API/curl gets a plain 401.
|
||||
// WHY no WWW-Authenticate: Safari pops its native auth dialog on fetch() calls
|
||||
// that receive a Basic challenge — the styled /login page handles browsers.
|
||||
if (isBrowserNavigation(req)) {
|
||||
res.writeHead(302, { Location: '/login', 'Cache-Control': 'no-store' });
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
res.writeHead(401, { 'Cache-Control': 'no-store' });
|
||||
res.end('Access denied');
|
||||
return;
|
||||
}
|
||||
|
||||
const fileKey = u.searchParams.get('file') || 'home';
|
||||
const activeFile = FILES[fileKey] ? fileKey : 'home';
|
||||
|
||||
if (req.method === 'POST' && !hasValidCsrfToken(req)) {
|
||||
writeAudit('csrf_rejected', { clientAddress, path: u.pathname, file: activeFile });
|
||||
res.writeHead(403, { 'Content-Type': 'application/json' });
|
||||
res.end(JSON.stringify({ ok: false, error: 'Érvénytelen vagy hiányzó CSRF token' }));
|
||||
return;
|
||||
}
|
||||
|
||||
// POST /logout — invalidate the browser session (Basic Auth stays valid by design).
|
||||
if (req.method === 'POST' && u.pathname === '/logout') {
|
||||
deleteSession(req);
|
||||
writeAudit('logout', { clientAddress, user: CMS_USER });
|
||||
res.writeHead(200, { 'Content-Type': 'application/json', 'Set-Cookie': clearSessionCookie() });
|
||||
res.end(JSON.stringify({ ok: true }));
|
||||
return;
|
||||
}
|
||||
|
||||
// GET /guide — user guide rendered from the maintained markdown in the repo.
|
||||
if (req.method === 'GET' && u.pathname === '/guide') {
|
||||
let contentHtml;
|
||||
try {
|
||||
contentHtml = renderMarkdown(fs.readFileSync(GUIDE_FILE, 'utf8'));
|
||||
} catch (error) {
|
||||
contentHtml = '<p>Az útmutató jelenleg nem elérhető. Kérlek, szólj a fejlesztőnek.</p>';
|
||||
}
|
||||
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
|
||||
res.end(GUIDE_PAGE(contentHtml));
|
||||
return;
|
||||
}
|
||||
|
||||
// POST /save — handled in scripts/cms-save.js (optimistic lock + validation + backup).
|
||||
if (handleSaveRoute({
|
||||
req, res, u, activeFile, files: FILES, maxBodyBytes: MAX_REQUEST_BODY_BYTES,
|
||||
validate: validateContent, writeAudit, backupAndWrite: backupAndWriteAtomically,
|
||||
backupDir: BACKUP_DIR, user: CMS_USER, clientAddress, cmsDirname: __dirname,
|
||||
})) return;
|
||||
|
||||
// POST /publish — Git Commit, Pull Rebase & Push
|
||||
if (req.method === 'POST' && u.pathname === '/publish') {
|
||||
if (isPublishing) {
|
||||
res.writeHead(423, { 'Content-Type': 'application/json' });
|
||||
res.end(JSON.stringify({ ok: false, error: 'Már folyamatban van egy publikálás. Kérlek, várj.' }));
|
||||
return;
|
||||
}
|
||||
isPublishing = true;
|
||||
if (exceedsRateLimit(`publish:${clientAddress}`, PUBLISH_MAX_ATTEMPTS)) {
|
||||
isPublishing = false;
|
||||
writeAudit('publish_rate_limited', { clientAddress, user: CMS_USER });
|
||||
res.writeHead(429, { 'Content-Type': 'application/json', 'Retry-After': String(RATE_LIMIT_WINDOW_MS / 1000) });
|
||||
res.end(JSON.stringify({ ok: false, error: 'Túl sok publikálási kísérlet' }));
|
||||
return;
|
||||
}
|
||||
|
||||
// Command shape and result classification live in scripts/cms-publish.js
|
||||
// (WHY comments there): commit only when staged changes exist, rebase with
|
||||
// abort-on-failure, deterministic no-changes marker instead of output matching.
|
||||
exec(buildPublishCommand('content: frissítve a CMS-ből'), { cwd: CONTENT_DIR }, (error, stdout, stderr) => {
|
||||
isPublishing = false;
|
||||
res.writeHead(200, { 'Content-Type': 'application/json' });
|
||||
const outcome = interpretPublishResult(error, stdout, stderr);
|
||||
writeAudit('publish_finished', { clientAddress, user: CMS_USER, result: outcome.result });
|
||||
if (!outcome.ok) {
|
||||
res.end(JSON.stringify({ ok: false, error: outcome.error }));
|
||||
return;
|
||||
}
|
||||
// Deploy only when content actually changed — a no-op publish must not
|
||||
// trigger a rebuild. Deploy only the explicitly configured environment;
|
||||
// never default to production. Overridable for tests.
|
||||
if (outcome.hadChanges) {
|
||||
// WHY direct child instead of a detached `cmd &`: under the systemd unit's
|
||||
// hardening (NoNewPrivileges/PrivateTmp) the backgrounded grandchild died
|
||||
// silently (observed twice: stale site after a publish). A direct child is
|
||||
// not detached, runs to completion, and the callback turns the audit entry
|
||||
// into a real "deploy finished/failed" signal. The HTTP response is already
|
||||
// sent; deploy output goes to deploy.log so the pipes stay quiet.
|
||||
const deployCmd = process.env.CONTENT_EDITOR_DEPLOY_CMD
|
||||
|| `cd ../../../ && ./deploy.sh ${CMS_DEPLOY_ENV} > deploy.log 2>&1`;
|
||||
writeAudit('deploy_spawned', { clientAddress, user: CMS_USER, env: CMS_DEPLOY_ENV });
|
||||
// WHY cwd: without it the child starts in the process working directory
|
||||
// (repo root), where `cd ../../../` lands on "/" — no write access, so
|
||||
// deploy.log creation failed with Permission denied and the deploy never
|
||||
// ran. CONTENT_DIR is the same base the git publish command uses.
|
||||
exec(deployCmd, { cwd: CONTENT_DIR, maxBuffer: 8 * 1024 * 1024 }, deployError => {
|
||||
writeAudit('deploy_exec_exit', {
|
||||
clientAddress,
|
||||
user: CMS_USER,
|
||||
result: deployError ? 'error' : 'ok',
|
||||
error: deployError ? String(deployError.message).slice(0, 300) : undefined,
|
||||
});
|
||||
});
|
||||
}
|
||||
res.end(JSON.stringify({ ok: true, output: outcome.output }));
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// GET /versions + POST /restore — handled in scripts/cms-versions.js.
|
||||
if (handleVersionRoutes({
|
||||
req, res, u, activeFile,
|
||||
backupDir: BACKUP_DIR,
|
||||
currentFile: FILES[activeFile],
|
||||
validate: validateContent,
|
||||
writeAudit, clientAddress, user: CMS_USER,
|
||||
versionsPage: (fileKey, diff) => VERSIONS_PAGE(fileKey, FILE_LABELS[fileKey] || fileKey, listVersions(BACKUP_DIR, fileKey), diff, CSRF_TOKEN),
|
||||
})) return;
|
||||
|
||||
// GET /branding + POST /logo — handled in scripts/cms-logo.js.
|
||||
if (handleLogoRoutes({
|
||||
req, res, u,
|
||||
publicDir: path.join(__dirname, 'proto', 'public'),
|
||||
backupDir: BACKUP_DIR,
|
||||
writeAudit, clientAddress, user: CMS_USER,
|
||||
logoPage: () => LOGO_PAGE(CSRF_TOKEN),
|
||||
})) return;
|
||||
|
||||
// GET / — editor UI
|
||||
let message = null;
|
||||
let jsonData = '{}';
|
||||
try {
|
||||
jsonData = fs.readFileSync(FILES[activeFile], 'utf8').trim();
|
||||
} catch (e) {
|
||||
message = { type: 'err', text: 'Fájl olvasási hiba: ' + e.message };
|
||||
}
|
||||
// WHY: fingerprint of the file content at page load. The editor sends it back
|
||||
// on save (X-Content-Hash); a mismatch means the file changed since this tab
|
||||
// was opened (deploy, another tab, git) and a blind save would silently
|
||||
// overwrite those changes.
|
||||
const contentHash = crypto.createHash('sha256').update(jsonData).digest('hex');
|
||||
|
||||
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'no-store' });
|
||||
res.end(HTML(activeFile, jsonData, message, CSRF_TOKEN, FILE_LABELS, clientJs, contentHash, DEPLOY_VERSION));
|
||||
});
|
||||
|
||||
if (require.main === module) {
|
||||
if (!securityConfigIsValid()) {
|
||||
throw new Error('CMS_USER, CMS_PASS és érvényes CMS_DEPLOY_ENV nélkül a Content Editor nem indítható el.');
|
||||
}
|
||||
server.listen(PORT, '127.0.0.1', () => {
|
||||
writeAudit('startup', { version: DEPLOY_VERSION, env: CMS_DEPLOY_ENV });
|
||||
console.log(`\n✅ mozdIT Content Editor fut: http://localhost:${PORT} (v${DEPLOY_VERSION})\n`);
|
||||
console.log(' Szerkeszthető fájlok:');
|
||||
Object.entries(FILE_LABELS).forEach(([k, l]) => {
|
||||
const rel = k === 'common' ? 'common.json' : `pages/${k}.json`;
|
||||
console.log(` • ${l}: proto/src/content/${rel}`);
|
||||
});
|
||||
console.log('\n Ctrl+C a leállításhoz\n');
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
backupAndWriteAtomically,
|
||||
validateContent,
|
||||
hasValidCredentials,
|
||||
hasValidCsrfToken,
|
||||
getClientAddress,
|
||||
securityConfigIsValid,
|
||||
csrfToken: CSRF_TOKEN,
|
||||
};
|
||||
@@ -42,8 +42,55 @@ fi
|
||||
echo "🔑 Környezeti változók betöltése ($ENV_FILE)..."
|
||||
|
||||
# WHY: a --env-file kapcsoló csak a compose változó-helyettesítését táplálja;
|
||||
# a shell nem látja belőle az APP_PORT-ot, ezért a healthcheckhez expliciten kiolvassuk.
|
||||
APP_PORT_VALUE="$(grep -E '^APP_PORT=' "$ENV_FILE" | tail -n 1 | cut -d= -f2- | tr -d '[:space:]' | tr -d '"' | tr -d "'")"
|
||||
# a shell nem látja belőle ezeket az értékeket, ezért a healthcheckhez és az
|
||||
# admin-seedeléshez expliciten kiolvassuk.
|
||||
env_value() {
|
||||
grep -E "^$1=" "$ENV_FILE" | tail -n 1 | cut -d= -f2- | tr -d '[:space:]' | tr -d '"' | tr -d "'"
|
||||
}
|
||||
APP_PORT_VALUE="$(env_value APP_PORT)"
|
||||
|
||||
# 2b. Indexelhetőségi őr — build ELŐTT (MITHOME-127)
|
||||
# WHY: a NEXT_PUBLIC_DEPLOY_ENV=staging build-változó noindex-et és mindent
|
||||
# tiltó robots.txt-t süt az image-be (MITHOME-116). Productionben ez csendben
|
||||
# kivenné az oldalt a Google-találatok közül, ezért ott meg sem építjük.
|
||||
if [ "$ENV" = "production" ] && grep -hsE '^[[:space:]-]*NEXT_PUBLIC_DEPLOY_ENV[=:][[:space:]]*"?staging' "$ENV_FILE" "$COMPOSE_FILE" > /dev/null; then
|
||||
echo "❌ Hiba: productionben NEXT_PUBLIC_DEPLOY_ENV=staging van beállítva ($ENV_FILE vagy $COMPOSE_FILE)."
|
||||
echo " Ez noindexelné az éles oldalt. Töröld a beállítást, és futtasd újra a deployt."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 2b2. Adatbázis-mentés — build ELŐTT (MITHOME-111, MITHOME-136)
|
||||
# WHY: a prodMigrations induláskor sémát módosíthat; egy hibás kiadás után
|
||||
# a deploy előtti mentésből kell tudni visszaállni. Ami fut, azt mentjük:
|
||||
# PostgreSQL (pg_dump, egyedi formátum) és — az átállás idejére — MongoDB.
|
||||
CONTAINER_ENV="$ENV"
|
||||
[ "$ENV" = "production" ] && CONTAINER_ENV="prod"
|
||||
BACKUP_DIR="$HOME/backups"
|
||||
STAMP="$(date +%Y%m%d-%H%M%S)"
|
||||
mkdir -p "$BACKUP_DIR" # shared directory: only our own files get chmod 600
|
||||
if docker ps --format '{{.Names}}' | grep -qx "mozdit-postgres-${CONTAINER_ENV}"; then
|
||||
PG_BACKUP="$BACKUP_DIR/mozdit-${ENV}-${STAMP}-pre-deploy.pgdump"
|
||||
PG_USER="$(env_value POSTGRES_USER)"
|
||||
docker exec "mozdit-postgres-${CONTAINER_ENV}" pg_dump -U "${PG_USER:-mozdit_web}" -Fc mozdit_web > "$PG_BACKUP"
|
||||
chmod 600 "$PG_BACKUP"
|
||||
echo "💾 PostgreSQL-mentés: $PG_BACKUP"
|
||||
fi
|
||||
if docker ps --format '{{.Names}}' | grep -qx "mozdit-mongodb-${CONTAINER_ENV}"; then
|
||||
MONGO_BACKUP="$BACKUP_DIR/mozdit-${ENV}-${STAMP}-pre-deploy.archive"
|
||||
docker exec "mozdit-mongodb-${CONTAINER_ENV}" sh -c 'mongodump --quiet --username "$MONGO_INITDB_ROOT_USERNAME" --password "$MONGO_INITDB_ROOT_PASSWORD" --authenticationDatabase admin --db mozdit --archive' > "$MONGO_BACKUP"
|
||||
chmod 600 "$MONGO_BACKUP"
|
||||
echo "💾 MongoDB-mentés: $MONGO_BACKUP"
|
||||
fi
|
||||
|
||||
# 2c. Port-ellenőrzés — build ELŐTT, hogy egy ütközés ne egy teljes build után
|
||||
# derüljön ki. A saját projekt (újraindítandó) konténerei által foglalt port
|
||||
# rendben van; minden más foglaltság hiba. Szabály: llmdev Docker-háttér
|
||||
# specifikáció, 5. pont (portregiszter).
|
||||
echo "🔌 Port-ellenőrzés ($COMPOSE_FILE)..."
|
||||
if ! ./scripts/check-ports.sh --env-file "$ENV_FILE" --compose "$COMPOSE_FILE"; then
|
||||
echo "❌ Hiba: portütközés — a deploy leállt, semmi nem épült újra."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 3. Docker konténerek újraépítése és indítása
|
||||
echo "🐳 Build és indítás..."
|
||||
@@ -53,15 +100,75 @@ docker compose --env-file "$ENV_FILE" -f "$COMPOSE_FILE" up --build --force-recr
|
||||
# 4. Healthcheck
|
||||
echo "⏳ Healthcheck (max 60s)..."
|
||||
HEALTH_URL="http://localhost:${APP_PORT_VALUE:-$DEFAULT_PORT}/api/health"
|
||||
HEALTHY=0
|
||||
for i in $(seq 1 30); do
|
||||
if curl -sf "$HEALTH_URL" > /dev/null 2>&1; then
|
||||
echo "✅ Healthcheck OK: $HEALTH_URL"
|
||||
echo "✅ Deploy sikeres: [$ENV]"
|
||||
exit 0
|
||||
HEALTHY=1
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "❌ Healthcheck sikertelen: $HEALTH_URL"
|
||||
docker compose -f "$COMPOSE_FILE" logs app --tail 50
|
||||
exit 1
|
||||
if [ "$HEALTHY" -ne 1 ]; then
|
||||
echo "❌ Healthcheck sikertelen: $HEALTH_URL"
|
||||
docker compose -f "$COMPOSE_FILE" logs app --tail 50
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 4b. Indexelhetőség ellenőrzése — deploy UTÁN (MITHOME-127)
|
||||
# Production: indexelhető kell legyen; staging: tiltott (MITHOME-116).
|
||||
EXPECTED_INDEXING="blocked"
|
||||
if [ "$ENV" = "production" ]; then
|
||||
EXPECTED_INDEXING="indexable"
|
||||
fi
|
||||
if ! ./scripts/check-indexability.sh "http://localhost:${APP_PORT_VALUE:-$DEFAULT_PORT}" "$EXPECTED_INDEXING"; then
|
||||
echo "❌ Az indexelhetőség nem az elvárt ($EXPECTED_INDEXING) — a deploy HIBÁS."
|
||||
if [ "$ENV" = "production" ]; then
|
||||
echo " Az éles oldal most keresőkből kizárt állapotban fut: állítsd vissza az előző kiadást (lásd .agent/workflows/deploy.md → Rollback)."
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 5. Payload admin felhasználó biztosítása (MITHOME-97 follow-up)
|
||||
#
|
||||
# WHY: minden friss adatbázisú deploy (első staging/prod indítás, vagy egy
|
||||
# volume-törlés utáni újrakezdés) a Payload "Create first user" képernyőjét
|
||||
# mutatná — valaki ott manuálisan hozná létre a saját fiókját, ami könnyen
|
||||
# elmarad vagy elfelejtődik, és ismeretlen/inkonzisztens admin-hozzáférést
|
||||
# eredményez környezetenként. Payload REST API-ja egy beépített
|
||||
# `POST /<usersCollection>/first-register` endpointot ad erre — DE csakis
|
||||
# akkor enged bármit létrehozni, ha a `users` collection még teljesen üres
|
||||
# (0 dokumentum); ha már van akár egy felhasználó is, 403 Forbidden-t ad.
|
||||
# Ez pont idempotenssé teszi: minden deploy után lefuttatjuk, első alkalommal
|
||||
# létrehozza az ismert admin fiókot ADMIN_EMAIL/ADMIN_PASSWORD alapján,
|
||||
# utána minden további deploy-on ártalmatlanul 403-at kap és kihagyja.
|
||||
ADMIN_EMAIL_VALUE="$(env_value ADMIN_EMAIL)"
|
||||
ADMIN_PASSWORD_VALUE="$(env_value ADMIN_PASSWORD)"
|
||||
if [ -z "$ADMIN_EMAIL_VALUE" ] || [ -z "$ADMIN_PASSWORD_VALUE" ]; then
|
||||
echo "⚠️ ADMIN_EMAIL/ADMIN_PASSWORD nincs beállítva $ENV_FILE-ban — admin-seedelés kihagyva."
|
||||
echo " (Egy teljesen friss adatbázisnál manuálisan kell létrehozni az első usert /admin alatt.)"
|
||||
else
|
||||
echo "👤 Admin felhasználó biztosítása..."
|
||||
ADMIN_HTTP_CODE="$(curl -sS -o /tmp/mozdit-admin-seed-response.json -w '%{http_code}' \
|
||||
-X POST "http://localhost:${APP_PORT_VALUE:-$DEFAULT_PORT}/api/users/first-register" \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-binary @- <<EOF
|
||||
{"email":"${ADMIN_EMAIL_VALUE}","password":"${ADMIN_PASSWORD_VALUE}"}
|
||||
EOF
|
||||
)"
|
||||
rm -f /tmp/mozdit-admin-seed-response.json
|
||||
case "$ADMIN_HTTP_CODE" in
|
||||
200)
|
||||
echo "✅ Admin felhasználó létrehozva ($ADMIN_EMAIL_VALUE)."
|
||||
;;
|
||||
403)
|
||||
echo "✅ Admin felhasználó már létezik — nincs teendő."
|
||||
;;
|
||||
*)
|
||||
echo "⚠️ Admin-seedelés váratlan válasza: HTTP $ADMIN_HTTP_CODE (a deploy egyébként sikeres, ez nem állítja meg)."
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo "✅ Deploy sikeres: [$ENV]"
|
||||
|
||||
+25
-40
@@ -1,5 +1,3 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# Next.js Application
|
||||
app:
|
||||
@@ -12,59 +10,45 @@ services:
|
||||
- "127.0.0.1:8080:3000"
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
# WHY authSource=admin: the mongodb service below only creates a root
|
||||
# user (via MONGO_INITDB_ROOT_USERNAME/PASSWORD), which forces --auth
|
||||
# on the mongod process — an unauthenticated URI fails every query
|
||||
# with "Command find requires authentication" (MITHOME-98).
|
||||
- MONGODB_URI=mongodb://admin:password123@mongodb:27017/mozdit?authSource=admin
|
||||
- MONGODB_DB=mozdit
|
||||
# MITHOME-136: PostgreSQL; dev-only, not secret credentials.
|
||||
- DATABASE_URI=postgresql://mozdit_web:devpassword@postgres:5432/mozdit_web
|
||||
# Dev-only, nem titkos (MITHOME-97) — Payload ez nélkül el sem indul
|
||||
# ("missing secret key"), és ez a compose fájl eddig nem adta át.
|
||||
- PAYLOAD_SECRET=dev-only-insecure-secret-do-not-use-in-staging-or-prod
|
||||
- NEXT_PUBLIC_SITE_URL=http://localhost:8080
|
||||
- NEXT_PUBLIC_COMPANY_NAME=mozdIT Bt.
|
||||
- NEXT_PUBLIC_CONTACT_EMAIL=info@mozdit.hu
|
||||
- NEXT_PUBLIC_WEBMAIL_URL=https://mail.mozdit.hu
|
||||
- LOKI_HOST=http://loki:3100
|
||||
volumes:
|
||||
- ./proto:/app
|
||||
- /app/node_modules
|
||||
- /app/.next
|
||||
command: npm run dev
|
||||
depends_on:
|
||||
- mongodb
|
||||
- loki
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- mozdit-network
|
||||
restart: unless-stopped
|
||||
|
||||
# MongoDB Database
|
||||
mongodb:
|
||||
image: mongo:7.0
|
||||
container_name: mozdit-mongodb-dev
|
||||
# PostgreSQL (MITHOME-136). Host port 5433 is registered in the llmdev port
|
||||
# registry (5432 is peakxi-dev) — for the integration tests and local tools.
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
container_name: mozdit-postgres-dev
|
||||
ports:
|
||||
- "127.0.0.1:27018:27017"
|
||||
- "127.0.0.1:5433:5432"
|
||||
environment:
|
||||
- MONGO_INITDB_ROOT_USERNAME=admin
|
||||
- MONGO_INITDB_ROOT_PASSWORD=password123
|
||||
- MONGO_INITDB_DATABASE=mozdit
|
||||
- POSTGRES_DB=mozdit_web
|
||||
- POSTGRES_USER=mozdit_web
|
||||
- POSTGRES_PASSWORD=devpassword
|
||||
volumes:
|
||||
- mongodb_data:/data/db
|
||||
- ./docker/mongodb/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
|
||||
networks:
|
||||
- mozdit-network
|
||||
restart: unless-stopped
|
||||
|
||||
# MongoDB Express (Web UI)
|
||||
mongo-express:
|
||||
image: mongo-express:1.0.2
|
||||
container_name: mozdit-mongo-express-dev
|
||||
ports:
|
||||
- "127.0.0.1:8081:8081"
|
||||
environment:
|
||||
- ME_CONFIG_MONGODB_ADMINUSERNAME=admin
|
||||
- ME_CONFIG_MONGODB_ADMINPASSWORD=password123
|
||||
- ME_CONFIG_MONGODB_URL=mongodb://admin:password123@mongodb:27017/
|
||||
- ME_CONFIG_BASICAUTH=false
|
||||
depends_on:
|
||||
- mongodb
|
||||
- postgres_data_dev:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U mozdit_web -d mozdit_web"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- mozdit-network
|
||||
restart: unless-stopped
|
||||
@@ -87,7 +71,8 @@ services:
|
||||
image: grafana/grafana:10.2.0
|
||||
container_name: mozdit-grafana-dev
|
||||
ports:
|
||||
- "127.0.0.1:3001:3000"
|
||||
# MITHOME-137: 3001 is taken by "step" on llmdev (port registry)
|
||||
- "127.0.0.1:3012:3000"
|
||||
environment:
|
||||
- GF_SECURITY_ADMIN_PASSWORD=admin123
|
||||
volumes:
|
||||
@@ -100,7 +85,7 @@ services:
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
mongodb_data:
|
||||
postgres_data_dev:
|
||||
driver: local
|
||||
loki_data:
|
||||
driver: local
|
||||
|
||||
+57
-7
@@ -13,16 +13,30 @@ services:
|
||||
- "127.0.0.1:8080:3000" # Belső port — csak nginx reverse proxy-n keresztül elérhető
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
# No fallback for MONGODB_URI: with root auth enabled on the Mongo container an
|
||||
# unauthenticated default URI would silently break the app — fail loudly instead.
|
||||
- MONGODB_URI=${MONGODB_URI}
|
||||
- MONGODB_DB=${MONGODB_DB:-mozdit}
|
||||
# MITHOME-136: PostgreSQL (the site's own database on the shared server).
|
||||
# Built from POSTGRES_PASSWORD so the secret lives in one place; no
|
||||
# fallback — a missing password must fail the deploy loudly. Use a
|
||||
# URL-safe password (e.g. `openssl rand -hex 32`).
|
||||
- DATABASE_URI=postgresql://${POSTGRES_USER:-mozdit_web}:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}@postgres:5432/mozdit_web
|
||||
# No fallback either (MITHOME-97): Payload refuses to start without a real
|
||||
# secret ("missing secret key"), which is exactly what we want here.
|
||||
- PAYLOAD_SECRET=${PAYLOAD_SECRET}
|
||||
- NEXT_PUBLIC_SITE_URL=${NEXT_PUBLIC_SITE_URL:-https://mozdit.hu}
|
||||
- NEXT_PUBLIC_COMPANY_NAME=${NEXT_PUBLIC_COMPANY_NAME:-mozdIT Bt.}
|
||||
- NEXT_PUBLIC_CONTACT_EMAIL=${NEXT_PUBLIC_CONTACT_EMAIL:-info@mozdit.hu}
|
||||
- LOKI_HOST=${LOKI_HOST:-http://loki:3100}
|
||||
volumes:
|
||||
# Payload helyi upload storage — lásd docker-compose.staging.yml azonos
|
||||
# kommentjét (MITHOME-97).
|
||||
- media_data_prod:/app/media
|
||||
depends_on:
|
||||
- mongodb
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3000/api/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
networks:
|
||||
- mozdit-network
|
||||
restart: always
|
||||
@@ -32,7 +46,39 @@ services:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
# MongoDB Database
|
||||
# PostgreSQL (MITHOME-136) — llmdev Docker spec: healthcheck, log limit,
|
||||
# memory limit, no host port (the app reaches it on the project network).
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
container_name: mozdit-postgres-prod
|
||||
environment:
|
||||
- POSTGRES_DB=mozdit_web
|
||||
- POSTGRES_USER=${POSTGRES_USER:-mozdit_web}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
|
||||
volumes:
|
||||
- postgres_data_prod:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-mozdit_web} -d mozdit_web"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 20s
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 1G
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "100m"
|
||||
max-file: "3"
|
||||
networks:
|
||||
- mozdit-network
|
||||
restart: unless-stopped
|
||||
|
||||
# MongoDB — MITHOME-136: no longer used by the app. Kept for one release as
|
||||
# the rollback path and the source of the one-off content transfer
|
||||
# (proto/scripts/transfer-content.ts); remove afterwards (tasks 4.3).
|
||||
mongodb:
|
||||
image: mongo:7.0
|
||||
container_name: mozdit-mongodb-prod
|
||||
@@ -50,8 +96,12 @@ services:
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
postgres_data_prod:
|
||||
driver: local
|
||||
mongodb_data_prod:
|
||||
driver: local
|
||||
media_data_prod:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
mozdit-network:
|
||||
|
||||
@@ -14,17 +14,33 @@ services:
|
||||
- "127.0.0.1:8081:3000" # Belső port — csak nginx-en keresztül elérhető
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
# No fallback for MONGODB_URI: with root auth enabled on the Mongo container an
|
||||
# unauthenticated default URI would silently break the app — fail loudly instead.
|
||||
- MONGODB_URI=${MONGODB_URI}
|
||||
- MONGODB_DB=${MONGODB_DB:-mozdit}
|
||||
# MITHOME-136: PostgreSQL (the site's own database on the shared server).
|
||||
# Built from POSTGRES_PASSWORD so the secret lives in one place; no
|
||||
# fallback — a missing password must fail the deploy loudly. Use a
|
||||
# URL-safe password (e.g. `openssl rand -hex 32`).
|
||||
- DATABASE_URI=postgresql://${POSTGRES_USER:-mozdit_web}:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}@postgres:5432/mozdit_web
|
||||
# No fallback either (MITHOME-97): Payload refuses to start without a real
|
||||
# secret ("missing secret key"), which is exactly what we want here.
|
||||
- PAYLOAD_SECRET=${PAYLOAD_SECRET}
|
||||
- NEXT_PUBLIC_SITE_URL=${NEXT_PUBLIC_SITE_URL:-https://stage.mozdit.hu}
|
||||
- NEXT_PUBLIC_DEPLOY_ENV=staging
|
||||
- NEXT_PUBLIC_COMPANY_NAME=${NEXT_PUBLIC_COMPANY_NAME:-mozdIT Bt.}
|
||||
- NEXT_PUBLIC_CONTACT_EMAIL=${NEXT_PUBLIC_CONTACT_EMAIL:-info@mozdit.hu}
|
||||
- LOKI_HOST=${LOKI_HOST:-http://loki:3100}
|
||||
volumes:
|
||||
# Payload helyi upload storage (proto/src/collections/Media.ts) — futásidőben
|
||||
# a konténer WORKDIR-je (/app) alatti media/ mappába ír. Named volume nélkül
|
||||
# a `deploy.sh` minden újratelepítéskor (--force-recreate) elveszítené a
|
||||
# korábban feltöltött logókat/képeket (MITHOME-97).
|
||||
- media_data_staging:/app/media
|
||||
depends_on:
|
||||
- mongodb
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3000/api/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
networks:
|
||||
- mozdit-network-staging
|
||||
restart: always
|
||||
@@ -34,7 +50,39 @@ services:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
# MongoDB Database (külön a prod-tól)
|
||||
# PostgreSQL (MITHOME-136) — llmdev Docker spec: healthcheck, log limit,
|
||||
# memory limit, no host port (the app reaches it on the project network).
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
container_name: mozdit-postgres-staging
|
||||
environment:
|
||||
- POSTGRES_DB=mozdit_web
|
||||
- POSTGRES_USER=${POSTGRES_USER:-mozdit_web}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
|
||||
volumes:
|
||||
- postgres_data_staging:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-mozdit_web} -d mozdit_web"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 20s
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 1G
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "100m"
|
||||
max-file: "3"
|
||||
networks:
|
||||
- mozdit-network-staging
|
||||
restart: unless-stopped
|
||||
|
||||
# MongoDB — MITHOME-136: no longer used by the app. Kept for one release as
|
||||
# the rollback path and the source of the one-off content transfer
|
||||
# (proto/scripts/transfer-content.ts); remove afterwards (tasks 4.3).
|
||||
mongodb:
|
||||
image: mongo:7.0
|
||||
container_name: mozdit-mongodb-staging
|
||||
@@ -52,8 +100,12 @@ services:
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
postgres_data_staging:
|
||||
driver: local
|
||||
mongodb_data_staging:
|
||||
driver: local
|
||||
media_data_staging:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
mozdit-network-staging:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -38,7 +38,7 @@ A teszt egy beágyazott tömböket és objektumokat, valamint string-, boolean-
|
||||
|
||||
## Szerveroldali védelmi réteg
|
||||
|
||||
A `MITHOME-41` részeként a `proto/src/content/schema.js` az összes szerkeszthető content-fájl kötelező mezőit, típusait és megengedett kulcsait írja le. A Next.js loader és a Content Editor ezt az egy közös validátort használja.
|
||||
A `MITHOME-41` részeként a `proto/src/content/schema.cjs` az összes szerkeszthető content-fájl kötelező mezőit, típusait és megengedett kulcsait írja le. A Next.js loader és a Content Editor ezt az egy közös validátort használja.
|
||||
|
||||
A mentés csak sikeres validáció után történik. Az Editor legfeljebb 256 KiB-os request body-t fogad; hibás JSON vagy sémahiba `422` választ ad, és az eredeti fájlt érintetlenül hagyja. Érvényes mentéskor:
|
||||
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
# mozdIT — Felhasználói útmutató
|
||||
|
||||
Ez az útmutató a mozdIT weboldalt és a hozzá tartozó **Content Editor** (CMS) felületet írja le nem műszaki felhasználóknak.
|
||||
|
||||
A dokumentum a repó része, és **folyamatosan karbantartott**: minden funkcióváltozásnál a fejlesztő frissíti. A CMS ❓ Súgó menüpontja ezt a fájlt jeleníti meg.
|
||||
|
||||
---
|
||||
|
||||
## 1. A weboldal
|
||||
|
||||
### Hol érhető el?
|
||||
|
||||
- **Staging (teszt) oldal**: [https://stage.mozdit.hu](https://stage.mozdit.hu) — itt ellenőrizhetők a friss változtatások éles környezetben, még a véglegesítés előtt.
|
||||
- A staging oldal tetején **sárga figyelmeztető sáv** jelzi, hogy tesztkörnyezetet látsz.
|
||||
|
||||
### Oldalak
|
||||
|
||||
- **Kezdőlap** — `https://stage.mozdit.hu/`
|
||||
- **Rólunk** — `/rolunk`
|
||||
- **Szolgáltatások** — `/szolgaltatasok`
|
||||
- **Kapcsolat** — `/kapcsolat` (űrlap, ami beérkező üzenetként tárolódik)
|
||||
- **Adatvédelmi tájékoztató** — `/adatvedelem`
|
||||
- **Felhasználási feltételek** — `/felhasznalasi-feltetelek`
|
||||
|
||||
### Hogyan változik a weboldal tartalma?
|
||||
|
||||
1. A szerkesztő a **Content Editorban** módosítja a szövegeket (2. fejezet).
|
||||
2. **💾 Mentés** — a módosítás elmentődik, azonnali biztonsági mentéssel.
|
||||
3. **🚀 Publikálás** — a változtatás bekerül a Git repóba, és automatikusan deployol a staging oldalra.
|
||||
4. Az éles (production) weboldalra a tartalom csak ellenőrzött, szándékos deploy lépéssel kerül fel — a CMS-ből soha nem publisholódik automatikusan productionre.
|
||||
|
||||
---
|
||||
|
||||
## 2. Content Editor (CMS)
|
||||
|
||||
### Belépés és kilépés
|
||||
|
||||
- A CMS a kiadott címen érhető el (staging: `https://cms.stage.llmdev.mozdit.hu`).
|
||||
- **Bejelentkezés**: a logós bejelentkező oldalon add meg a **felhasználónevet és jelszót** (ezt az adminisztrátor adja), majd kattints a Belépés gombra.
|
||||
- Több **sikertelen próbálkozás** (5) után a belépés kb. 15 percre zárolásra kerül.
|
||||
- A belépés **8 óráig érvényes** — ezután a CMS visszairányít a bejelentkező oldalra, ahol újra meg kell adni a jelszót.
|
||||
- **🚪 Kilépés**: az alsó sáv gombja — egy megerősítő kérdés („Biztosan ki szeretnél lépni?") után kijelentkezel, és megjelenik a bejelentkező oldal.
|
||||
|
||||
### Felület áttekintés
|
||||
|
||||
- **Fájl fülek** (felül): oldalankénti tartalom — Kezdőlap, Rólunk, Szolgáltatások, Kapcsolat, jogi oldalak, közös szövegek.
|
||||
- **Szerkesztőfelület**: a kiválasztott oldal összes szerkeszthető mezője.
|
||||
- **Alsó sáv**: 💾 Mentés, 🚀 Publikálás, 🔗 Előnézet, ❓ Súgó, 🚪 Kilépés, valamint a **futó verzió** (pl. `va7b1a2c`) — ha a fejlesztő megkér, hogy ellenőrizd a verziót, ezt a jelölést mondd neki.
|
||||
|
||||
### Szöveg szerkesztése
|
||||
|
||||
- A mezők fölötti **útvonal** (pl. `hero.title`) jelzi, hol jelenik meg a szöveg az oldalon.
|
||||
- Mezőtípusok:
|
||||
- **Egysoros / több soros szövegmező** — általános szöveg; a hosszabb szöveg automatikusan nagyobb mezőben szerkeszthető.
|
||||
- **Jelölőnégyzet** — be/ki (igen/nem) érték.
|
||||
- **Számmező** — numerikus érték.
|
||||
- A módosítás **nem kerül azonnal az oldalra** — ahhoz Mentés, majd Publikálás kell.
|
||||
|
||||
### Listák szerkesztése
|
||||
|
||||
- Lista elem (pl. egy jelszó, egy szolgáltatás tulajdonság): **❌ gombbal törölhető**.
|
||||
- **➕ Új elem hozzáadása** gomb: új elem beszúrása a lista végére (üres, a meglévőkhöz hasonló űrlappal).
|
||||
- Kártyás listáknál (pl. szolgáltatások) minden kártya külön törölhető a kártya alján lévő gombbal.
|
||||
|
||||
### 🎨 Logó kezelése
|
||||
|
||||
- Az alsó sáv **🎨 Logó** gombja megnyitja a logókezelő oldalt.
|
||||
- Két logó cserélhető: a **weboldal fejléclogója** (szöveges) és a **CMS bejelentkező oldal ikonja**.
|
||||
- **Partner logó feltöltése**: ugyanitt — a fájlnév megadása után a feltöltött PNG a `/partners/…` elérési útra kerül; ezt az utat másold a partner **logo** mezőjébe.
|
||||
- Csak **PNG**, max. **1 MB**; ajánlott átlátszó háttér a sötét fejléchez.
|
||||
- A régi logó mentésre kerül — a csere biztonságos és visszavonható (a mentések a `.content-backups` mappában).
|
||||
- A **CMS azonnal** az új logót mutatja; a **weboldalon a Publikálás (deploy) után** jelenik meg.
|
||||
|
||||
### 🤝 Partnerek
|
||||
|
||||
- A kezdőlap **„Partnereink"** szekciója a Szolgáltatások alatt jelenik meg (logó + név + hivatkozás).
|
||||
- A **Kezdőlap** fülön a `partners.items` listában szerkeszthetők: `name` (név), `url` (hivatkozás), `logo` (elérési út, pl. `/partners/acme.png`).
|
||||
- Új logó: a **🎨 Logó** oldalon töltsd fel, a visszaadott utat illeszd a `logo` mezőbe.
|
||||
|
||||
### ⌨️ Gyorsbillentyűk
|
||||
|
||||
- **Ctrl/Cmd + S** — Mentés
|
||||
- **Ctrl/Cmd + P** — Publikálás
|
||||
- **Ctrl/Cmd + Shift + V** — Verziók panel megnyitása új fülön
|
||||
- **?** — gyorsbillentyű-súgó megjelenítése (Esc vagy kattintás zárja)
|
||||
|
||||
A gyorsbillentyűk csak a szerkesztő főoldalán működnek; beviteli mezőben gépelve a normál karakterként viselkednek.
|
||||
|
||||
### 🕘 Verziók — korábbi állapotok
|
||||
|
||||
- Az alsó sáv **🕘 Verziók** gombja megnyitja az éppen szerkesztett fájl mentéseit (minden Mentés automatikus másolatot készít).
|
||||
- **⚖ Összehasonlítás**: megmutatja, mi változott az adott mentéshez képest (piros = a mentésben lévő régi szöveg, zöld = a jelenlegi).
|
||||
- **↩ Visszaállítás**: egy kattintással visszaállítja a mentést. A visszaállítás **előtt a jelenlegi tartalom is mentésre kerül**, tehát a visszaállítás is visszavonható.
|
||||
- A visszaállítás sémaillesztésen megy át — hibás mentést nem lehet visszaállítani.
|
||||
- Visszaállítás után a nyitott szerkesztő fülek frissítést kérnek (a tartalom megváltozott).
|
||||
|
||||
### 💾 Mentés
|
||||
|
||||
- A Mentés **ellenőrzi a tartalmat**: hiányzó vagy rossz típusú mező esetén hibaüzenetet kapsz, és a mentés nem történik meg — az oldal így nem tud elromlani.
|
||||
- **Ha a tartalom megváltozott, mióta a lapot megnyitottad** (pl. közben deploy történt vagy egy másik fülben mentett valaki), a Mentés figyelmeztet: ilyenkor döntsd el, hogy frissíted a lapot az új tartalomra (a szerkesztésed elvész), vagy megszakítod. Ezzel a védelemmel nem írható véletlenül felül senki módosítása.
|
||||
- Minden sikeres mentés **biztonsági mentést** készít a szerveren (`.content-backups/`), és naplózza a műveletet.
|
||||
- Ha a Mentés sikeres, a mentett állapotot **Előnézet** gombbal nézheted meg a staging oldalon.
|
||||
|
||||
### 🚀 Publikálás
|
||||
|
||||
- A Publikálás **commitolja és feltolja** a változtatásokat, majd elindítja a staging deployt.
|
||||
- „Nincs új változtatás." üzenet: nincs új mentett változtatás — ez **nem hiba**, ilyenkor deploy sem indul.
|
||||
- A publikálás korlátozva van (3 próbálkozás / 15 perc) a véletlen tömeges deploy elkerülésére.
|
||||
- A deploy eltarthat 1-2 percig; az eredményt az Előnézet gombbal ellenőrizheted.
|
||||
|
||||
### Biztonság
|
||||
|
||||
- Több **sikertelen belépési kísérlet** után a rendszer átmenetileg letiltja a belépést a gépedről (kb. 15 percre).
|
||||
- Minden mentés és publikálás **naplózva** van (audit log) a nyomonkövethetőség érdekében.
|
||||
|
||||
---
|
||||
|
||||
## Karbantartás (fejlesztőknek)
|
||||
|
||||
- Forrás: `docs/felhasznaloi-utmutato.md` — a CMS a `/guide` útvonalon rendereli ki.
|
||||
- **Szabály**: minden CMS- vagy honlapfunkció változásnál frissítsd ezt a fájlt ugyanabban a commitban.
|
||||
- Az útmutató támogatott formátuma: címsorok, **félkövér**, `kód`, listák, linkek, elválasztó vonalak.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
+3
-2
@@ -22,8 +22,9 @@ Ezek a következő javasolt lépések a soron következő sessionre:
|
||||
* WCAG 2.1 Akadálymentesítési szabályok érvényesítése (pl. kontrasztarányok az új kék-narancs logóhoz, ARIA címkék az ikonoknál).
|
||||
|
||||
## 4. Observability / Monitoring (MITHOME-17, MITHOME-21)
|
||||
* A meglévő Loki / Grafana stackhez bekötni egy professzionális szerver-oldali loggert (pl. `winston` vagy `pino`).
|
||||
* Az `/api/contact` e-mail küldési hibák és az oldalletöltési (traffic) logok strukturált naplózása, riasztások (Alerts) beállítása.
|
||||
* A MITHOME-17 az alkalmazás szerveroldali hibáit Winstonon keresztül strukturáltan stdout/stderr-re írja; productionben JSON formátumban.
|
||||
* A Hosting-szintű collector külön feladatként gyűjtse az ISPConfig partner-vhostok, a Docker-konténerek és a host logjait, és továbbítsa azokat a központi Loki/Grafana rendszerbe.
|
||||
* A MITHOME-21 feladata lehet az alkalmazásoldali forgalmi eseménynaplózás és riasztások meghatározása; request body-k és személyes kapcsolatfelvételi adatok nem kerülhetnek a logokba.
|
||||
|
||||
## 5. Analitika (MITHOME-26)
|
||||
* Weboldal forgalom mérésének beállítása (Javasolt: GDPR-barát, cookie mentes `Plausible Analytics` vagy Google Analytics 4 alapú integráció).
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# nginx vhost-ok (szerveroldali, nincs git-ben verziózva)
|
||||
|
||||
> Ez a fájl **dokumentáció, nem forrás** — a tényleges konfiguráció a
|
||||
> szerveren (`sadmin@llmdev.mozdit.hu`) él, `/etc/nginx/sites-available/`
|
||||
> alatt, ott kell szerkeszteni és `nginx -t` + `systemctl reload nginx`-szel
|
||||
> érvényesíteni. Ez a projekt nem tart fenn saját IaC-t/Ansible-t az
|
||||
> nginx-hez; ez a dokumentum azért létezik, hogy a vhost-ok célja és
|
||||
> létezése ne csak a szerver `/etc/nginx/`-jében legyen fellelhető (lásd
|
||||
> MITHOME-97 follow-up: egy elárvult, régi CMS-re mutató vhost tanúsítványa
|
||||
> okozott zavaró Firefox biztonsági figyelmeztetést, mert semmilyen
|
||||
> dokumentáció nem jelezte a létezését).
|
||||
|
||||
A szerver (`llmdev.mozdit.hu`) **több, egymástól független projektet is
|
||||
kiszolgál** (pl. `n8n.llmdev.mozdit.hu`, `gradia.hu`, `tippom-stage` stb.) —
|
||||
ez a dokumentum csak a **websitedev / mozdIT** projekthez tartozó
|
||||
vhost-okat írja le.
|
||||
|
||||
## `stage.mozdit.hu`
|
||||
|
||||
A publikus staging weboldal — `docker-compose.staging.yml` `app` service,
|
||||
`127.0.0.1:8081` felé proxyz. Ez a kanonikus staging URL.
|
||||
|
||||
## `cms.stage.llmdev.mozdit.hu`
|
||||
|
||||
Kényelmi URL a Payload admin felülethez, **ugyanarra a staging
|
||||
app-konténerre** proxyzva (`127.0.0.1:8081`) — nem külön szolgáltatás, nem
|
||||
külön adatbázis.
|
||||
|
||||
- `/` → 302 redirect `/admin`-ra
|
||||
- `/admin`, `/api/`, `/_next/` → proxyzva a staging app-ra
|
||||
- minden más (publikus oldalak) → 302 redirect `https://stage.mozdit.hu`-ra
|
||||
(nincs duplikált tartalom a két domain alatt)
|
||||
|
||||
TLS: Certbot-kezelt Let's Encrypt tanúsítvány, saját magára a
|
||||
`cms.stage.llmdev.mozdit.hu` névre kiállítva.
|
||||
|
||||
**Történet**: ez a vhost eredetileg a régi, egyedi CMS-nek
|
||||
(`content-editor.js`, `127.0.0.1:4001`) szólt. Miután a CMS-t leépítettük
|
||||
(MITHOME-93) és a `mozdit-content-editor.service`-t leállítottuk/letiltottuk,
|
||||
a vhost egy ideig egy halott backendre mutatott, és tanúsítványa lett az
|
||||
nginx véletlenszerű fallback-je más, nem konfigurált `*.mozdit.hu`
|
||||
albdomainekre (pl. elgépelt URL-ekre) — ez okozott egy valódinak tűnő, de
|
||||
ártalmatlan Firefox "site could be impersonating" figyelmeztetést. A vhost-ot
|
||||
2026-09-11-én átállítottuk a Payload admin felé (lásd fent).
|
||||
|
||||
## Production megfelelő (ha/amikor lesz)
|
||||
|
||||
Ha production is élesedik, érdemes ugyanezt a mintát követni: egy
|
||||
`cms.mozdit.hu` (vagy hasonló) vhost, ugyanazzal a proxy-scope-pal
|
||||
(`/admin`, `/api/`, `/_next/`), a production app portjára (8080) mutatva.
|
||||
@@ -0,0 +1,197 @@
|
||||
# Termékkör és szerverkapacitás — a weboldal állításainak összevetése az éles környezettel
|
||||
|
||||
**Dátum:** 2026-09-29 · **Forrás:** a felhasználó által hozott éles környezeti elemzés (iron.mozdit.hu, 81.2.198.30), valamint a weboldal jelenlegi, élő (staging) tartalma.
|
||||
**Cél:** a weboldalon hirdetett termékkör pontosan annyit ígérjen, amennyit az éles szerver ténylegesen nyújt.
|
||||
|
||||
> **Döntés (tulajdonos, 2026-09-29):** a weboldalon egyelőre **csak a mIT Start és a mIT Mid** csomagot kínáljuk. A nagyobb csomagok (mIT Pro, mIT Pro Plus) nem szerepelnek. A csomagnevek a PLATFM-3 (központi termékkatalógus) szerintiek. Az elemzés „Start/Business/Pro/Managed” munkanevei ennek megfelelően: Start → **mIT Start**, Business → **mIT Mid**; a Pro és a Managed most nem termék.
|
||||
|
||||
> Ez a dokumentum **döntés-előkészítő**. A szerverre nem léptünk be, a hardveradatokat az elemzésből vettük át. Ami ellenőrzésre szorul, azt a 6. fejezet nyitott kérdésként sorolja fel.
|
||||
|
||||
---
|
||||
|
||||
## 1. Összefoglaló
|
||||
|
||||
- **A szerver erőforrásai:** a RAM bőséges (31 GB), a sávszélesség is (1 Gbps, 100 TB/hó), a CPU közepes (Xeon E3-1231 v3, 4 mag / 8 szál). A **tárhely a szűk keresztmetszet**: kb. 350–380 GB osztható ki. Ez kvótázott csomagokat indokol. Az elemzés négy szintet javasolt (2–50 GB); a döntés szerint egyelőre csak a két kisebb kerül kínálatba: **mIT Start** (2–3 GB) és **mIT Mid** (5–8 GB).
|
||||
- **A weboldal jelenleg többet ígér**, mint amit ez a termékkör lefed. Ezek egy része jogi szövegben (ÁSZF) áll:
|
||||
- „garantált 99,9%”;
|
||||
- „SSD tárhely 1 GB-tól 100 GB-ig”;
|
||||
- „korlátlan adatforgalom”;
|
||||
- „1–20 GB e-mail-tárhely fiókonként”;
|
||||
- „PHP, Python, Node.js, MySQL/PostgreSQL”;
|
||||
- „DNSSEC”, „API-hozzáférés”.
|
||||
- **Az elemzés is javításra szorul** néhány ponton: a memóriaszámítás, a levélkvóta-figyelmeztetés módja, a túlallokálás és a mentések viszonya, valamint az egyetlen szerver miatti rendelkezésre állás (lásd 2. fejezet).
|
||||
- **Javaslat:**
|
||||
1. Először hangoljuk össze a weboldal állításait a valós termékkörrel, a jogi szövegekkel kezdve.
|
||||
2. Utána készüljön egy **„Csomagok”** aloldal a **mIT Start** és a **mIT Mid** csomaggal. Ez egyben a MITHOME-23 oldaltérképének legfontosabb eleme.
|
||||
|
||||
---
|
||||
|
||||
## 2. Az éles környezeti elemzés kritikai átnézése
|
||||
|
||||
| # | Az elemzés állítása | Észrevétel | Javaslat |
|
||||
|---|---|---|---|
|
||||
| E1 | „Akár 200–300 egyidejű PHP worker is kényelmesen elfér.” | A csomagok `pm.max_children × memory_limit` értékei **legrosszabb esetben** többszörösen meghaladják a 31 GB-ot. Egyetlen Pro oldal: 30 × 512 MB ≈ 15 GB. 50 Business oldal: 50 × 10 × 256 MB ≈ 125 GB. A `memory_limit` felső korlát, nem átlag: a tipikus worker 40–80 MB, ezért az átlagos eset valóban belefér. A kockázat a csúcs (kampány, bot-forgalom, egy elszabadult bővítmény). | Szerverszintű védelem: <br>• oldalankénti `max_children` a valós forgalomhoz;<br>• memória-riasztás (Monit/ntfy);<br>• a Pro csomagnál `max_children` 15–20 (a Pro most nem termék, lásd a döntést). <br>A csomagleírásban ne a worker-szám, hanem a „kiemelt erőforrás” legyen az ígéret. |
|
||||
| E2 | „A Postfix automatikusan figyelmezteti a usert 90%-nál.” | A Postfix ezt önmagában nem teszi meg. Postafiók-kvótát és kvótafigyelmeztetést ISPConfig alatt a **Dovecot** kezel (`quota` + `quota-warning` szkript). | Ellenőrizni, hogy a Dovecot quota-warning be van-e állítva. Ha nincs, fel kell venni az üzemeltetési teendők közé. |
|
||||
| E3 | Csomagszintű levélkvóta vs. fiókonkénti kvóta | Business: 5–10 fiók × 1–2 GB, de a csomag levélkvótája 3–4 GB. A fiókkvóták összege többszöröse a csomagkvótának. Ez működhet (a csomagkvóta a plafon), de hirdetésben félrevezető. | A weboldalon **csomagszintű** levéltárhelyet hirdessünk („összesen 4 GB, tetszőlegesen elosztva”), ne fiókonkéntit. |
|
||||
| E4 | Túlallokálás 1,8–2× → 60–80 Business fiók | A becslés ésszerű, de **a mentések helye nincs benne**. Ha a napi mentés ugyanarra a RAID-tömbre kerül, a hely gyorsabban fogy, és lemezhiba esetén az eredeti adat és a mentés is elveszhet. | Tisztázni: hová és milyen megőrzéssel mentünk (lásd 6. fejezet). Külső mentés nélkül a túlallokálás és a „napi mentés” ígérete együtt kockázatos. |
|
||||
| E5 | Rendelkezésre állás (az elemzés nem tárgyalja) | Egyetlen fizikai szerver, 2014-es platform (DDR3, E3 v3), egy RAID-vezérlő, failover nélkül. Az évi 99,9% kb. 8,8 óra leállást enged. Egy hardverhiba (táp, vezérlő, alaplap) ennél hosszabb kiesést is okozhat. | Garancia helyett **célt** hirdessünk (ahogy a főoldal már teszi). Az ÁSZF-ben csak akkor legyen garancia, ha mérjük, és van jogkövetkezménye (jóváírás). |
|
||||
| E6 | „A Microcache 90%-kal csökkenti a CPU-terhelést.” | Nagyságrendileg igaz a gyorsítótárazható, bejelentkezés nélküli oldalaknál. Webshop kosár- és pénztároldalain nem alkalmazható. | Termékígéretként ne szerepeljen, üzemeltetési eszköz marad. |
|
||||
| E7 | Tárhely típusa | A PERC H310 RAID-vezérlő nem árulja el, hogy a lemezek SSD-k vagy HDD-k. A weboldal „SSD”-t ígér. | Ellenőrizni (6. fejezet, K1). |
|
||||
|
||||
---
|
||||
|
||||
## 3. A weboldal jelenlegi állításai vs. a valós termékkör
|
||||
|
||||
A weboldal szövegei a Payload CMS-ben élnek. Az ügyfél az adminban javíthatja őket; a jogi oldalakat is.
|
||||
|
||||
| # | Jelenlegi állítás | Hol szerepel | Eltérés / kockázat | Javasolt irány | Döntés |
|
||||
|---|---|---|---|---|---|
|
||||
| W1 | „A szolgáltatások **garantált** rendelkezésre állása 99,9% éves szinten.” | ÁSZF, 2. pont | Jogi kötelezettségvállalás egyetlen szerverrel, mérés és jóváírási szabály nélkül. A főoldal közben csak „célt” mond: a kettő ellentmond egymásnak. | „99,9%-os éves rendelkezésre állási **cél**, tervezett karbantartás nélkül” mindenhol. Garancia csak mért SLA-val. | Tulajdonos + jogi átnézés |
|
||||
| W2 | „24/7 monitoring biztosítja … **közel 100%-os** rendelkezésre állását.” | Rólunk / Értékeink | Ellentmond a 99,9%-os célnak, és túlzó. | „Folyamatos felügyelet, gyors hibaelhárítás.” | Tulajdonos |
|
||||
| W3 | „**SSD** tárhely 1 GB-tól **100 GB**-ig” | Szolgáltatások / Web hosting | A csomagok 2–50 GB-osak, 100 GB-os csomag nincs. Az SSD nincs igazolva (E7). | A két kínált csomag mérete (mIT Start 3 GB, mIT Mid 8 GB). Az „SSD” csak igazolás után maradhat. | Tulajdonos |
|
||||
| W4 | „Havi adatforgalom: **korlátlan**” | Szolgáltatások | A szerver kerete 100 TB/hó, a felhasználás nem korlátlan. | „Bőséges adatforgalom, méltányos használat mellett (fair use).” | Tulajdonos |
|
||||
| W5 | „**1 GB–20 GB** tárhely fiókonként” (e-mail) | Szolgáltatások / E-mail | Az elemzés fiókonként 1–2 GB-ot és csomagszintű levélkvótát javasol (E3). | Csomagszintű levéltárhely a csomagtáblából. | Tulajdonos |
|
||||
| W6 | „Támogatjuk a PHP, **Python, Node.js** technológiákat és MySQL/**PostgreSQL** adatbázisokat.” | Szolgáltatások / Web hosting | A csomagterv csak PHP + MariaDB. A Python, a Node.js és a PostgreSQL nem része a megosztott tárhelynek. | „PHP (több verzió), MariaDB/MySQL”. A Python/Node/PostgreSQL egyik kínált csomagban sem szerepel, a mondatból törölni kell. | Tulajdonos |
|
||||
| W7 | „**DNSSEC** támogatás”, „**API** hozzáférés fejlesztőknek” | Szolgáltatások / DNS | Az elemzés nem említi. Nincs igazolva, hogy létezik. | Csak akkor maradjon, ha ténylegesen elérhető. | Tulajdonos (K3) |
|
||||
| W8 | „Gyors propagáció és megbízható névszerverek **világszerte**” | Szolgáltatások / DNS | A „világszerte” földrajzilag elosztott (anycast) névszervereket sugall. | A valós névszerver-elhelyezés szerint fogalmazni. | Tulajdonos (K4) |
|
||||
| W9 | „**Automatikus napi** biztonsági mentés”, „Backup és archiválás” | Szolgáltatások; ÁSZF | A mentés helye és megőrzése ismeretlen (E4). Az ÁSZF is ígéri. | A tényleges mentési rend (gyakoriság, megőrzés, hely) szerint. | Tulajdonos (K2) |
|
||||
| W10 | „Sürgős esetek: **azonnali** beavatkozás” | Szolgáltatások / Támogatás | A 24/7 azonnali reakció ügyeleti rendet feltételez. | Pl. „Sürgős hibák: kiemelt kezelés munkaidőben, üzemzavar esetén ügyelet” — a valós rend szerint. | Tulajdonos |
|
||||
| W11 | „Saját dedikált infrastruktúra”, „dedikáltan kezelt szerverinfrastruktúra” | Főoldal, Rólunk, Adatvédelem | Igaz: saját szerver. Rendben. | Maradhat. | — |
|
||||
|
||||
**Fontos:** a W1 és a W9 az ÁSZF-ben, a W11 az Adatvédelmi tájékoztatóban is szerepel. A jogi szöveg módosítása után az angol fordításukat újra kell validálni (MITHOME-113, kétmodelles validálás). Az angol AI-draft import csak a pontosan egyező magyar szövegeket tölti ki, ezért a megváltozott magyar mondatok angol változatát kézzel vagy a fordítási memória frissítésével kell pótolni.
|
||||
|
||||
---
|
||||
|
||||
## 4. Javasolt, weboldalon hirdethető termékkör
|
||||
|
||||
**Döntés szerint két csomag:** mIT Start és mIT Mid. A nevek a PLATFM-3-ból jönnek. A nevekre előzetes HU/EU védjegykutatás készült, de bevezetés előtt a tényleges árujegyzékkel védjegyjogászi vizsgálat kell, és a ® jel csak lajstromozás után használható.
|
||||
|
||||
A weboldalon a **vevő számára érthető** paramétereket érdemes hirdetni. A belső beállítások (PHP-FPM mód, worker-szám, memóriakorlát) üzemeltetési részletek, nem ígéretek.
|
||||
|
||||
| | **mIT Start** | **mIT Mid** ★ |
|
||||
|---|---|---|
|
||||
| Kinek | Bemutatkozó oldal, portfólió, kis forgalmú WordPress | Tipikus KKV céges weboldal napi céges levelezéssel |
|
||||
| Tárhely összesen | 3 GB | 8 GB |
|
||||
| ebből levelezés (csomagszinten) | 1 GB | 3–4 GB |
|
||||
| Domain | 1 | 1 (+ 2 alias) |
|
||||
| Adatbázis (MariaDB) | 1 | 2 |
|
||||
| E-mail fiók | 5-ig (2026-09-29: 3-ról emelve, PLATFM-14 D7) | 10-ig |
|
||||
| Ár (nettó/év, csak éves számlázás) | 14 900 Ft (bruttó 18 923 Ft) | 23 900 Ft (bruttó 30 353 Ft) |
|
||||
| Mentés, SSL, spam- és vírusszűrés | ✓ | ✓ |
|
||||
|
||||
- **Nagyobb igény** (webáruház, nagy forgalom, 8 GB feletti tárhely) most nem termék. A weboldalon legfeljebb egy „Nagyobb igénye van? Kérjen egyedi ajánlatot” CTA szerepeljen, csomagként nem.
|
||||
- **Árak (2026-09-29):** tulajdonosi döntés a PLATFM-14 B változata szerint (mitplatform `docs/plans/PLATFM-14-termekkatalogus-v0.md`): nettó ár + 27% ÁFA, csak éves számlázás, a domain nem része a csomagnak. Az árak forrása a mitplatform termékkatalógusa, nem ez az elemzés.
|
||||
- **Adatforrás:** a PLATFM-3 és a PLATFM-11 szerint a csomagadatok elsődleges forrása a központi termékkatalógus (Product Catalog), a honlap csak a publikált termékek publikus mezőit olvassa. Amíg a katalógus nincs kész, átmenetileg a Payload tárolhatja a két csomagot, de a PLATFM-3 `Product { id, slug, status, name, public, … }` szerkezetében, hogy később cserélhető legyen (MITHOME-130).
|
||||
- Az „SSD”, a „DNSSEC”, az „API” és a „világszerte” csak a 6. fejezet kérdéseinek tisztázása után kerüljön a táblába. A PLATFM-9 (piackutatás) a DNSSEC-et még csak tesztelendő termékhipotézisként kezeli.
|
||||
- **Kapacitás:** a két kis csomaggal a túlallokálás kockázata (E4) mérséklődik. A PLATFM-8 elve szerint (mért, fenntartható kapacitás, legfeljebb 60–70% tartós kihasználtság, tárhelynél és mentésnél óvatos túlallokálás) az értékesíthető darabszámot mérés alapján kell rögzíteni, nem az elemzés 1,8–2-szeres szorzójával.
|
||||
|
||||
---
|
||||
|
||||
## 5. A weboldal saját üzemeltetése ugyanezen a szerveren
|
||||
|
||||
A MITHOME-27/38 szerint a weboldal (Next.js + Payload) productionben natív Node.js/systemd alatt fut majd az ironon, a MITHOME-39 szerint közös, natív MongoDB-vel.
|
||||
|
||||
- **Erőforrás-becslés** (a staging tapasztalata alapján, nem mérés): Next.js-folyamat 300–500 MB RAM, MongoDB 1–2 GB (WiredTiger cache korlátozva), lemez 1–2 GB + a médiafeltöltések. Ez elhanyagolható a 31 GB RAM mellett.
|
||||
- **Figyelmet igényel:**
|
||||
- a MongoDB WiredTiger cache-ét explicit korlátozni kell, különben a RAM felét is lefoglalhatja;
|
||||
- a Mongo-mentések (MITHOME-40) ugyanúgy a véges lemezt terhelik, ezért a mentési célhelyet (E4) velük együtt kell tervezni.
|
||||
- **Kapcsolódó:** MITHOME-15 (Nginx/HTTPS), MITHOME-127 (indexelhetőségi őr), MITHOME-128 (Search Console).
|
||||
|
||||
---
|
||||
|
||||
## 6. Nyitott kérdések a tulajdonosnak / üzemeltetőnek
|
||||
|
||||
| # | Kérdés | Mit befolyásol |
|
||||
|---|---|---|
|
||||
| K1 | SSD-k vagy HDD-k vannak a PERC H310 mögött? Milyen RAID-szint? | W3 („SSD”), E4, E7 |
|
||||
| K2 | Hová mentünk (ugyanarra a tömbre, másik szerverre, külső tárhelyre), milyen gyakran, mennyi megőrzéssel? Volt-e visszaállítási próba? | W9, E4, ÁSZF, MITHOME-40, PLATFM-5 (BCDR) |
|
||||
| K3 | Elérhető-e ténylegesen a DNSSEC és valamilyen DNS/API-hozzáférés az ügyfeleknek? | W7 |
|
||||
| K4 | Hol futnak a névszerverek (egy helyen, több helyen, külső szolgáltatónál)? | W8 |
|
||||
| K5 | Van-e ügyeleti rend munkaidőn kívül, és mit vállalunk sürgős hibára? | W10 |
|
||||
| K6 | Vállalunk-e mért SLA-t jóváírással, vagy maradjon a „cél” megfogalmazás? | W1, W2 |
|
||||
| K7 | ~~Kell-e Python/Node.js/PostgreSQL-tárhely termékként?~~ Eldőlt: nem, csak mIT Start és mIT Mid. | W6 |
|
||||
| K8 | Be van-e állítva a Dovecot quota-warning? | E2 |
|
||||
|
||||
---
|
||||
|
||||
## 7. Javasolt feladatok
|
||||
|
||||
1. **MITHOME-129: szolgáltatási állítások összehangolása** a valós termékkörrel (W1–W10). Első a jogi szöveg (ÁSZF 99,9% garancia, mentés), utána a Szolgáltatások oldal. A módosított jogi szövegek angolját újra validálni kell (MITHOME-113).
|
||||
2. **MITHOME-130: „Csomagok” aloldal** a mIT Start és a mIT Mid csomaggal (4. fejezet), a PLATFM-3 katalógus-szerkezetével. Ez a MITHOME-23 oldaltérképének része, a 6. fejezet válaszai után.
|
||||
3. **Üzemeltetési pontosítások** az ironon: memória-/lemezriasztás, Dovecot quota-warning, mentési célhely. Ez nem a weboldal-projekt feladata, a Hosting-infrastruktúrához tartozik (PLATFM); ticket csak a tulajdonos jóváhagyásával nyílik.
|
||||
|
||||
---
|
||||
|
||||
## 8. A tulajdonos/üzemeltető válaszai (2026-09-29)
|
||||
|
||||
| # | Válasz | Hatás |
|
||||
|---|---|---|
|
||||
| K1 | **Enterprise SSD**, Dell PERC H310, **RAID 1** (tükrözés): egy lemez kiesése adatvesztés és leállás nélkül átvészelhető. | Az „SSD” állítás igaz, maradhat. A RAID nem mentés, ezért a szövegben a mentéstől külön kell kezelni. |
|
||||
| K2 | Mentés **fizikailag és hálózatilag független** szerverre (`salutem.mozdit.hu`): MariaDB naponta SQL dump, fájlok és levelezés naponta inkrementálisan (rsync), **7 napos megőrzés** (igény szerint heti/havi archívum). | A „napi mentés” igaz. Az „archiválás” hosszú távú megőrzést sugall, ez csak külön igényre van. **Ellenőrizendő (új, K9):** a `salutem` saját gép, vagy bérelt szerver egy szolgáltatónál? Ha bérelt, a bérbeadó adatfeldolgozó, és az Adatvédelmi tájékoztató 3. pontjában meg kell nevezni. |
|
||||
| K3 | **DNSSEC ki van kapcsolva.** Az ISPConfig API-ja **belső használatú**, ügyfél-API nincs. | A „DNSSEC támogatás” és az „API hozzáférés fejlesztőknek” így nem igaz. Legfeljebb „egyedi egyeztetés alapján” formában maradhat. |
|
||||
| K4 | NS1: `ns.mozdit.hu` (iron), NS2: `ns2.mozdit.hu` (`salutem`) — két független gép és alhálózat. | A „világszerte” túlzás. A redundáns elsődleges és másodlagos névszerver igaz. Megjegyzés: a `salutem` a mentési szerver és az NS2 is, ez egy közös kiesési pont. |
|
||||
| K5 | Ügyfélszolgálat munkaidőben (hétköznap 8–17). 0–24 automatizált felügyelet (Monit + külső figyelés) riasztással. Kritikus kiesésnél 0–24 beavatkozás, **best-effort**, tipikusan 2–4 órán belüli kezdéssel. | Az „azonnali beavatkozás” túlzás. A „24 órán belüli válasz” munkanapokra igaz. |
|
||||
| K6 | **Cél, nem garancia:** **99,5%** éves rendelkezésre állási cél, a bejelentett karbantartás és a vis maior kivételével. | A 99,9% mindenhol 99,5%-ra változik. Az ÁSZF-ben garancia helyett cél szerepel. |
|
||||
| K8 | A Dovecot kvótafigyelmeztetés **be van állítva**: 90%-nál értesítés; 100%-nál az új levél visszapattan a feladónak („Mailbox is full”). | Az E2 lezárva. A 90%-os figyelmeztetés hirdethető előny. |
|
||||
|
||||
**A javasolt szövegek stílusa:** a válaszokban javasolt mondatok („maximális adatbiztonság”, „villámgyors”) túlzó jelzőket használnak. Az alábbi lista ténymegállapításokra fogalmaz, összhangban a MITHOME-23 elvével (konkrétumok, nem jelzők).
|
||||
|
||||
---
|
||||
|
||||
## 9. Szövegcsere-lista (MITHOME-129)
|
||||
|
||||
A cserék a CMS-ben élő szövegeket érintik. A „Jelenlegi” oszlop a staging élő szövege. Az angol oszlop a fordítási memória (`en.json`) frissítéséhez kell: a megváltozott magyar mondatokhoz a mostani AI-draft angol **elavul**. A jogi oldalaknál (C15) az angolt újra validálni kell két modellel (MITHOME-113).
|
||||
|
||||
| # | Hely | Jelenlegi (hu) | Javasolt (hu) | Javasolt (en) |
|
||||
|---|---|---|---|---|
|
||||
| C1 | Főoldal › Webtárhely jellemző | Éves szinten 99,9%-os rendelkezésre állási cél, tervezett karbantartások kivételével | Éves szinten 99,5%-os rendelkezésre állási cél, az előre bejelentett karbantartások kivételével | 99.5% annual availability target, excluding pre-announced maintenance |
|
||||
| C2 | Rólunk › Értékeink › Megbízhatóság | 24/7 monitoring biztosítja szolgáltatásaink közel 100%-os rendelkezésre állását. | 0–24 órás automatizált felügyelet riasztással és gyors hibaelhárítással. | Round-the-clock automated monitoring with alerting and fast troubleshooting. |
|
||||
| C3 | Szolgáltatások › Web Hosting leírás | … SSD tárolással, automatikus biztonsági mentéssel és 24/7 monitoringgal. Támogatjuk a PHP, Python, Node.js technológiákat és MySQL/PostgreSQL adatbázisokat. | Weboldalak biztonságos és gyors üzemeltetése Enterprise SSD tárolással, hardveres RAID-1 tükrözéssel, napi külső mentéssel és 0–24 órás automatizált felügyelettel. PHP (több verzió) és MariaDB/MySQL adatbázis. | Secure, fast website hosting on enterprise SSD storage with hardware RAID-1 mirroring, daily off-site backups and round-the-clock automated monitoring. PHP (multiple versions) and MariaDB/MySQL databases. |
|
||||
| C4 | Szolgáltatások › Web Hosting specifikáció | SSD tárhely 1GB-tól 100GB-ig | Enterprise SSD tárhely: 3 GB (mIT Start) vagy 8 GB (mIT Mid) | Enterprise SSD storage: 3 GB (mIT Start) or 8 GB (mIT Mid) |
|
||||
| C5 | Szolgáltatások › Web Hosting specifikáció | Havi adatforgalom: korlátlan | Bőséges havi adatforgalom, méltányos használat mellett ⚠ *döntés kell (D2)* | Generous monthly traffic under fair use |
|
||||
| C6 | Szolgáltatások › Web Hosting specifikáció | Automatikus napi biztonsági mentés | Automatikus napi mentés független, külső mentési szerverre, 7 napos visszaállítással | Automatic daily backup to an independent off-site server, with 7-day restore |
|
||||
| C7 | Szolgáltatások › E-mail specifikáció | 1GB–20GB tárhelyet fiókként | Levéltárhely csomagszinten: 1 GB (mIT Start) vagy 4 GB (mIT Mid), szabadon elosztva a fiókok között ⚠ *döntés kell (D1)* | Mail storage per plan: 1 GB (mIT Start) or 4 GB (mIT Mid), freely shared between mailboxes |
|
||||
| C8 | Szolgáltatások › E-mail specifikáció | Backup és archiválás | Napi mentés, 7 napos visszaállítással | Daily backup with 7-day restore |
|
||||
| C9 | Szolgáltatások › E-mail specifikáció *(új elem)* | — | Automatikus figyelmeztetés 90%-os postafiók-telítettségnél | Automatic warning when a mailbox is 90% full |
|
||||
| C10 | Szolgáltatások › DNS leírás | … Gyors propagáció és megbízható névszerverek világszerte. | Teljes DNS-kezelés domainregisztrációval, átvitellel és szakszerű beállításokkal. Redundáns elsődleges és másodlagos névszerver két független szerveren. | Complete DNS management including domain registration, transfers and professional configuration. Redundant primary and secondary name servers on two independent servers. |
|
||||
| C11 | Szolgáltatások › DNS specifikáció | DNSSEC támogatás | DNSSEC egyedi egyeztetés alapján | DNSSEC on request |
|
||||
| C12 | Szolgáltatások › DNS specifikáció | API hozzáférés fejlesztőknek | Egyedi API-integráció egyeztetés alapján | Custom API integration on request |
|
||||
| C13 | Szolgáltatások › Támogatás › Sürgős esetek | Azonnali beavatkozás | 0–24 órás riasztás, a beavatkozás tipikusan 2–4 órán belül megkezdődik | 24/7 alerting; work typically starts within 2–4 hours |
|
||||
| C14a | Szolgáltatások › Támogatás › E-mail | 24 órán belüli válasz | Munkanapokon 24 órán belüli válasz | Reply within 24 hours on business days |
|
||||
| C14b | Szolgáltatások › Támogatás › Telefon | Munkaidőben elérhető | Hétköznap 8–17 óra között | Weekdays 8:00–17:00 |
|
||||
| C14c | Kapcsolat › Elérhetőség › E-mail | 24 órán belül válaszolunk | Munkanapokon 24 órán belül válaszolunk | We reply within 24 hours on business days |
|
||||
| C14d | Kapcsolat › GYIK | Email üzenetekre 24 órán belül, sürgős esetekben telefonon is elérhetők vagyunk. | Munkanapokon 24 órán belül válaszolunk. Kritikus üzemzavar esetén 0–24 órás riasztási és beavatkozási rend működik. | We reply within 24 hours on business days. For critical outages, a 24/7 alerting and response process is in place. |
|
||||
| C15 | **ÁSZF** 2. pont | A szolgáltatások garantált rendelkezésre állása 99,9% éves szinten. A szolgáltató automatikus biztonsági mentéseket végez, de javasolja … | A szolgáltatások éves rendelkezésre állási célja 99,5% (az előre bejelentett karbantartás és a vis maior kivételével); ez célkitűzés, nem garancia. A Szolgáltató naponta automatikus biztonsági mentést készít fizikailag független mentési szerverre, 7 napos megőrzéssel, de javasolja … ⚠ *jogi átnézés* | *(a jogi átnézés után fordítandó, kétmodelles validálással)* |
|
||||
| C16 | **Adatvédelmi tájékoztató** 3. pont | … alapvetően a mozdIT Bt. saját, dedikált infrastruktúráján tároljuk. Harmadik félnek csak jogszabályi kötelezettség alapján (pl. NAV …), illetve … regisztrátorok (pl. ISZT) felé. | Az adatokat a mozdIT Bt. által üzemeltetett dedikált szerveren tároljuk. A biztonsági mentések egy fizikailag független, szintén a mozdIT Bt. által üzemeltetett virtuális szerverre (VPS) kerülnek, amelynek fizikai infrastruktúráját a **MikroVPS [teljes cégnév, székhely]** biztosítja adatfeldolgozóként, az Európai Unió területén található adatközpontban. Ezen túl harmadik félnek csak jogszabályi kötelezettség alapján (pl. a NAV részére könyvelési okokból), illetve a domain-regisztrációs szolgáltatások keretében az illetékes regisztrátorok (pl. ISZT) felé továbbítunk adatot. ⚠ *cégadatok, DPA, jogi átnézés* | *(a jogi átnézés után fordítandó, kétmodelles validálással)* |
|
||||
|
||||
**Nyitott döntések:**
|
||||
- **D1 (eldöntve):** a mIT Mid levéltárhelye **4 GB**.
|
||||
- **D2:** a „bőséges havi adatforgalom, méltányos használat mellett” megfogalmazással került be (C5). Kifejezett döntés nem volt rá, az adminban átírható.
|
||||
- **K9 (megválaszolva):** a `salutem` a mozdIT által üzemeltetett **VPS**. Adminisztratívan saját, de a fizikai hardver és az adatközpont a VPS-szolgáltatóé. A bevett GDPR-gyakorlat szerint a szolgáltató így **adatfeldolgozó**, hiszen a mentésekben személyes adat van (levelezés, kapcsolatfelvétel, számlázás). Ezért a tájékoztatóban meg kell nevezni, és adatfeldolgozói szerződés (DPA) kell vele. A C16 ennek megfelelő szövegjavaslat, a végleges megfogalmazás jogi átnézést igényel.
|
||||
- **K10 (részben megválaszolva):** a mentési VPS a **MikroVPS**-nél van, az éles szerver (iron) a **FORPSI**-nál; **mindkét adatközpont az EU-n belül** van, így EU-n kívüli adattovábbítás nincs. Hiányzik még a két cég teljes neve és székhelye a tájékoztatóhoz, valamint hogy van-e velük **adatfeldolgozói szerződés (DPA)**. A MikroVPS-nél DPA kell. A FORPSI-nál a K11-től függ.
|
||||
- **K11 (megválaszolva):** az iron a FORPSI-nál **colocationben** van (saját hardver bérelt rackhelyen). Tiszta colocationnél, ahol a szolgáltató csak áramot, hűtést és hálózatot ad, és az adatokhoz nem fér hozzá, jellemzően nem adatfeldolgozó. A C16-ban ezért csak a MikroVPS szerepel adatfeldolgozóként. A végső minősítést a jogi átnézés adja.
|
||||
- **Megjegyzés:** a weboldal „Saját dedikált infrastruktúra” állítása az éles szerverre igaz marad. A mentési szerver VPS, ezért ha a szöveg a mentést is említi, ne „dedikált” jelzővel tegye.
|
||||
|
||||
**Átvitel (2026-09-29):** a C1–C14 a `20260929_service_claims` Payload-migrációval kerül a CMS-be. A migráció csak pontos magyar egyezésnél cserél, az angolt csak akkor, ha még a régi AI-draft. A csomagneveket (mIT Start/Mid) szándékosan nem írja a szövegbe, mert a bevezetésük előtt védjegyjogászi vizsgálat kell; névtelenül „3 GB vagy 8 GB, csomagtól függően” szerepel. A staging másolatán ellenőrizve: a túlzó állítások eltűntek, a jogi szövegek (C15–C16) változatlanok.
|
||||
|
||||
---
|
||||
|
||||
## 10. Kapcsolódó kutatás: menedzselt webüzemeltetés (2026-09-29)
|
||||
|
||||
**Forrás:** `mitplatform/docs/research/Menedzselt webüzemeltetési szolgáltatás kialakítása webtárhely-szolgáltató számára.md`
|
||||
|
||||
A kutatás a tárhely **fölé** épülő, felelősséget vállaló szolgáltatási réteget javasol:
|
||||
- induló csomagok: Webőr, WordPress Gondozás, Üzleti Webfelügyelet;
|
||||
- később: Webshop Felügyelet és Managed VPS;
|
||||
- kötelező átvételi audit és 90 napos pilot.
|
||||
|
||||
Ez nem írja felül a mIT Start / mIT Mid tárhelydöntést, hanem egy külön termékcsaládot ad hozzá.
|
||||
|
||||
- **Összevetés és döntési pontok:** PLATFM-13. Fő ellentmondások:
|
||||
- mentési megőrzés: a kutatás 14–30 napot ígér, a valóság 7 nap;
|
||||
- a visszaállítási próba nincs igazolva;
|
||||
- az infrastruktúra 0–24 órás riasztása és a menedzselt réteg munkaidős reakcióideje két külön vállalás;
|
||||
- a terméknevek nem illeszkednek a „mIT” névcsaládhoz.
|
||||
- **Weboldal:**
|
||||
- **MITHOME-131:** a „Partnereink” szekció helyes kategóriája (az Angele Pihenőház valószínűleg ügyfélreferencia, nem partner), a cím CMS-be emelése és az engedélykezelés.
|
||||
- **MITHOME-132:** a menedzselt szolgáltatások oldala. Csak a pilot és a „minimum hitelességi csomag” után jöhet.
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"mcp": {
|
||||
"plane-developments": {
|
||||
"type": "local",
|
||||
"command": ["npx", "-y", "@makeplane/plane-mcp-server"],
|
||||
"enabled": true,
|
||||
"environment": {
|
||||
"PLANE_API_KEY": "{env:PLANE_API_KEY}",
|
||||
"PLANE_API_HOST_URL": "https://pm.llmdev.mozdit.hu/",
|
||||
"PLANE_WORKSPACE_SLUG": "developments"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
schema: spec-driven
|
||||
created: 2026-09-28
|
||||
@@ -0,0 +1,93 @@
|
||||
# Design
|
||||
|
||||
## Context
|
||||
|
||||
Lásd `proposal.md` — Why. A `proto/src/lib/logger.ts` már Winston konzol- és
|
||||
Loki-transzportot konfigurál; a production konzolkimenet JSON, a fejlesztői
|
||||
kimenet olvasható formázott szöveg. A contact API, a health endpoint és a MongoDB
|
||||
kapcsolat-ellenőrzés hibái viszont még közvetlen konzolhívásokat használnak. A
|
||||
logger unit tesztben a Loki-transzport egyetlen tesztje kihagyott. A staging és
|
||||
production Docker-konfigurációk beépített, forgatott `json-file` logolással már
|
||||
megőrzik a konténer stdout/stderr kimenetét.
|
||||
|
||||
## Goals / Non-Goals
|
||||
|
||||
**Goals:**
|
||||
|
||||
- Az alkalmazás szerveroldali, működés szempontjából fontos hibáit egységes
|
||||
strukturált kimenetre terelni.
|
||||
- A logok a konténer stdout/stderr csatornáján maradjanak elérhetők, akkor is, ha
|
||||
nincs Loki vagy más távoli loggyűjtő.
|
||||
- Csökkenteni a személyes adatok és hitelesítő adatok logba kerülésének kockázatát.
|
||||
|
||||
**Non-Goals:**
|
||||
|
||||
- ISPConfig-, Nginx-, Docker-host- vagy systemd-logok gyűjtése.
|
||||
- Központi log collector, Loki vagy Grafana telepítése, konfigurálása vagy partneri
|
||||
hozzáférés kialakítása.
|
||||
- Kliensoldali böngészőhibák szerveroldali Winstonba irányítása.
|
||||
- Kapcsolatfelvételi API HTTP státuszainak, válaszainak vagy üzleti működésének
|
||||
megváltoztatása.
|
||||
|
||||
## Decisions
|
||||
|
||||
### Az alkalmazás logolási határa stdout/stderr
|
||||
|
||||
Az alkalmazás nem nyit közvetlen hálózati kapcsolatot Loki felé. A meglévő
|
||||
Winston-konzoltranszport marad az alkalmazás logkimenete: productionben JSON, lokális
|
||||
fejlesztésben emberileg olvasható formátummal. A központi továbbítás egy későbbi
|
||||
Hosting-változtatásban, hostoldali collector feladata lesz.
|
||||
|
||||
**Alternatívák:**
|
||||
|
||||
- Közvetlen Winston→Loki kapcsolat minden alkalmazáspéldányból — elutasítva, mert
|
||||
minden appnak Loki-címet és elérhetőséget kellene kezelnie, ISPConfig alatt pedig
|
||||
több független partneroldal logolását nem oldja meg egységesen.
|
||||
- Csak nyers `console.error` használata — elutasítva, mert nem biztosít egységes,
|
||||
kereshető mezőket a későbbi collector számára.
|
||||
|
||||
### Szerveroldali hibáknál komponenshez kötött logger
|
||||
|
||||
API-végpontok és a MongoDB helper a meglévő child/component logger API-t használják.
|
||||
Minden hibabejegyzés tartalmazza az ismert komponenst és a diagnosztikához szükséges,
|
||||
szűrt hibainformációt. A HTTP-válaszok és a publikus felhasználói üzenetek
|
||||
változatlanok maradnak.
|
||||
|
||||
**Alternatívák:**
|
||||
|
||||
- Új logging framework bevezetése — elutasítva, mert Winston már telepítve van és a
|
||||
projekt elvárásaiban is szerepel.
|
||||
- Egyetlen globális logger használata minden komponens-metaadat nélkül — elutasítva,
|
||||
mert később nehezebbé tenné a több alkalmazás és szolgáltatás naplóinak szűrését.
|
||||
|
||||
### Allowlist-alapú hibamezők és adatminimalizálás
|
||||
|
||||
Az API-k nem logolják a teljes request body-t, különösen a kapcsolatfelvételi űrlapot.
|
||||
A logger csak engedélyezett, diagnosztikához szükséges mezőket szerializál; a
|
||||
hitelesítő adatokat, tokeneket és a hibaszövegbe kerülő érzékeny adatokat maszkolja.
|
||||
Stack trace csak szerveroldali kimenetbe kerülhet, a szerializálás érzékeny értékeket
|
||||
abból sem hagyhat változatlanul.
|
||||
|
||||
## Risks / Trade-offs
|
||||
|
||||
- [Központi gyűjtés elkészültéig nincs remote kereshetőség] → A Docker `json-file`
|
||||
kimenet méret- és fájlszám-korlátja megmarad; a központi gyűjtés külön feladatként
|
||||
indul.
|
||||
- [A redactálás elrejthet diagnosztikailag hasznos részleteket] → Csak érzékeny
|
||||
mezőket maszkoljon, a biztonságos komponens-, szint-, időbélyeg- és hibakódmezők
|
||||
maradjanak elérhetők.
|
||||
- [Kliensoldali hibák nem kerülnek a szerverlogba] → A böngészőoldali naplózás a
|
||||
browser konzolban marad; ez a change a szerveroldali naplózási szerződésre szól.
|
||||
|
||||
## Migration Plan
|
||||
|
||||
1. Winston-konfiguráció és tesztek átállítása a stdout/stderr alapú alkalmazáslogokra,
|
||||
a közvetlen Loki-transzport és az apphoz kötött `LOKI_*` konfiguráció eltávolítása.
|
||||
2. API- és adatbázis-hibák loggerre állítása, tesztek frissítése az érzékeny adatok
|
||||
kizárására.
|
||||
3. Pre-deploy tesztkészlet futtatása, staging deploy után pedig az app konténer
|
||||
stdout/stderr kimenetének ellenőrzése.
|
||||
|
||||
Nincs adatbázis-migráció. Sikertelen staging ellenőrzés esetén az előző Git-verzió
|
||||
visszatelepíthető a meglévő deploy/rollback eljárással. A központi collector
|
||||
konfigurációja nem része ennek a változtatásnak.
|
||||
@@ -0,0 +1,31 @@
|
||||
# Proposal
|
||||
|
||||
## Why
|
||||
|
||||
A Winston logger és Loki transport már szerepel a kódban, de az alkalmazás szerveroldali hibái több helyen továbbra is közvetlen `console.error` hívásokkal naplóznak, a Loki-transzport tesztje pedig ki van hagyva. Mivel az éles szerveren ISPConfig több partneroldalt is kezel, az alkalmazásnak egységes, strukturált stdout/stderr kimenetet kell biztosítania, a központi begyűjtést pedig külön Hosting-infrastruktúra változtatásra kell hagyni.
|
||||
|
||||
## What Changes
|
||||
|
||||
- A Winston legyen az alkalmazásoldali, szerveroldali naplózás egységes belépési pontja, és bocsásson ki strukturált logokat a konzolra.
|
||||
- Az alkalmazás ne küldjön közvetlenül logokat Lokihoz; a naplógyűjtő infrastruktúra külön, Hosting-szintű terv tárgya marad.
|
||||
- Az API- és MongoDB-kapcsolati hibák naplózása használja a Winston komponens-loggereit, a kliensoldali űrlapkezelés maradjon böngészőoldali.
|
||||
- A logok ne tartalmazzanak kapcsolatfelvételi űrlapadatokat, titkokat vagy más szükségtelen személyes adatot.
|
||||
- A logger viselkedését lefedő, jelenleg kihagyott tesztet váltsa fel a stdout-alapú naplózási szerződés tesztelése.
|
||||
- Az alkalmazás naplózási határát és az elkülönített központi gyűjtés felelősségét dokumentáljuk.
|
||||
|
||||
## Capabilities
|
||||
|
||||
### New Capabilities
|
||||
|
||||
- `application-logging`: strukturált szerveroldali alkalmazáslogok Winstonon keresztül, stdout/stderr kimenettel.
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
- Nincs.
|
||||
|
||||
## Impact
|
||||
|
||||
- Érintett kód: `proto/src/lib/logger.ts`, `proto/src/lib/logger.test.ts`, `proto/src/app/api/contact/route.ts`, `proto/src/app/api/health/route.ts`, `proto/src/lib/mongodb.ts`.
|
||||
- Érintett konfiguráció és függőségek: a közvetlen Loki-kapcsolat és az ehhez kötött környezeti beállítások kivezetése az alkalmazásból.
|
||||
- Érintett dokumentáció: `REQUIREMENTS-CATALOG.md`, `README.md`, `.agent/steering/architecture.md`, a `TODO.md` MITHOME-17 sora és a Plane-issue; a Plane aktuális ticketleírása nem volt elérhető a tervezéskor.
|
||||
- Kívül esik a scope-on: ISPConfig/Nginx-vhostok, központi log collector, Loki/Grafana Hosting-szintű telepítése, partnerenkénti Grafana-hozzáférés és logmegőrzési szabályzat. Ezek külön infrastruktúra-változtatást igényelnek; a helyi TODO MITHOME-33-at is külön Loki-telepítési feladatként tartja nyilván.
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
# Spec Delta
|
||||
|
||||
## Purpose
|
||||
|
||||
Ez a capability egységes, biztonságos szerveroldali alkalmazásnaplókat biztosít,
|
||||
amelyeket a futtatókörnyezet vagy egy későbbi központi gyűjtő külön alkalmazáskód-módosítás nélkül felvehet.
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Strukturált szerveroldali alkalmazásnaplók
|
||||
|
||||
Az alkalmazás SHALL a szerveroldali működési és hibanaplókat a standard outputra vagy
|
||||
standard errorre írni. Production környezetben a rekordok SHALL strukturált JSON
|
||||
formátumúak legyenek, és tartalmazzanak időbélyeget, súlyossági szintet, szolgáltatás-,
|
||||
környezet- és komponens-metaadatot. A naplózás SHALL NOT változtathatja meg az
|
||||
alkalmazáskérés HTTP-válaszának státuszát vagy törzsét.
|
||||
|
||||
#### Scenario: Szerveroldali API-művelet hibára fut
|
||||
|
||||
- **WHEN** egy szerveroldali API-művelet nem várt hibát észlel
|
||||
- **THEN** az alkalmazás SHALL strukturált hibanaplót írjon a standard outputra vagy
|
||||
standard errorre, a releváns komponenssel és biztonságos hibainformációval
|
||||
|
||||
#### Scenario: A távoli naplógyűjtő nem érhető el
|
||||
|
||||
- **WHEN** nincs elérhető távoli naplógyűjtő szolgáltatás
|
||||
- **THEN** az alkalmazáskérések feldolgozása SHALL folytatódjon, és a logkimenet SHALL
|
||||
továbbra is elérhető legyen a folyamat standard outputján vagy standard errorján
|
||||
|
||||
### Requirement: Érzékeny adatok védelme a naplókban
|
||||
|
||||
Az alkalmazás naplórekordjai SHALL NOT tartalmazhatják a kapcsolatfelvételi űrlap
|
||||
mezőinek értékeit, hitelesítési titkokat, hozzáférési tokeneket vagy szükségtelen
|
||||
személyes adatokat. A hibák naplózása SHALL csak a diagnosztikához szükséges
|
||||
információkat használhatja.
|
||||
|
||||
#### Scenario: A kapcsolatfelvételi beküldés mentése meghiúsul
|
||||
|
||||
- **WHEN** egy kapcsolatfelvételi beküldés mentése meghiúsul
|
||||
- **THEN** az alkalmazás SHALL rögzítse a hibát a beküldött név, e-mail-cím, tárgy,
|
||||
üzenet és hozzájárulási adat naplózása nélkül
|
||||
|
||||
#### Scenario: A hiba titkot vagy felhasználói adatot tartalmaz
|
||||
|
||||
- **WHEN** egy hibaobjektum vagy kapcsolódó metaadat titkot vagy felhasználói értéket
|
||||
tartalmaz
|
||||
- **THEN** a kiírt naplórekord SHALL hagyja ki vagy maszkolja az érzékeny értéket
|
||||
@@ -0,0 +1,16 @@
|
||||
# Tasks
|
||||
|
||||
## 1. Stdout/stderr naplózási határ kialakítása
|
||||
|
||||
- [x] 1.1 A `logger.ts` konzol-transzportjára való átállítása, a `winston-loki` tesztmock/import eltávolítása, és a kihagyott transzportteszt lecserélése a JSON-kimenetet, metaadatokat és fejlesztői formázást ellenőrző tesztekre. Ellenőrzés: `cd proto && npm test -- --runTestsByPath src/lib/logger.test.ts`.
|
||||
- [x] 1.2 A `winston-loki` eltávolítása az alkalmazásfüggőségekből és lockfile-ból, továbbá az app-szintű `LOKI_*` bekötések eltávolítása a Compose-fájlokból és környezeti példákból; a Loki/Grafana szolgáltatás maradjon a külön Hosting-terv része. Ellenőrzés: ne maradjon app-transzport/env hivatkozás, és `cd proto && npm test` fusson zölden.
|
||||
|
||||
## 2. Szerveroldali hibák strukturált naplózása
|
||||
|
||||
- [x] 2.1 A kapcsolat API, a health endpoint és a MongoDB-kapcsolat hibáinak átállítása komponens-loggerekre, a request body és kapcsolatfelvételi mezők naplózása nélkül. Ellenőrzés: a meglévő API/health/adatbázis hibatesztek zöldek, és a beküldött érzékeny értékek nem szerepelnek a loghívásokban.
|
||||
- [x] 2.2 A `.agent/steering/architecture.md`, `README.md`, `docs/next_steps.md`, `GITHUB-CICD-GUIDE.md`, Compose-környezeti példák és REQ-702 frissítése a strukturált app stdout/stderr kimenetről és a külön Hosting-szintű gyűjtésről; legyen egyértelmű, hogy a Loki-továbbítást ez a MITHOME-17 alkalmazásváltozás nem valósítja meg. Ellenőrzés: a dokumentáció egyezzen a Compose- és logger-viselkedéssel.
|
||||
|
||||
## 3. Alkalmazásoldali naplózás végponttól végpontig történő ellenőrzése
|
||||
|
||||
- [x] 3.1 A locale-prefix nélküli elavult staging smoke útvonalak frissítése `/hu/...` címekre, majd a `scripts/pre-deploy-tests.sh` és a staging smoke tesztek futtatása. Ellenőrizni, hogy a szerverhibák strukturált konténerlogként jelennek meg, az API-válaszok változatlanok, és érzékeny kapcsolatfelvételi mezők nem kerülnek a naplókba.
|
||||
- [x] 3.2 Sikeres ellenőrzés után a MITHOME-17 scope/státusz és a `TODO.md` Plane-nel való szinkronizálása; az ISPConfig/partneroldal központi gyűjtője külön Hosting-munkaként legyen követve. Ellenőrzés: a Plane-issue és a helyi TODO világosan elválasztja az applogolást a központi gyűjtéstől.
|
||||
@@ -0,0 +1,2 @@
|
||||
schema: spec-driven
|
||||
created: 2026-09-29
|
||||
@@ -0,0 +1,113 @@
|
||||
# Design
|
||||
|
||||
## Context
|
||||
|
||||
- A MITHOME-111 óta a Globalok fordítható mezői lokalizáltak, a migrációs infrastruktúra kész: `src/lib/localize-paths.ts`, `src/lib/migrate-global-docs.ts`, `prodMigrations`. A LegalPages collection még nem lokalizált.
|
||||
- A staging adatbázisban 179 egyedi magyar szöveg van (kb. 12 000 karakter), angol érték sehol. A staging REST API hitelesítés nélkül 403-at ad. A forrás ezért csak olvasó `mongosh`-exporttal készül.
|
||||
- A sorazonosítók (array row `id`) környezetenként eltérnek: a production adatbázis más seedből is születhet.
|
||||
- A Payload `drafts` a teljes dokumentumra vonatkozik, nem locale-onként. Ezért nem alkalmas arra, hogy csak az angolt tartsa vissza (felhasználói döntés).
|
||||
|
||||
## Goals / Non-Goals
|
||||
|
||||
**Goals:**
|
||||
- Az angol AI-draft bekerül, de jóváhagyásig nem publikus.
|
||||
- Az import nem rombol: sem magyar, sem kézi angol érték nem íródik felül.
|
||||
|
||||
**Non-Goals:**
|
||||
- Profi fordítás, nyelvválasztó UI, hreflang.
|
||||
- Az állapotmező automatikus visszaállítása AI-draftra, ha a magyar változik (lásd Open Questions).
|
||||
|
||||
## Decisions
|
||||
|
||||
### D1: LegalPages lokalizálás a MITHOME-111 mintájára
|
||||
|
||||
A `title`, a `lastUpdated`, valamint a `sections[].title` és `sections[].content` `localized: true`. A `slug` és a `sections[].id` közös, a `sections` tömb maga közös (objektum-tömb, D2 szabály a MITHOME-111-ből). A `rewriteGlobalDocs` helper általánosodik `rewriteDocs`-szá, amely collectiont is kezel (`db.collections[slug]` és `db.versions[slug]`, ahol a versions rekordok `version` alatt vannak). A Globalokra vonatkozó API változatlan marad.
|
||||
|
||||
### D2: Állapotmező — nem lokalizált select az oldalsávban
|
||||
|
||||
A `translationStatusField()` (`src/globals/fields/translationStatus.ts`) egy `enTranslationStatus` mezőt ad: `none` / `ai-draft` / `approved`, alapérték `none`, `admin.position: 'sidebar'`, figyelmeztető leírással.
|
||||
|
||||
- **WHY nem lokalizált:** csak az angolnak van fordítási állapota. Egy lokalizált mező a magyar nézetben értelmetlen értéket mutatna.
|
||||
- *Alternatíva:* lokalizált `translationStatus` mező. Elvetve, mert a magyar (forrás) nyelv nézetében értelmetlen értéket mutatna, és az admin mező-feltétel nem látja az aktuális locale-t, így elrejteni sem lehet. Ha később újabb nyelv jön, a mező egy nyelvenkénti csoporttá bővíthető.
|
||||
|
||||
### D3: Kapu a Local API adapterben
|
||||
|
||||
A `payload-content.ts` az `en` kérésnél beolvassa a dokumentumot. Ha az `enTranslationStatus` nem `approved`, a tartalmat `hu` locale-lal olvassa újra. A `locale` paraméter a linkfeloldáshoz (CTA, nav) továbbra is `en`, így az útvonalak angolok maradnak, csak a szöveg forrása vált.
|
||||
|
||||
- **TRADEOFF:** nem jóváhagyott angol oldalnál két olvasás történik. Ez elhanyagolható, a Local API ugyanabban a folyamatban fut.
|
||||
|
||||
### D4: Fordítási memória — lapos `hu → en` szótár
|
||||
|
||||
A `src/content/translations/en.json` egy `{ "<magyar szöveg>": "<angol szöveg>" }` szótár.
|
||||
|
||||
- **WHY lapos szótár, nem útvonal/sorazonosító alapú:** környezetfüggetlen (a sorazonosítók eltérnek), sorrendfüggetlen, és a git diffben mondatonként átnézhető. Az elavulást is magától kezeli: ha a magyar megváltozott, nincs találat, tehát nincs angol.
|
||||
- **TRADEOFF:** ugyanaz a magyar szöveg mindenhol ugyanazt az angolt kapja. Ezen a méretű oldalon ez elfogadható.
|
||||
- Egy unit teszt ellenőrzi, hogy minden bejegyzés angol változata ugyanazokat a `{placeholder}`-eket és ugyanazokat a HTML-tag-eket tartalmazza, mint a magyar.
|
||||
|
||||
### D5: Import migráció
|
||||
|
||||
A `20260929_en_ai_draft` migráció minden Globalon és jogi oldalon végigmegy a publikált dokumentumon és a `latest: true` verzión (az admin ezt tölti be szerkesztéskor). A régi verziókhoz nem nyúl, azok történeti rekordok.
|
||||
|
||||
- **Szöveges levél:** ha `en` hiányzik, és a `hu` szerepel a szótárban, beírja.
|
||||
- **Egészében lokalizált string-lista:** csak akkor tölti ki, ha az `en` hiányzik, és **minden** magyar elemnek van fordítása. Ilyenkor új sorazonosítókkal épül fel az angol lista. Részleges listát nem ír, mert az vegyes nyelvű lenne.
|
||||
- **Állapot:** ha legalább egy érték kitöltődött, és az állapot `none` vagy hiányzik, akkor `ai-draft` lesz. `approved` állapotot soha nem állít be.
|
||||
- **Riport:** a logban megjelenik a kitöltött értékek és a nem egyező (elavult vagy fordítás nélküli) magyar szövegek száma.
|
||||
- **Idempotencia:** a második futás nem talál üres, fordítható `en` értéket.
|
||||
|
||||
### D6: A fordítás előállítása
|
||||
|
||||
A fordítást Claude készíti a staging exportból, a tegező/magázó forma helyett semleges, üzleti angol hangnemben, a márkanevek (mozdIT, Roundcube, Let's Encrypt) és a placeholderek megtartásával. A dátumok angol formátumot kapnak (`22 August 2026`). A jogi szövegeknél a fordítás nem jogi szakvélemény, ezt az állapotmező leírása és a Plane-ticket is rögzíti.
|
||||
|
||||
### D7: Jogi szövegek többmodelles validálása (felhasználói döntés)
|
||||
|
||||
- **Folyamat (kézi, felhasználói döntés):** a jogi oldal angol draftját legalább két, egymástól független, magas szintű modell ellenőrzi.
|
||||
- A futtatás kézi: az admin kimásolja a D8 promptját, tetszőleges szolgáltató modelljében lefuttatja, és a választ visszaírja a CMS-be. Így Claude-on kívüli modellek (GPT, Gemini…) is bevonhatók.
|
||||
- Szempontok (a promptban): jelentésazonosság; GDPR-terminológia (pl. adatkezelő → *controller*, érintett → *data subject*); kihagyás vagy betoldás; kötelezettségek erőssége; placeholderek.
|
||||
- **Rögzítés a CMS-ben:** a LegalPages `legalValidation` csoportja (`src/collections/fields/legalValidation.ts`, fő oszlop) tartalmazza a promptpanelt és egy `reviews` tömböt. Egy sor mezői:
|
||||
- `model`, `reviewedAt`, `verdict` (jóváhagyható / javításokkal jóváhagyható / elutasítva) – kötelező;
|
||||
- `result`: a beillesztett válasz, kötelező;
|
||||
- `notes`: meghozott döntések, opcionális.
|
||||
- **Kikényszerítés:** az `enTranslationStatus` `validate` szabálya (`src/lib/legal-validation.ts`) az `approved` értéket csak akkor engedi, ha legalább két különböző modell (kis-nagybetű és szóköz nem számít) legutóbbi, teljes validálása nem „elutasítva”.
|
||||
- **DECISION (modellenként a legutóbbi):** egy elutasítás után a javított fordítást ugyanazzal a modellel újra lehet ellenőriztetni, és az új ítélet lép a helyébe; a régi bejegyzés történetként megmarad.
|
||||
- A Globalokon nincs ilyen feltétel.
|
||||
- **WHY a CMS-ben is kikényszerítve:** a jóváhagyás az ügyfél kezében van; figyelmetlenségből se kerülhessen ki validálatlan jogi szöveg.
|
||||
- **Korlát:** a modell-validáció nem jogi szakvélemény. Ezt a blokk leírása rögzíti.
|
||||
- *Elvetett változat:* a korábbi terv (modellnév-lista + dátum + külső riport-hivatkozás, a validálást a fejlesztés futtatja) — a kézi, bármely szolgáltatós folyamathoz a válasz visszaírása kell, a riport így a CMS-ben él.
|
||||
|
||||
### D8: Validációs segédprompt az adminban (felhasználói kérés)
|
||||
|
||||
- **Sablon:** a `src/lib/legal-validation-prompt.ts` tiszta függvény, a bemenete `{ title, sections: [{ id, title, content }] }` × {hu, en}. Kimenete egy prompt, benne:
|
||||
- a szerep (jogi fordítás-ellenőr);
|
||||
- a D7 szempontjai;
|
||||
- a kötelező kimeneti formátum: táblázat szakasz / súlyosság (magas, közepes, alacsony) / probléma / javasolt angol szöveg, a végén összegző ítélettel;
|
||||
- a figyelmeztetés, hogy ez nem jogi szakvélemény;
|
||||
- a szakaszonkénti magyar–angol szövegpárok.
|
||||
A prompt angol nyelvű, mert modellek számára ez a legstabilabb; a szakaszok eredeti nyelven maradnak. Minden validálás ugyanebből a sablonból indul, így a különböző modellek eredményei összevethetők.
|
||||
- **UI:** a „Jogi validáció” blokk tetején, a validálások fölött egy Payload `ui` mező jelenik meg (`LegalValidationPrompt` kliens komponens).
|
||||
- A komponens az aktuális dokumentum hu és en változatát a REST API-ról olvassa (`draft=true`, az admin session sütijével), mert a szerkesztő űrlap egyszerre csak egy locale-t lát.
|
||||
- A promptot csak olvasható szövegmezőben mutatja, „Prompt másolása” gombbal. Ha nincs angol szöveg, jelzi, hogy nincs mit validálni.
|
||||
- **WHY a sablon kódban, nem CMS-ben:** a validálási szempontok minőségbiztosítási szabály, nem oldaltartalom; a változásait git-ben, review-val kell követni. A „szöveg nem kerül komponensbe” szabály teljesül, mert a sablon külön modulban él, a komponens csak megjeleníti.
|
||||
- *Alternatíva:* szerkeszthető prompt egy „Beállítások” Globalban. Elvetve, mert így a validálási szempontokat ellenőrizetlenül lehetne gyengíteni.
|
||||
- **Import map:** az új admin komponens miatt újra kell generálni az `importMap`-et. A Payload CLI Node 26 alatt hibás, ezért a MITHOME-111-ben használt, közvetlen függvényhívásos kerülőutat alkalmazzuk.
|
||||
|
||||
## Risks / Trade-offs
|
||||
|
||||
- **[A production DB magyar tartalma eltér a stagingétől]** → Nem egyező szövegeknél nincs angol, a kapu miatt nincs kár sem. A migráció riportja mutatja az eltérést, és a szótár bővíthető.
|
||||
- **[Az ügyfél jóváhagyás után módosítja a magyart, az angol elavul]** → Ezt ez a változás nem kezeli automatikusan (Open Question). A mező leírása figyelmeztet.
|
||||
- **[Két olvasás az `en` oldalakon]** → Elhanyagolható, lásd D3.
|
||||
- **[AI-fordítású jogi szöveg]** → Jóváhagyásig nem publikus, a felelősség a jóváhagyóé.
|
||||
|
||||
## Migration Plan
|
||||
|
||||
1. Deploy előtt `mongodump` (a `deploy.md` szerint).
|
||||
2. Deploy. Induláskor sorban lefut a `20260929_localize_legal_pages` és a `20260929_en_ai_draft`.
|
||||
3. Ellenőrzés:
|
||||
- a `/hu/*` oldalak változatlanok;
|
||||
- az `/en/*` oldalak magyarok maradnak (kapu);
|
||||
- az adminban az `en` nézetben angol szöveg, az állapot *AI-draft*;
|
||||
- egy oldal jóváhagyása és publikálása után az `/en` oldal angol.
|
||||
4. Rollback: az előző image és a dump visszaállítása.
|
||||
|
||||
## Open Questions
|
||||
|
||||
- Visszaálljon-e automatikusan az állapot AI-draftra, ha jóváhagyás után a magyar szöveg változik? Ez egy későbbi hook lehet, a mostani szabályokat nem érinti.
|
||||
@@ -0,0 +1,52 @@
|
||||
# Proposal
|
||||
|
||||
## Why
|
||||
|
||||
Az `/en/...` oldalak élnek (MITHOME-114), és a Globalok mezői lokalizáltak (MITHOME-111), angol tartalom azonban még sehol nincs: minden angol oldal a magyar szöveget mutatja. A jogi oldalak (LegalPages) még nem is lokalizáltak (MITHOME-112). Az epic (MITHOME-109) döntése szerint az angol tartalom első köre AI-draft fordítás. Emberi átnézés nélkül ez nem kerülhet a publikus oldalra, és az adminban látszania kell, hogy draftról van szó.
|
||||
|
||||
## What Changes
|
||||
|
||||
- **MITHOME-112, LegalPages retrofit:** a `title`, a `lastUpdated`, valamint a `sections[].title` és `sections[].content` lokalizált. A `slug` és a sor-`id` közös. Egy Payload-migráció a meglévő értékeket `{ hu: … }` alakba csomagolja a publikált dokumentumokon és a verziókon, ugyanúgy, mint a MITHOME-111-nél.
|
||||
- **MITHOME-113, angol fordítás állapota:** minden Global és jogi oldal egy nem lokalizált „Angol fordítás állapota” mezőt kap az admin oldalsávjában. Értékei: *Nincs fordítás* / *AI-draft, átnézésre vár* / *Jóváhagyva*. A mező leírása figyelmeztet, hogy az AI-draft ellenőrzést igényel.
|
||||
- **Kapu a publikus oldalon:** amíg egy oldal angol fordítása nincs *Jóváhagyva* állapotban, az `/en/...` oldal a magyar tartalmat mutatja, ugyanúgy, mint ma. A jóváhagyás és a publikálás után jelenik meg az angol.
|
||||
- **AI-draft angol tartalom:**
|
||||
- A forrás az élő staging adatbázis magyar tartalma, benne az admin-szerkesztésekkel.
|
||||
- A fordítás egy repóban tárolt, git diffben átnézhető fordítási memóriába kerül (magyar szöveg → angol szöveg).
|
||||
- Egy Payload-migráció csak ott tölti ki az angol értéket, ahol a jelenlegi magyar szöveg pontosan egyezik a memóriában lévővel, és még nincs angol érték. Ami kitöltődött, annak állapota *AI-draft* lesz.
|
||||
- A migráció emberi fordítást sosem ír felül, és elavult fordítást sem tesz be.
|
||||
- **Jogi szövegek kötelező validálása magas szintű modellekkel (felhasználói döntés):**
|
||||
- A jogi oldalak (adatvédelmi tájékoztató, felhasználási feltételek) angol fordítását legalább két, egymástól független, magas szintű modell ellenőrzi. Szempontok: jelentésazonosság, GDPR-terminológia, kihagyás vagy betoldás, placeholderek.
|
||||
- A validálást kézzel végzik (felhasználói döntés): a promptot kimásolják, tetszőleges modellben (Claude, GPT, Gemini…) lefuttatják, és a választ visszaírják a CMS-be.
|
||||
- A jogi oldal „Jogi validáció” blokkjában modellenként egy validálás rögzíthető: modell, dátum, ítélet, beillesztett válasz, megjegyzés.
|
||||
- Legalább két különböző modell el nem utasító validálása nélkül az angol fordítás nem állítható *Jóváhagyva* állapotba (modellenként a legutóbbi számít).
|
||||
- **Segédprompt a felületen (felhasználói kérés):** a „Jogi validáció” blokk tetején egy „Validációs prompt” panel jelenik meg. Ez összeállít egy kész promptot a validálási szempontokkal, valamint a magyar eredetivel és az angol drafttal, szakaszonként. Egy gombbal másolható, és bármelyik magas szintű modellbe beilleszthető. A panel promptja ugyanabból a sablonból készül, amellyel a fejlesztési validáció is fut.
|
||||
- A seed-script nem változik: a `locale: 'en'` újrafuttatás (a ticket eredeti ötlete) elvetve, mert felülírná a magyar szerkesztéseket, és új sorazonosítókkal a közös tömbök magyar szövegét is elvinné.
|
||||
|
||||
## Capabilities
|
||||
|
||||
### New Capabilities
|
||||
|
||||
- Nincs.
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
- `content-management`: a lokalizált oldaltartalom a jogi oldalakra is kiterjed. Új követelmény az angol fordítás állapotának jelölése az adminban, az, hogy az AI-draft tartalom nem írhat felül meglévő tartalmat, és hogy jogi oldal angol fordítása csak dokumentált, többmodelles validáció után hagyható jóvá.
|
||||
- `public-site`: az angol oldalak csak jóváhagyott angol fordítást mutathatnak, különben a magyar tartalmat.
|
||||
|
||||
## Impact
|
||||
|
||||
- **Kód:**
|
||||
- `proto/src/collections/LegalPages.ts`, `proto/src/globals/*.ts` (állapotmező);
|
||||
- új `proto/src/globals/fields/translationStatus.ts`;
|
||||
- új admin komponens a validációs prompthoz (`proto/src/components/admin/LegalValidationPrompt.tsx`) és a promptsablon (`proto/src/lib/legal-validation-prompt.ts`);
|
||||
- `proto/src/lib/payload-content.ts` (kapu);
|
||||
- `proto/src/lib/migrate-global-docs.ts` (collection-támogatás);
|
||||
- új migrációk és a fordítási memória (`proto/src/migrations/`, `proto/src/content/translations/en.json`);
|
||||
- tesztek.
|
||||
- **Adat:** a staging `legal-pages` collection és a verziói lokalizált alakra váltanak, és minden Global és jogi oldal megkapja az angol draftot. Deploy előtt `mongodump` kötelező.
|
||||
- **Jogi kockázat:** az AI-fordítású adatvédelmi tájékoztató és felhasználási feltételek jogi szöveg. A kapu miatt jóváhagyásig nem publikus, és a jóváhagyás többmodelles validációhoz kötött. A modell-validáció nem helyettesíti a jogi szakvéleményt, a végső jóváhagyás felelőssége az ügyfélé.
|
||||
- **Kívül esik a scope-on:**
|
||||
- nyelvválasztó (MITHOME-115);
|
||||
- hreflang/sitemap (MITHOME-116);
|
||||
- az admin UI fordítása (MITHOME-122);
|
||||
- a nem CMS-ből jövő, kódban tartott feliratok (a `siteConfig` nav-feliratai), amelyek már most is kétnyelvűek.
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
# Spec Delta
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Localized legal pages
|
||||
|
||||
Legal pages SHALL store their title, last-updated text, and section titles and
|
||||
contents separately per locale. The slug and section identifiers SHALL be shared across
|
||||
locales. Existing Hungarian legal content SHALL be preserved as the Hungarian value,
|
||||
including published content and version history.
|
||||
|
||||
#### Scenario: An administrator adds an English privacy policy
|
||||
|
||||
- **WHEN** an administrator edits a legal page in the `en` locale
|
||||
- **THEN** the Hungarian legal page content SHALL remain unchanged
|
||||
|
||||
#### Scenario: Existing legal page after migration
|
||||
|
||||
- **WHEN** the localized legal page configuration is deployed onto existing data
|
||||
- **THEN** the Hungarian legal pages SHALL render the same content as before
|
||||
|
||||
### Requirement: English translation status
|
||||
|
||||
Every page global and legal page SHALL carry an English translation status with the
|
||||
values "no translation", "AI draft awaiting review", and "approved", visible to
|
||||
administrators with a warning that AI drafts require review. Only an administrator
|
||||
action SHALL set the status to "approved".
|
||||
|
||||
#### Scenario: AI draft is imported
|
||||
|
||||
- **WHEN** machine-translated English content is imported for a page
|
||||
- **THEN** that page's status SHALL be "AI draft awaiting review"
|
||||
|
||||
#### Scenario: An administrator approves a translation
|
||||
|
||||
- **WHEN** an administrator sets the status to "approved" and publishes
|
||||
- **THEN** the page SHALL be marked as having an approved English translation
|
||||
|
||||
### Requirement: Non-destructive AI draft import
|
||||
|
||||
Importing AI-draft English content SHALL only fill English values that are empty and
|
||||
whose current Hungarian source text is identical to the text that was translated. It
|
||||
SHALL NOT change Hungarian values, shared values, or existing English values, SHALL
|
||||
keep placeholders such as `{year}`, `{min}` and `{privacyHref}` intact, and SHALL be
|
||||
safe to run more than once.
|
||||
|
||||
#### Scenario: Hungarian text changed after translation
|
||||
|
||||
- **WHEN** a Hungarian value differs from the source text in the translation memory
|
||||
- **THEN** its English value SHALL stay empty and the import SHALL report it
|
||||
|
||||
#### Scenario: An English value was already edited by a person
|
||||
|
||||
- **WHEN** a field already has an English value
|
||||
- **THEN** the import SHALL leave it unchanged
|
||||
|
||||
### Requirement: Validated English legal pages
|
||||
|
||||
The English translation of a legal page SHALL NOT be set to "approved" unless at least
|
||||
two distinct language models have reviewed it and their reviews are recorded in the CMS.
|
||||
Each review record SHALL contain the model name, the review date, the verdict (approve,
|
||||
approve with changes, reject), and the model's pasted answer. For each model only its
|
||||
latest review SHALL count, and a model whose latest verdict is "reject" SHALL NOT count.
|
||||
Reviews SHALL be run with the admin validation prompt, which covers meaning equivalence
|
||||
with the Hungarian text, data-protection terminology, omissions or additions, and
|
||||
preserved placeholders.
|
||||
|
||||
#### Scenario: Approving an unvalidated legal translation
|
||||
|
||||
- **WHEN** an administrator sets a legal page's English status to "approved" while fewer
|
||||
than two distinct models have a complete, non-rejecting latest review
|
||||
- **THEN** the CMS SHALL reject the save with a validation error
|
||||
|
||||
#### Scenario: Approving a validated legal translation
|
||||
|
||||
- **WHEN** two distinct models each have a complete latest review that does not reject
|
||||
the translation
|
||||
- **THEN** the CMS SHALL allow the status to be set to "approved"
|
||||
|
||||
#### Scenario: A rejection is superseded
|
||||
|
||||
- **WHEN** a model rejected the translation and, after corrections, a newer review by the
|
||||
same model approves it
|
||||
- **THEN** that model SHALL count towards the required reviews
|
||||
|
||||
#### Scenario: Page globals are not affected
|
||||
|
||||
- **WHEN** an administrator approves the English translation of a page global
|
||||
- **THEN** no legal validation record SHALL be required
|
||||
|
||||
### Requirement: Legal validation prompt in the admin
|
||||
|
||||
The legal page editor SHALL offer administrators a ready-to-use validation prompt for
|
||||
the English translation. The prompt SHALL contain the review criteria, the requested
|
||||
structured output format, and the current Hungarian and English text of every section
|
||||
of that page, and SHALL be copyable with a single action. The prompt SHALL be generated
|
||||
from the same template that is used for the project's own model validation.
|
||||
|
||||
#### Scenario: An administrator copies the validation prompt
|
||||
|
||||
- **WHEN** an administrator opens a legal page that has English content and uses the
|
||||
copy action of the validation prompt panel
|
||||
- **THEN** the clipboard SHALL contain a prompt with the review criteria and the
|
||||
Hungarian and English text of each section of the current version
|
||||
|
||||
#### Scenario: No English text yet
|
||||
|
||||
- **WHEN** a legal page has no English content
|
||||
- **THEN** the panel SHALL state that there is nothing to validate instead of offering
|
||||
a prompt
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
# Spec Delta
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Approved English content only
|
||||
|
||||
An English public page SHALL render its English content only when that page's English
|
||||
translation status is "approved". Otherwise it SHALL render the Hungarian content of the
|
||||
same page. Routing, navigation labels, and shared values SHALL be unaffected by the
|
||||
status.
|
||||
|
||||
#### Scenario: English translation is an unapproved AI draft
|
||||
|
||||
- **WHEN** a visitor opens an English page whose translation status is "AI draft
|
||||
awaiting review"
|
||||
- **THEN** the page SHALL render the Hungarian content
|
||||
|
||||
#### Scenario: English translation is approved
|
||||
|
||||
- **WHEN** a visitor opens an English page whose translation status is "approved" and
|
||||
the page is published
|
||||
- **THEN** the page SHALL render the English values, falling back to Hungarian for any
|
||||
field without an English value
|
||||
@@ -0,0 +1,27 @@
|
||||
# Tasks
|
||||
|
||||
## 1. MITHOME-112 — LegalPages lokalizálás
|
||||
|
||||
- [x] 1.1 A `rewriteGlobalDocs` általánosítása `rewriteDocs`-szá (global és collection, a versions `version` alatt), a MITHOME-111/123 migrációk átállítása. Ellenőrzés: a meglévő migrációs tesztek változatlanul zöldek, és új teszt fedi a collection-ágat.
|
||||
- [x] 1.2 A LegalPages `title`, `lastUpdated`, `sections[].title` és `sections[].content` mezőinek `localized: true` jelölése, a `20260929_localize_legal_pages` migráció megírása és regisztrálása, valamint a `payload-config.test.ts` szabálytesztjének kiterjesztése a LegalPages-re. Ellenőrzés: `npm test`, `tsc`, lint.
|
||||
|
||||
## 2. MITHOME-113 — állapotmező és kapu
|
||||
|
||||
- [x] 2.1 A `translationStatusField()` elkészítése (`none`/`ai-draft`/`approved`, oldalsáv, figyelmeztető leírás), felvétele az 5 Globalra és a LegalPages-re, valamint a típusok újragenerálása. Ellenőrzés: config teszt (a mező mindenhol ott van, nem lokalizált, alapértéke `none`).
|
||||
- [x] 2.2 A kapu elkészítése a `payload-content.ts`-ben: `en` + nem `approved` esetén `hu` tartalom, `en` útvonalakkal. A logika tiszta függvénybe kerül, unit tesztekkel (approved → en, ai-draft/none/hiányzó → hu, a hu kérést nem érinti). Ellenőrzés: `npm test`.
|
||||
|
||||
## 3. MITHOME-113 — AI-draft angol tartalom
|
||||
|
||||
- [x] 3.1 A fordítási memória (`src/content/translations/en.json`) elkészítése a staging exportból, mind a 179 egyedi magyar szövegre. Unit teszt: minden bejegyzésben egyeznek a placeholderek és a HTML-tagek, és nincs üres fordítás. Ellenőrzés: `npm test`.
|
||||
- [x] 3.2 Az import tiszta függvény (`fillEnglishDraft`) és a `20260929_en_ai_draft` migráció elkészítése a D5 szerint (üres `en`, pontos `hu` egyezés, teljes lista vagy semmi, állapot `ai-draft`, riport). Unit tesztek: kitöltés, elavult magyar, meglévő angol, részleges lista, idempotencia, az `approved` állapot érintetlen. Ellenőrzés: `npm test`.
|
||||
|
||||
## 4. Jogi szövegek többmodelles validálása
|
||||
|
||||
- [x] 4.1 A `legalValidation` blokk a LegalPages-en (`src/collections/fields/legalValidation.ts`): promptpanel + `reviews` tömb (modell, dátum, ítélet, beillesztett válasz, megjegyzés), valamint az `enTranslationStatus` `validate` szabálya: jogi oldalon `approved` csak ≥2 különböző modell legutóbbi, teljes, nem elutasító validálásával. Unit tesztek: különböző modellek → ok; ugyanaz a modell kétszer, hiányos válasz, elutasítás → hiba; újabb validálás felülírja az elutasítást; Global → nincs feltétel. Ellenőrzés: `npm test`.
|
||||
- [x] 4.2 A validációs promptsablon (`src/lib/legal-validation-prompt.ts`) és a `LegalValidationPrompt` panel (D8): hu+en szakaszpárok REST-ről, csak olvasható mező, „Prompt másolása” gomb, üres angol esetén jelzés; importMap újragenerálása. Unit tesztek a sablonra. Ellenőrzés: `npm test`, valamint böngészőben (5.1) a panel megjelenik, a másolás működik, és egy validálás rögzíthető.
|
||||
- [x] 4.3 ~~A validálás futtatása a fejlesztés során~~ — felhasználói döntés alapján **kézi folyamat**: a validálást az ügyfél végzi a felületi prompttal, a válaszokat a CMS-be írja vissza. Ebben a változásban nincs modellfuttatás; a jogi oldalak jóváhagyásig AI-draftban maradnak.
|
||||
|
||||
## 5. Élő ellenőrzés és lezárás
|
||||
|
||||
- [x] 5.1 A staging-másolaton, eldobható konténerben az llmdev-en: induláskor a migrációk lefutnak, a riport 0 nem egyező szöveget mutat; a `/hu/*` változatlan, az `/en/*` magyar; az adminban az `en` nézet angol, az állapot AI-draft; egy Global jóváhagyása és publikálása után az `/en` oldal angol; egy jogi oldal jóváhagyása két validálás nélkül elutasításra kerül, két különböző modell rögzített validálásával pedig sikerül; a második indítás nem változtat semmit. Utána takarítás. **Eredmény (2026-09-29, staging-másolat):** a legal-pages migráció 72 értéket, az angol import 324 értéket töltött ki (home 68, about 42, services 62, contact 78, common 26, legal-pages 48), **0 egyezés nélküli** magyar szöveggel; a 6 `/hu/*` oldal szövegre azonos a stagingével; mind a 6 `/en/*` oldal magyar maradt (kapu); a Home jóváhagyása után az `/en` angol lett, a többi `/en` oldal magyar maradt; a jogi oldal jóváhagyása validálás nélkül és egy elutasítással 400, két el nem utasító validálással 200, utána az `/en/privacy-policy` angol lett; a promptpanel 5 szakaszt, 0 hiányzó angolt mutatott; újraindításkor a migrációk nem futottak újra. Talált és javított hiba: a beágyazott böngésző megtagadta a Clipboard API-t — tartalék lánc (execCommand, végül kijelölés + súgó) került a panelbe, komponensteszttel. A Payload csak általános „field is invalid” üzenetet mutat, ezért a jogi oldal állapotmezőjének leírása kiírja a jóváhagyási szabályt.
|
||||
- [x] 5.2 `npm test`, lint, build zöld. Utána a Plane (MITHOME-112, MITHOME-113) és a `TODO.md` szinkronizálása, commit és push. A staging deploy külön felhasználói jóváhagyással történik.
|
||||
@@ -0,0 +1,2 @@
|
||||
schema: spec-driven
|
||||
created: 2026-09-28
|
||||
@@ -0,0 +1,79 @@
|
||||
# Design
|
||||
|
||||
## Context
|
||||
|
||||
- A Payload 3.88 `mongooseAdapter`-rel tárolja a Globalokat. A publikált, illetve aktuális dokumentum a `globals` collectionben van (`globalType: '<slug>'`). Mivel a `versions.drafts` be van kapcsolva (MITHOME-92), a draftok és a verziótörténet a globalonkénti `_<slug>_versions` collectionben élnek, `version.<mező>` alatt.
|
||||
- Egy lokalizált mező MongoDB-alakja `{ hu: …, en: … }`. Egy lokalizált tömb alakja `{ hu: [...], en: [...] }`. Egy nem lokalizált tömbön belüli lokalizált mező alakja `[{ id, title: { hu, en }, icon }]`. A korábban tárolt, nem lokalizált érték (`"szöveg"` vagy `[...]`) a lokalizált mezőn üresnek olvasódik (ezt a MITHOME-110 bizonyította).
|
||||
- A `Common.buttons.*` már lokalizált és migrált. Ezeket a migrációnak érintetlenül kell hagynia.
|
||||
- A staging és a production konténerben `NODE_ENV=production` van, a dev compose-ban `development`. A fejlesztői Macen nincs Docker daemon. Konténert (pl. eldobható MongoDB-t) csak az llmdev szerveren lehet futtatni (`docker --context llmdev`).
|
||||
- A `payload-content.ts` adapter és a view komponensek locale szerint kérdeznek (`findGlobal({ slug, locale })`), a visszakapott alak nem változik. A frontenden ezért nincs teendő.
|
||||
|
||||
## Goals / Non-Goals
|
||||
|
||||
**Goals:**
|
||||
- A lokalizált mezőkészletnek egyetlen forrása legyen, a Global config (`localized: true`). A migráció ebből vezesse le az útvonalakat, ne egy kézzel karbantartott listából.
|
||||
- A migráció adatvesztés nélküli, idempotens legyen, és lefedje a `globals` és a `_<slug>_versions` rekordokat.
|
||||
|
||||
**Non-Goals:**
|
||||
- Angol tartalom előállítása (MITHOME-113), LegalPages (MITHOME-112).
|
||||
- A lokalizáció visszafordítása (down-migráció) automatikus adatmentés nélkül. Lásd a Migration Plan szakaszt.
|
||||
|
||||
## Decisions
|
||||
|
||||
### D1: Mezőválasztás — a „mi fordítható?” szabály
|
||||
|
||||
Minden `text`/`textarea` mező lokalizált, kivéve ezeket:
|
||||
- `icon`: ikonkulcs, a render logika része.
|
||||
- Objektum-sorok `id` mezője (`home.about.usps[].id`, `home.services.items[].id`): anchor/kulcs.
|
||||
- `external` (checkbox).
|
||||
- `common.footer.address`: postai cím, nyelvfüggetlen adat. Nem szövegmásolat.
|
||||
|
||||
A `hero.cta.*.href` lokalizált, mert a belső útvonal nyelvenként eltér (`PAGE_SLUGS`). *Alternatíva:* a href-et PageKey-re cseréljük, és `localePath()`-szal számoljuk. Ez tisztább, de sémaváltással és a view-k módosításával járna, ezért külön feladat.
|
||||
|
||||
### D2: Tömbök — vegyes stratégia (felhasználói döntés)
|
||||
|
||||
- A `stringArrayField` új, opcionális `localized` paramétert kap, és az **egész array mezőt** jelöli lokalizáltnak. Ennek oka, hogy a bekezdésszám nyelvenként eltérhet.
|
||||
- Az objektum-tömböknél (usps, items, values, services, channels, faq.items) a tömb maga közös, csak a belső szövegmezők lokalizáltak. Így az ikon és a sorrend egy helyen szerkeszthető.
|
||||
- Kivétel: a `home.services.items[].features` és a `services.details.services[].specs.items` string-lista egy nem lokalizált sorban van, de maga a lista lokalizált. Ezt a Payload támogatja (tárolási alak: `features: { hu: [...] }`).
|
||||
|
||||
### D3: Migráció Payload migrációként, `prodMigrations`-szel indítva
|
||||
|
||||
- Új fájl: `src/migrations/20260929_localize_globals.ts`, `up({ payload })`. A migráció regisztrálva van a `src/migrations/index.ts`-ben, és a `mongooseAdapter({ prodMigrations })` kapja meg. A Payload production induláskor lefuttatja a még nem futott migrációkat, és a `payload-migrations` collectionben nyilvántartja őket.
|
||||
- *Alternatíva 1:* a JSON-seed újrafuttatása. Elvetve, mert felülírja az admin-szerkesztéseket (felhasználói döntés).
|
||||
- *Alternatíva 2:* külön `tsx` script, amelyet a `deploy.sh` futtat. Elvetve, mert a production image-ben nincs `tsx`/forrás, ezért a deploy scriptben új, törékeny lépést igényelne. A `prodMigrations` a Payload natív mechanizmusa, és a már bundle-ölt configgal fut.
|
||||
- Dev környezetben a futtatás `npx payload migrate` paranccsal, vagy a `NODE_ENV=production` induláskor.
|
||||
|
||||
### D4: Transzformáció — config-vezérelt, tiszta függvény
|
||||
|
||||
- `src/lib/localize-paths.ts`: a `GlobalConfig.fields` bejárásával előállítja a lokalizált mezők relatív útvonalait (group → `a.b`, array → `a[]`, lokalizált mező → levél). Ebben a körben csak a `group`, `array`, `text`, `textarea` és `checkbox` típust kell kezelni, ismeretlen mezőtípusnál hibát dob (fail-fast).
|
||||
- `wrapLocalized(doc, paths, locale = 'hu')`: tiszta függvény.
|
||||
- `string`, illetve tömb értéket `{ hu: érték }` alakba csomagol.
|
||||
- Ha az érték már plain object (`{ hu?, en? }`), érintetlenül hagyja. Ez adja az idempotenciát.
|
||||
- `null` és `undefined` értékhez nem nyúl.
|
||||
- A migráció a `globals` dokumentumra a gyökérből, a `_<slug>_versions` dokumentumokra a `version` alól alkalmazza a transzformációt. Közvetlenül a mongoose `collection.updateOne`-nal ír, nem a Local API-val. Így nem keletkezik új verzió, nem futnak hookok, és a `updatedAt` sem változik.
|
||||
- *Alternatíva:* kézzel írt útvonallista. Elvetve, mert elcsúszhat a configtól. A config-vezérelt bejárás a Global configok változásával automatikusan együtt mozog.
|
||||
|
||||
### D5: Tesztek
|
||||
|
||||
- A `localize-paths` és a `wrapLocalized` unit tesztekkel fedett (>90%). Esetek: string, tömb, beágyazott sor, már migrált érték, `null`, már lokalizált `Common.buttons`, dupla futtatás.
|
||||
- `payload-config.test.ts`: táblázatos teszt arra, hogy a D1 kivételei nem lokalizáltak, minden más `text`/`textarea` lokalizált, és a stringArray mezők a tömb szintjén lokalizáltak.
|
||||
- Élő ellenőrzés: eldobható MongoDB az llmdev szerveren, staging-dump visszaállításával (részletek a tasks.md-ben).
|
||||
|
||||
## Risks / Trade-offs
|
||||
|
||||
- [A migráció félúton elhasal (kapcsolatszakadás)] → A transzformáció dokumentumonként idempotens, ezért az újraindítás befejezi. A `payload-migrations` rekord csak siker után íródik.
|
||||
- [Az Payload belső tárolási alakja eltér a feltételezettől (pl. versions collection neve)] → Élő ellenőrzés staging-dumppal deploy előtt. A migráció a `payload.db.globals` és a `payload.db.versions[slug]` modellekből veszi a collectiont, nem beégetett névből.
|
||||
- [Egy lokalizált string-lista angol változata üres tömbként mentődik, és nem esik vissza a magyarra] → A Payload fallback csak `undefined`/`null` esetén lép életbe. Ezt az élő ellenőrzés során megnézzük, és ha kell, a MITHOME-113 seed kezeli.
|
||||
- [Az admin required-validáció az `en` locale mentésekor minden kötelező mezőt kér] → Elfogadott: az angol változat teljes kitöltése a MITHOME-113 feladata.
|
||||
- [Rollback] → A down-migráció fordított transzformáció, amely csak a `hu` értéket tartja meg, az `en` elveszik. Ezért a deploy előtti `mongodump` kötelező.
|
||||
|
||||
## Migration Plan
|
||||
|
||||
1. Deploy előtt `mongodump` a staging, majd a production adatbázisról.
|
||||
2. Deploy (a meglévő `deploy.sh`). A konténer indulásakor a `prodMigrations` lefut, a log jelzi a sikert.
|
||||
3. Ellenőrzés: `/hu/...` oldalak változatlanok, `/en/...` oldalakon magyar fallback, admin `en` locale üres/fallback, egy régi verzió megnyitása hu értékkel.
|
||||
4. Rollback: az előző image visszaállítása és a dump `mongorestore`-ja.
|
||||
|
||||
## Open Questions
|
||||
|
||||
- A `hero.cta.primary.href` jelenlegi `/kapcsolat` értéke prefix nélküli (lásd proposal). Az adat javítása adminból történik, a szabályt nem érinti.
|
||||
@@ -0,0 +1,36 @@
|
||||
# Proposal
|
||||
|
||||
## Why
|
||||
|
||||
A MITHOME-110 bekapcsolta a Payload hu/en lokalizációt, és a MITHOME-114 óta a `/en/...` útvonalak is élnek. Az 5 Global (Home, About, Services, Contact, Common) mezői azonban a `Common.buttons.*` kivételével nem lokalizáltak, ezért az angol oldalak minden szövege magyar, és az adminban nincs hova angol változatot írni. A MITHOME-111 ezt pótolja. Erre a lépésre épül a LegalPages retrofit (MITHOME-112), az AI-draft angol tartalom (MITHOME-113) és a nyelvválasztó (MITHOME-115).
|
||||
|
||||
A Plane-ticket szerint a meglévő magyar tartalom „migrálás nélkül, automatikusan” a `hu` locale alá kerül. A MITHOME-110 tapasztalata ezt cáfolja. Ha egy mezőt utólag `localized: true`-ra állítunk, a tárolási alak `"érték"`-ről `{ hu: "érték" }`-re változik, a régi érték pedig üresnek látszik. A MITHOME-110-nél ezt a JSON-seed újrafuttatásával oldottuk meg, ez azonban felülírná az ügyfél adminban végzett szerkesztéseit, ezért itt nem használható.
|
||||
|
||||
## What Changes
|
||||
|
||||
- Az 5 Global szöveges (`text`/`textarea`) mezői `localized: true` jelölést kapnak. A strukturális mezők közösek maradnak a nyelvek között: `icon`, a sorok `id` mezője, `external` és a postai cím (`footer.address`).
|
||||
- A tömbökre vegyes stratégia vonatkozik:
|
||||
- Az objektum-tömbökben (`about.usps`, `services.items`, `mission.values`, `details.services`, `support.channels`, `faq.items`) a sorok **belső szövegmezői** lokalizáltak, a sorok száma, sorrendje és ikonja közös.
|
||||
- A string-listák (`stringArrayField`: `paragraphs`, `trustBullets`, `features`, `specs.items`) **egészükben** lokalizáltak, így nyelvenként eltérő számú elemük lehet.
|
||||
- A `hero.cta.*.href` lokalizált lesz, mert a belső linkek nyelvenként eltérő útvonalra mutatnak (`/hu/kapcsolat` vs `/en/contact`).
|
||||
- **BREAKING (tárolási alak)**: az érintett mezők MongoDB-alakja megváltozik. Egy idempotens Payload-migráció a meglévő értékeket `{ hu: <érték> }` alakba csomagolja. Ez a publikált dokumentumra, valamint a draft- és verziórekordokra is vonatkozik, az admin-szerkesztések megmaradnak. A migráció productionben a Payload `prodMigrations` mechanizmusán keresztül, induláskor automatikusan fut le.
|
||||
- A `migrate-content-to-payload.ts` seed-script dokumentációja frissül: az újrafuttatás már nem része a lokalizációs átállásnak.
|
||||
- Az angol tartalom feltöltése nem része ennek a változásnak (MITHOME-113). Addig a fallback miatt a magyar érték jelenik meg angolul is.
|
||||
|
||||
## Capabilities
|
||||
|
||||
### New Capabilities
|
||||
|
||||
- Nincs.
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
- `content-management`: a „Hungarian and English locale support” követelmény kiegészül azzal, hogy a Global oldaltartalom fordítható szövegmezői lokalizáltak (a strukturális mezők közösek), és a meglévő tartalom adatvesztés nélkül a `hu` locale alá kerül át.
|
||||
|
||||
## Impact
|
||||
|
||||
- Érintett kód: `proto/src/globals/{Home,About,Services,Contact,Common}.ts`, `proto/src/globals/fields/stringArray.ts`, `proto/src/payload.config.ts` (`prodMigrations`), új `proto/src/migrations/` (lokalizációs migráció és a hozzá tartozó mezőútvonal-segéd), `proto/src/payload-types.ts` (újragenerálva), `proto/src/payload-config.test.ts` és a migráció új unit tesztjei.
|
||||
- Nem változik: `proto/src/lib/payload-content.ts` és a page komponensek. A Local API a kért locale értékét adja vissza, a visszaadott alak ugyanaz marad.
|
||||
- Adat: a staging és a production `globals` collection, valamint a `_<global>_versions` rekordok egyszeri átalakítása. Deploy előtt MongoDB-mentés szükséges (`scripts/` vagy `mongodump`).
|
||||
- Kívül esik a scope-on: LegalPages (MITHOME-112), angol tartalom (MITHOME-113), nyelvválasztó UI (MITHOME-115), admin UI fordítás (MITHOME-122).
|
||||
- Mellékmegfigyelés: a Home `hero.cta.primary.href` jelenlegi értéke `/kapcsolat`, locale-prefix nélkül. Middleware/redirect nélkül ez valószínűleg 404-re vezet. Ezt adatszinten, a migráció után az adminban kell javítani (`/hu/kapcsolat`), vagy külön ticketben kell kezelni.
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
# Spec Delta
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Localized page globals
|
||||
|
||||
The Home, About, Services, Contact, and Common globals SHALL store every translatable
|
||||
text value (titles, subtitles, descriptions, body paragraphs, labels, button texts,
|
||||
form messages, FAQ entries, metadata, and locale-dependent link targets) separately per
|
||||
locale. Structural values (icons, row identifiers, the external-link flag, and the
|
||||
postal address) SHALL be shared across locales. List items that consist of a single
|
||||
text value (paragraph lists, bullet lists, feature lists, specification item lists)
|
||||
SHALL be editable per locale, including a different number of items per locale. For
|
||||
lists of structured rows, the row count, order, and structural values SHALL be shared
|
||||
across locales, and only the text values within each row SHALL be localized.
|
||||
|
||||
#### Scenario: An administrator saves an English value
|
||||
|
||||
- **WHEN** an administrator edits a translatable global field in the `en` locale and
|
||||
publishes it
|
||||
- **THEN** the English public page SHALL render the English value and the Hungarian
|
||||
public page SHALL continue to render the unchanged Hungarian value
|
||||
|
||||
#### Scenario: An administrator changes a shared structural value
|
||||
|
||||
- **WHEN** an administrator changes a structural value such as an icon in either locale
|
||||
- **THEN** both locales SHALL render the changed value
|
||||
|
||||
#### Scenario: A paragraph list differs between locales
|
||||
|
||||
- **WHEN** the Hungarian version of a paragraph list has three items and the English
|
||||
version has two
|
||||
- **THEN** each locale's public page SHALL render exactly its own items
|
||||
|
||||
### Requirement: Lossless locale migration of existing content
|
||||
|
||||
When a previously non-localized global field becomes localized, its existing value
|
||||
SHALL be preserved as the Hungarian value, including values edited by administrators
|
||||
after the initial content import. The migration SHALL cover published content, saved
|
||||
drafts, and version history, SHALL NOT overwrite existing content with seed data, and
|
||||
SHALL be safe to run more than once. Deployed environments SHALL apply the migration
|
||||
without a manual step.
|
||||
|
||||
#### Scenario: Deploy onto a database with administrator edits
|
||||
|
||||
- **WHEN** the localized configuration is deployed onto a database whose globals were
|
||||
edited in the admin after the initial import
|
||||
- **THEN** after startup the Hungarian public pages SHALL render the edited values
|
||||
unchanged, and the English public pages SHALL render the same values through fallback
|
||||
|
||||
#### Scenario: Restore an older version after migration
|
||||
|
||||
- **WHEN** an administrator opens or restores a global version saved before the
|
||||
migration
|
||||
- **THEN** the version SHALL show its original text as the Hungarian value rather than
|
||||
empty fields
|
||||
|
||||
#### Scenario: Migration runs a second time
|
||||
|
||||
- **WHEN** the migration is executed on already migrated data
|
||||
- **THEN** stored values SHALL remain unchanged
|
||||
@@ -0,0 +1,22 @@
|
||||
# Tasks
|
||||
|
||||
## 1. Lokalizált Global configok
|
||||
|
||||
- [x] 1.1 A `stringArrayField` bővítése opcionális `localized` paraméterrel (az array szinten jelöl), unit teszttel. Ellenőrzés: `cd proto && npm test -- stringArray`.
|
||||
- [x] 1.2 A Home, About, Services, Contact és Common Global mezőinek `localized: true` jelölése a design D1/D2 szabálya szerint. Kivételek: `icon`, sor-`id`, `external`, `footer.address`. A `hero.cta.*.href` lokalizált. A fejléc-kommentek frissítése (MITHOME-111). Ellenőrzés: a `payload-config.test.ts` táblázatos tesztje, amely minden Global összes mezőjét bejárja, és a kivételek kivételével minden `text`/`textarea`-t, valamint a stringArray tömböket lokalizáltnak várja, zöld.
|
||||
- [x] 1.3 A `payload-types.ts` újragenerálása (a `payload` CLI Node 26 alatt `ERR_REQUIRE_ASYNC_MODULE`-lal elhasal, ezért a `generateTypes` függvényt közvetlenül, ESM-importtal hívtuk; a kimenet változatlan, mert a lokalizált mezők TS-típusa azonos), a `tsc --noEmit` és az `npm run lint` futtatása. Ellenőrzés: nincs típushiba, a `payload-content.ts` változatlanul fordul.
|
||||
|
||||
## 2. Adatmigráció
|
||||
|
||||
- [x] 2.1 A `src/lib/localize-paths.ts` elkészítése (nem a `src/migrations/` alatt, mert a Payload CLI ott minden `.ts`-t migrációnak vesz): a config-vezérelt útvonalgyűjtés és a `wrapLocalized` tiszta függvény (D4). Unit tesztek fedik le a string, a tömb, a sorban lévő mező, a sorban lévő lokalizált lista, a már migrált érték, a `null` és a dupla futtatás esetét. Ellenőrzés: `npm test -- localize-paths` (100% sor-, 88% ág-lefedettség), lefedettség >90%.
|
||||
- [x] 2.2 A `src/migrations/20260929_localize_globals.ts` (`up`/`down`) és a `src/migrations/index.ts` elkészítése, `prodMigrations` regisztrációval a `payload.config.ts`-ben. A migráció a `globals` és a `_<slug>_versions` rekordokat alakítja át, és hookok, illetve új verzió nélkül ír. Unit teszt mockolt collectionnel (`src/__tests__/localize-globals-migration.test.ts`): a helyes dokumentumokat és útvonalakat frissíti. Ellenőrzés: `npm test`.
|
||||
- [x] 2.3 A `migrate-content-to-payload.ts` fejkommentjének frissítése: a lokalizációs átállás a migrációval történik, nem a seed újrafuttatásával. A `.agent/steering/architecture.md` kiegészítése a migrációs szabállyal. Ellenőrzés: nincs elavult utasítás a scriptben és a `docs/`-ban (`grep -rn "újra kell futtatni" proto/scripts docs`).
|
||||
|
||||
## 3. Élő ellenőrzés és deploy-előkészítés
|
||||
|
||||
- [x] 3.1 Eldobható MongoDB indítása az llmdev szerveren (`docker --context llmdev`, a Docker-háttér spec szerint, csak `127.0.0.1`-re kötve, SSH-tunnellel). Ide kerül a staging adatbázis dumpja. Erre fut a migráció kétszer: `NODE_ENV=production` induláskor, a `prodMigrations` útján. Ellenőrzés: a második futás 0 módosítást jelez; a `npm run test:payload` a hu értékeket adja; a `/hu/*` HTML egyezik a migráció előtti snapshottal (`scripts/export-content-snapshot.ts`); a `/en/*` magyar fallbacket mutat; az adminban egy régi verzió hu értékkel nyílik meg; egy `en` mentés csak az angol oldalt változtatja meg. **Eredmény (2026-09-29):** a staging-másolaton a migráció 405 értéket írt át. A `hu` publikált tartalom, a draft és a teljes verziótörténet azonos a migráció előtti snapshottal (régi kód, HEAD~1 worktree). Az `en` mindenhol a magyar fallbacket adja. A második indításnál a migráció nem fut újra, a közvetlen `up()` 0 módosítást jelez. Az `en` mentés után a `hu` változatlan, az ikon közös. Mind a 8 oldal 200. A konténer nem kapott hostportot, SSH-tunnellel értük el a belső IP-jét. Mellékeredmény: migráció nélkül csak a lokalizált tömbök tűnnének el. A `/kapcsolat` (prefix nélkül) valóban 404.
|
||||
- [x] 3.2 A deploy-dokumentáció (`.agent/workflows/deploy.md`) kiegészítése a kötelező deploy előtti `mongodump` lépéssel és a rollback menetével. Utána az eldobható konténer leállítása és eltávolítása. Ellenőrzés: a dokumentált parancsok egyeznek a 3.1-ben ténylegesen futtatottakkal.
|
||||
|
||||
## 4. Lezárás
|
||||
|
||||
- [x] 4.1 `cd proto && npm test && npm run lint && npm run build` zöld. Utána a MITHOME-111 Plane-státusz és a `TODO.md` szinkronizálása, Plane-komment a „migrálás nélkül” téves állítás helyesbítésével és a `/kapcsolat` href mellékmegfigyeléssel. Ellenőrzés: a Plane és a `TODO.md` egyezik, a commitok Conventional Commits formátumúak.
|
||||
@@ -0,0 +1,2 @@
|
||||
schema: spec-driven
|
||||
created: 2026-09-29
|
||||
@@ -0,0 +1,103 @@
|
||||
# Design
|
||||
|
||||
## Context
|
||||
|
||||
- **Termékkör:** a tulajdonos döntése szerint egyelőre csak a mIT Start és a mIT Mid (elemzés 4. fejezet: `docs/termekkor-es-szerverkapacitas-elemzes.md`).
|
||||
- **Termékmodell:** a PLATFM-3 határozza meg a szerkezetet: stabil azonosító, életciklus, publikus mezők, szolgáltatás-definíció. A honlap nem lehet az elsődleges forrás; ez a collection átmeneti.
|
||||
- **Meglévő minták:**
|
||||
- lokalizáció és fordítási kapu: `translationStatusField`, `readGated` (MITHOME-113);
|
||||
- útvonalak: `PAGE_SLUGS` → sitemap, hreflang, nyelvváltó (MITHOME-114/115/116);
|
||||
- migrációk: `rewriteDocs` (MITHOME-111/112);
|
||||
- a staging felismerése: `NEXT_PUBLIC_DEPLOY_ENV=staging` (MITHOME-116/127).
|
||||
|
||||
## Goals / Non-Goals
|
||||
|
||||
**Goals:** jóváhagyásig rejtett, de a stagingen átnézhető csomagoldal. Az adatmodell a PLATFM-3-mal egyezik, így az adatforrás később cserélhető.
|
||||
|
||||
**Non-Goals:** árképzés (az ár a PLATFM-14 katalógusból jön), rendelés, a menedzselt szolgáltatások oldala (MITHOME-132), a katalógus API-ja.
|
||||
|
||||
## Decisions
|
||||
|
||||
### D1: `Products` collection (PLATFM-3 szerkezet)
|
||||
|
||||
| Mező | Típus | Lokalizált | Megjegyzés |
|
||||
|---|---|---|---|
|
||||
| `slug` | text, unique | – | stabil azonosító, pl. `mit-start` |
|
||||
| `productType` | select: `hosting` / `managed-service` | – | a menedzselt réteg külön oldalra kerül |
|
||||
| `status` | select: `draft` / `internal` / `publishable` / `active` / `retired`, alapérték `draft`, oldalsáv | – | életciklus (PLATFM-3) |
|
||||
| `name` | text | – | márkanév, pl. „mIT Start”, nyelvfüggetlen |
|
||||
| `sortOrder` | number | – | kártyasorrend |
|
||||
| `highlighted` | checkbox | – | „ajánlott” jelölés |
|
||||
| `public.audience`, `public.shortDescription`, `public.ctaText`, `public.seoDescription` | text/textarea | ✓ | |
|
||||
| `public.features` | stringArray | ✓ (tömbszinten) | kiemelt jellemzők |
|
||||
| `pricing.netAmount` | number, **kötelező**, egész, ≥ 0 | – | nettó ár forintban (PLATFM-14) |
|
||||
| `pricing.billingPeriod` | select: `monthly` / `yearly` / `one-time`, alapérték `yearly` | – | a tárhely csak éves (tulajdonosi döntés) |
|
||||
| `serviceDefinition.storageGb`, `mailStorageGb`, `domains`, `domainAliases`, `databases`, `mailboxes` | number | – | összehasonlító sorok |
|
||||
| `serviceDefinition.backup` | text | ✓ | pl. „Napi, 7 napos visszaállítással” |
|
||||
| `serviceDefinition.ssl`, `spamFilter` | checkbox | – | |
|
||||
| `enTranslationStatus` | `translationStatusField()` | – | MITHOME-113 kapu |
|
||||
|
||||
- A `status` leírása figyelmeztet: az „aktív” állapot productionben élesít, és csak üzleti jóváhagyás és védjegyvizsgálat után állítható be.
|
||||
- Verziózás: `collectionVersions`, a többi collectionhoz hasonlóan.
|
||||
|
||||
### D2: Életciklus-kapu (`src/lib/products.ts`)
|
||||
|
||||
- `showableStatuses(deployEnv)`: production → `['active']`; staging → minden, kivéve a `retired` állapotot.
|
||||
- `getHostingPlans(locale)`: `productType = hosting`, a kapu szerinti státusz, `sortOrder` szerint rendezve.
|
||||
- **Fordítási kapu termékenként:** a hu és az en lista olvasása után minden terméknél a `contentLocale(locale, enTranslationStatus)` dönti el, melyik nyelvi változat jelenik meg. Ez tiszta, tesztelhető függvény.
|
||||
- `hasHostingPlans()`: a menü és a sitemap ugyanazt a kaput használja, mint az oldal. Így a menü, a sitemap és az oldal nem mondhat ellent egymásnak.
|
||||
|
||||
### D3: Útvonal, menü, sitemap
|
||||
|
||||
- `PAGE_SLUGS.hostingPlans = { hu: 'tarhely-csomagok', en: 'hosting-plans' }`. Ezzel a nyelvváltó, a hreflang és a CTA-oldalválasztó automatikusan ismeri.
|
||||
- **Menü:** a `getMainNavigation(locale, { hostingPlans })` a Szolgáltatások után teszi be a pontot, ha van megjeleníthető csomag. A layout egyszer kérdezi le.
|
||||
- **Sitemap:** a `sitemapEntries(siteUrl, hiddenPages)` kihagyja a rejtett oldalt; a `sitemap.ts` a `hasHostingPlans()` alapján dönt.
|
||||
- **Tesztek:** a sitemap-URL-ek száma így 12 vagy 14 lehet. A MITHOME-127 production SEO-csomag fix 12-es elvárása erre módosul: legalább 12, és minden URL végleges.
|
||||
- **Menüfeliratok:** a `NAV_LABELS`-be kerülnek („Tárhelycsomagok” / „Hosting plans”), a meglévő minta szerint (statikus kétnyelvű navigáció).
|
||||
|
||||
### D4: `HostingPlans` global (oldalszöveg)
|
||||
|
||||
Mezők, mind lokalizáltak:
|
||||
- `meta { title, description }`;
|
||||
- `hero { title, subtitle }`;
|
||||
- `labels { storage, mailStorage, domains, domainAliases, databases, mailboxes, backup, ssl, spamFilter, perYear, perMonth, plusVat, grossPrice, recommended, included }`;
|
||||
- `largerNeeds { title, text, button }`.
|
||||
|
||||
Nem lokalizált: `vatRatePercent` (number, alapérték 27). A bruttó ár `round(netAmount × (1 + vatRatePercent / 100))`, egy tiszta, tesztelt függvényben (`src/lib/products.ts`, `grossAmount`). Az ÁFA-kulcs így egy helyen változtatható.
|
||||
|
||||
Mellé `enTranslationStatus` (fordítási kapu). A `payload-config.test.ts` lokalizációs szabálytesztje automatikusan kiterjed rá.
|
||||
|
||||
### D5: Megjelenítés
|
||||
|
||||
- `HostingPlansView` → kártyánként: név, célcsoport, rövid leírás, összehasonlító sorok (a `labels` felirataival), kiemelt jellemzők, ár. Az ár formája: nagyban a nettó („14 900 Ft + ÁFA / év”), alatta a bruttó („bruttó 18 923 Ft / év”); a számformázás `Intl.NumberFormat(locale)`. A CTA a Kapcsolat oldalra mutat. „Kérjen ajánlatot” csak a „Nagyobb igénye van?” blokkban szerepel.
|
||||
- A kiemelt csomag keretet és „Ajánlott” jelölést kap.
|
||||
- Reszponzív: mobilon egymás alatt, 768 px fölött egymás mellett.
|
||||
- A `generateMetadata` a globalból adja a címet és a leírást, `pageAlternates`-szel.
|
||||
|
||||
### D6: Kezdőadatok (`20260929_hosting_plans` migráció)
|
||||
|
||||
- A két termék **`draft`** állapotban, hu + en szövegekkel. A számok és az árak a PLATFM-14 katalógusból (`catalogVersion 0.1.1`) jönnek:
|
||||
- **mIT Start:** 3 GB, 1 GB levél, 1 domain, 1 adatbázis, 5 fiók; 14 900 Ft nettó / év;
|
||||
- **mIT Mid:** 8 GB, 4 GB levél, 1 domain + 2 alias, 2 adatbázis, 10 fiók, kiemelt; 23 900 Ft nettó / év.
|
||||
- A `HostingPlans` global `vatRatePercent` értéke 27.
|
||||
- A `HostingPlans` global szövegei; az angol változat AI-draft (`ai-draft` állapot).
|
||||
- Csak akkor hoz létre, ha a slug még nem létezik; meglévő adathoz nem nyúl. Idempotens.
|
||||
- **WHY `draft` és nem `publishable`:** a PLATFM-3 szerint a tartalom tervezet, és üzleti jóváhagyás kell hozzá. A staging a D2 szerint így is mutatja.
|
||||
- Az új magyar–angol párok bekerülnek a fordítási memóriába.
|
||||
|
||||
## Risks / Trade-offs
|
||||
|
||||
- **[Két adatforrás lesz, amikor a PLATFM-3 elkészül]** → Az olvasás egy helyen van (`src/lib/products.ts`), a szerkezet azonos, a csere lokális.
|
||||
- **[Egy draft csomag stagingen „élesnek” látszik]** → A staging nem indexelhető (MITHOME-116/127). A production-kapu tesztelt.
|
||||
- **[Egy menüpont és egy sitemap-bejegyzés dinamikus lekérdezése minden kérésnél]** → Egy kis Local API-olvasás a layoutban. Elfogadott; a teljes oldal is dinamikus (force-dynamic).
|
||||
- **[Védjegy]** → A production megjelenés feltétele az „aktív” állapot, amit csak a tulajdonos állít be a vizsgálat után. Ezt a mező leírása rögzíti.
|
||||
|
||||
## Migration Plan
|
||||
|
||||
1. Mentés, deploy. A `20260929_hosting_plans` induláskor lefut.
|
||||
2. Ellenőrzés a stagingen:
|
||||
- az oldal a két tervezet csomaggal látszik;
|
||||
- megjelenik a menüben;
|
||||
- a sitemap üres marad (staging);
|
||||
- a production-kapu tesztekkel igazolt.
|
||||
3. Élesítés később, az adminban: a státusz „aktív”-ra állítása.
|
||||
@@ -0,0 +1,52 @@
|
||||
# Proposal
|
||||
|
||||
## Why
|
||||
|
||||
Az éles környezet elemzése és a tulajdonos döntése (2026-09-29) szerint a weboldal két tárhelycsomagot kínál: **mIT Start** (3 GB) és **mIT Mid** (8 GB). Ezeket ma semmi nem mutatja be összehasonlíthatóan. A MITHOME-23 SEO-oldaltérképében ez a „szolgáltatót választ / ajánlatot kér” keresési szándék oldala.
|
||||
|
||||
A PLATFM-3 és a PLATFM-11 szerint a csomagadatok elsődleges forrása a központi termékkatalógus. Ennek első, fájlalapú változata a **PLATFM-14** (mitplatform, catalog-as-code, `catalogVersion 0.1.1`). Ebben rögzítettük a tulajdonos 2026-09-29-i árdöntését: nettó ár + 27% ÁFA, csak éves számlázás, mIT Start 14 900 Ft/év, mIT Mid 23 900 Ft/év. A csomagnevekre bevezetés előtt védjegyjogászi vizsgálat kell, a tartalomra pedig üzleti jóváhagyás.
|
||||
|
||||
## What Changes
|
||||
|
||||
- **Új `Products` Payload collection** a PLATFM-3 `Product { id, slug, status, name, public, serviceDefinition, lifecycle }` szerkezetében. Ez átmeneti adatforrás, és a központi katalógus elkészültekor az olvasási réteg cserélhető.
|
||||
- **Terméktípus:** `hosting` / `managed-service`. A menedzselt szolgáltatások (PLATFM-13, MITHOME-132) később ugyanide kerülnek, de külön oldalon jelennek meg.
|
||||
- **Életciklus-állapot:** tervezet / belső / publikálható / aktív / kivezetett (PLATFM-3).
|
||||
- **Publikus mezők (lokalizáltan):** név, célcsoport, rövid leírás, kiemelt jellemzők, CTA, SEO-szöveg.
|
||||
- **Árazás (PLATFM-14 szerződés):** kötelező nettó ár, számlázási periódus. A bruttót az oldal számolja a globalban tárolt ÁFA-kulcsból (27%).
|
||||
- **Szolgáltatás-definíció:** tárhely, levéltárhely, domain, adatbázis, e-mail-fiókok, mentés, SSL, spamszűrés.
|
||||
- A belső üzemeltetési mezők (runbook, felelős) **nem** kerülnek a weboldalra; ezek a Portal/katalógus dolga.
|
||||
- **Állapotkapu (felhasználói döntés):**
|
||||
- A production csak **aktív** csomagot mutat.
|
||||
- A staging a kivezetett kivételével minden állapotot mutat, hogy a tervezet ott átnézhető legyen (a staging nem indexelhető).
|
||||
- Ha nincs megjeleníthető csomag, az oldal 404-et ad, és sem a menüben, sem a sitemapben nem szerepel.
|
||||
- **Új oldal:** `/hu/tarhely-csomagok` – `/en/hosting-plans` (felhasználói döntés).
|
||||
- Összehasonlító, reszponzív kártyák, a kiemelt csomag jelölésével.
|
||||
- **Konkrét ár** kártyánként: nettó éves díj „+ ÁFA” jelöléssel és mellette a bruttó (felhasználói döntés: konkrét árak, „Kérjen ajánlatot” nélkül).
|
||||
- „Nagyobb igénye van? Kérjen egyedi ajánlatot” blokk, mert a nagyobb csomagok most nem termékek.
|
||||
- Az oldal szövegei (meta, cím, bevezető, CTA, összehasonlító feliratok) egy új, lokalizált **`HostingPlans` globalban** vannak, a MITHOME-113 fordítási kapujával.
|
||||
- **Kezdőadatok migrációval:** a két csomag **tervezet** állapotban, a PLATFM-14 katalógus adataival és áraival, és a `HostingPlans` global szövegei, magyarul és angol AI-drafttal. Az adatok a szövegcsere-lista (MITHOME-129) tényeivel összhangban vannak. A production élesítéshez az „aktív” állapotot az adminban kell beállítani, az üzleti jóváhagyás és a védjegyvizsgálat után.
|
||||
|
||||
## Capabilities
|
||||
|
||||
### New Capabilities
|
||||
|
||||
- `hosting-plans`: a tárhelycsomagok adatmodellje, életciklus-kapuja és publikus összehasonlító oldala.
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
- Nincs. A `public-site` útvonal-, sitemap- és nyelvváltó-követelményei már lefedik az új oldalt.
|
||||
|
||||
## Impact
|
||||
|
||||
- **Kód:**
|
||||
- új `proto/src/collections/Products.ts`, `proto/src/globals/HostingPlans.ts`, `proto/src/lib/products.ts` (kapu, nézetmodell);
|
||||
- új `proto/src/components/views/HostingPlansView.tsx`;
|
||||
- `proto/src/lib/i18n.ts` (`PAGE_SLUGS`), `proto/src/config/site.ts` (menü), `proto/src/lib/seo.ts` / `proto/src/app/sitemap.ts` (feltételes sitemap-bejegyzés);
|
||||
- `proto/src/app/(frontend)/[locale]/[slug]/page.tsx`;
|
||||
- új migráció és tesztek.
|
||||
- **Adat:** új `products` collection és `hosting-plans` global a stagingen, tervezet állapotú kezdőadatokkal.
|
||||
- **Függőség:** a production megjelenés feltétele a tulajdonosi jóváhagyás, a mIT-nevek védjegyvizsgálata (PLATFM-3) és a MITHOME-129 jogi része.
|
||||
- **Kívül esik a scope-on:**
|
||||
- rendelés/online megrendelés;
|
||||
- a menedzselt szolgáltatások oldala (MITHOME-132);
|
||||
- a központi katalógus API-ja (PLATFM-3).
|
||||
@@ -0,0 +1,78 @@
|
||||
# Spec Delta
|
||||
|
||||
## Purpose
|
||||
|
||||
Describes how the website stores, gates and presents its hosting plans (currently mIT Start and mIT Mid), as an interim product catalogue that follows the central catalogue model (PLATFM-3).
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Product records follow the central catalogue model
|
||||
|
||||
The CMS SHALL store each plan as a product record with a stable slug, a product type
|
||||
(hosting or managed service), a lifecycle status (draft, internal, publishable, active,
|
||||
retired), localized public fields (audience, short description, key features, call to
|
||||
action), a required net price with its billing period, and a service definition
|
||||
(storage, mail storage, domains, databases, mailboxes, backup, SSL, spam filtering).
|
||||
Prices and service figures SHALL match the central product catalogue (PLATFM-14).
|
||||
Internal operations data SHALL NOT be stored in or exposed by the website.
|
||||
|
||||
#### Scenario: An administrator creates a plan
|
||||
|
||||
- **WHEN** an administrator creates a hosting product with the required fields
|
||||
- **THEN** the CMS SHALL persist it with its status, public fields and service
|
||||
definition
|
||||
|
||||
#### Scenario: A plan is saved without a price
|
||||
|
||||
- **WHEN** an administrator saves a product without a net price
|
||||
- **THEN** the CMS SHALL reject it with a validation error
|
||||
|
||||
#### Scenario: A plan shows its price with VAT
|
||||
|
||||
- **WHEN** a visitor views a plan with a net price of 14 900 Ft per year and the VAT
|
||||
rate is 27%
|
||||
- **THEN** the card SHALL show "14 900 Ft + VAT / year" (localized) and the gross price
|
||||
of 18 923 Ft per year, and SHALL NOT show a "request a quote" text instead of the price
|
||||
|
||||
### Requirement: Lifecycle gate for public plans
|
||||
|
||||
The production site SHALL show only products in the "active" status. The staging site
|
||||
SHALL show every product except "retired" ones, so that drafts can be reviewed there.
|
||||
When no product is showable, the hosting plans page SHALL return not found and SHALL be
|
||||
omitted from the main navigation and the sitemap.
|
||||
|
||||
#### Scenario: Draft plans in production
|
||||
|
||||
- **WHEN** all hosting products are drafts and the production site receives a request
|
||||
for the hosting plans page
|
||||
- **THEN** it SHALL respond with not found, and the page SHALL NOT appear in the menu or
|
||||
the sitemap
|
||||
|
||||
#### Scenario: Draft plans on staging
|
||||
|
||||
- **WHEN** the same draft products exist on the staging site
|
||||
- **THEN** the staging hosting plans page SHALL show them for review
|
||||
|
||||
#### Scenario: A plan is activated
|
||||
|
||||
- **WHEN** an administrator sets a product to "active"
|
||||
- **THEN** the production hosting plans page SHALL show it without a redeployment
|
||||
|
||||
### Requirement: Hosting plans comparison page
|
||||
|
||||
The site SHALL serve the hosting plans page at `/hu/tarhely-csomagok` and
|
||||
`/en/hosting-plans`. It SHALL show the showable hosting products as comparable cards in
|
||||
their configured order, mark the highlighted plan, and offer a call to action for larger
|
||||
needs. All page copy SHALL come from the CMS in the requested locale, and English copy
|
||||
SHALL follow the translation status gate.
|
||||
|
||||
#### Scenario: Visitor compares the plans
|
||||
|
||||
- **WHEN** a visitor opens the hosting plans page with two showable plans
|
||||
- **THEN** the page SHALL show both plans with their storage, mail storage, domains,
|
||||
databases and mailboxes side by side, and the highlighted plan SHALL be marked
|
||||
|
||||
#### Scenario: Managed services are not mixed in
|
||||
|
||||
- **WHEN** a managed-service product exists
|
||||
- **THEN** it SHALL NOT appear on the hosting plans page
|
||||
@@ -0,0 +1,29 @@
|
||||
# Tasks
|
||||
|
||||
## 1. Adatmodell és kapu
|
||||
|
||||
- [x] 1.1 A `Products` collection (D1) és a `HostingPlans` global (D4) elkészítése és regisztrálása, a típusok újragenerálása. Ellenőrzés: config tesztek (mezők, lokalizációs szabály, a státusz alapértéke `draft`, `productType` opciók, a `pricing.netAmount` kötelező, a `vatRatePercent` alapértéke 27), `tsc`.
|
||||
- [x] 1.2 `src/lib/products.ts`: `showableStatuses`, termékenkénti nyelvi kapu, `getHostingPlans`, `hasHostingPlans` (D2). Unit tesztek: production csak `active`; staging minden, kivéve `retired`; `managed-service` kiszűrve; `sortOrder`; approved → en, egyébként hu; `grossAmount` (14 900 → 18 923, 23 900 → 30 353, kerekítés). Ellenőrzés: `npm test`.
|
||||
|
||||
## 2. Útvonal, menü, sitemap
|
||||
|
||||
- [x] 2.1 `PAGE_SLUGS.hostingPlans`, feltételes menüpont (`getMainNavigation(locale, { hostingPlans })`), feltételes sitemap-bejegyzés (`sitemapEntries(…, hiddenPages)`) és a layout/sitemap bekötése (D3). A meglévő i18n-, seo- és Header-tesztek frissítése, új tesztek a rejtett és a látható esetre. A production SEO-csomag 12-es fix elvárásának átírása „legalább 12”-re. Ellenőrzés: `npm test`, `tsc`, lint.
|
||||
|
||||
## 3. Oldal
|
||||
|
||||
- [x] 3.1 `HostingPlansView` és a catch-all oldal ága (`hostingPlans` kulcs): 404, ha nincs megjeleníthető csomag; `generateMetadata` a globalból, `pageAlternates`-szel (D5). Komponensteszt: két kártya, összehasonlító sorok, kiemelés, nettó ár „+ ÁFA / év” és bruttó ár (hu és en formázás), „Kérjen ajánlatot” csak a nagyobb igény blokkban. Ellenőrzés: `npm test`.
|
||||
|
||||
## 4. Kezdőadatok
|
||||
|
||||
- [x] 4.1 A `20260929_hosting_plans` migráció (D6): két `draft` termék a PLATFM-14 (0.1.1) adataival és áraival, a global szövegei hu + en nyelven, `vatRatePercent` 27; az en AI-draft; idempotens; a fordítási memória bővítése. Unit teszt a fake Mongóval (létrehozás, meglévő slugot nem ír felül, második futás 0). Ellenőrzés: `npm test`.
|
||||
|
||||
## 5. Élő ellenőrzés és lezárás
|
||||
|
||||
- [x] 5.1 A staging-másolaton (eldobható konténer):
|
||||
- production-módú build: az oldal 404, nincs benne a menüben és a sitemapben (draft);
|
||||
- staging-módú build: az oldal a két csomaggal látszik, és benne van a menüben;
|
||||
- a nyelvváltó `/hu/tarhely-csomagok` ↔ `/en/hosting-plans`;
|
||||
- böngészőben asztali és mobil nézet.
|
||||
|
||||
Új staging smoke teszt: SMOKE-10 (az oldal és a menüpont). Utána takarítás.
|
||||
- [x] 5.2 `npm test`, lint, build, pre-deploy készlet zöld. Plane (MITHOME-130) és `TODO.md` szinkron, commit, push. A staging deploy külön jóváhagyással történik.
|
||||
@@ -0,0 +1,127 @@
|
||||
# Design
|
||||
|
||||
## Context
|
||||
|
||||
- **Mai állapot:**
|
||||
- Payload 3.88, `mongooseAdapter`, `prodMigrations` induláskor (MITHOME-111);
|
||||
- staging: `mozdit-mongodb-staging` (mongo:7.0); élesben még nincs adat;
|
||||
- a konténer Node 20-at használ, a helyi gépen Node 26 fut: a Payload parancssori eszköze ott `ERR_REQUIRE_ASYNC_MODULE`-lal leáll.
|
||||
- **Mongo-függő kód:**
|
||||
- a 8 adatmigráció közvetlen Mongo-írással (`rewriteDocs`);
|
||||
- a `src/lib/mongodb.ts`, amely a MITHOME-94 óta halott kód, és a health-check sem használja;
|
||||
- a fake-Mongo tesztsegéd és az integrációs tesztek.
|
||||
- **Platform:** mitplatform ADR-0001 és PLATFM-15; egy PostgreSQL-szerver, külön adatbázisok.
|
||||
|
||||
## Goals / Non-Goals
|
||||
|
||||
**Goals:**
|
||||
|
||||
- a weboldal PostgreSQL-en fut, sémamigrációkkal;
|
||||
- a staging tartalma veszteségmentesen átkerül;
|
||||
- ellenőrizhető átállás, visszaút az élesítésig.
|
||||
|
||||
**Non-Goals:**
|
||||
|
||||
- a verzióelőzmények átvitele;
|
||||
- a Node emelése a konténerben;
|
||||
- a katalógus-adatbázis és a szinkron (PLATFM-15, külön ticket).
|
||||
|
||||
## Decisions
|
||||
|
||||
### D1: Illesztő és azonosítók
|
||||
|
||||
- `@payloadcms/db-postgres` a Payloaddal azonos verzióban, `idType: 'uuid'`, `push: false`.
|
||||
- **WHY UUID:** átlátszatlan, nem sorszámot kiadó azonosítók. Az adatmigrációnál és a későbbi katalógus-összekötésnél nincs ütközés.
|
||||
- **WHY push nélkül:** a séma egyetlen forrása a migráció. Ugyanaz fut helyben, stagingen és élesben.
|
||||
|
||||
### D2: Sémamigrációk és eszközök
|
||||
|
||||
- A kiinduló migráció a teljes jelenlegi config sémája: `payload migrate:create initial`. A `src/migrations/index.ts` ezzel indul újra.
|
||||
- **A parancssori eszköz hibájának valódi oka** (az 1.1-es feladatban derült ki): nem a Node-verzió. A `proto/package.json`-ban nem volt `"type": "module"`, ezért a Payload parancssori eszköze a configot CommonJS-ként töltötte be, és nem tudta behúzni az ESM-es, top-level await-es `@payloadcms/richtext-lexical`-t. Node 22 alatt is ugyanez a hiba jött.
|
||||
- **Megoldás:** `"type": "module"`, ahogy a Payload hivatalos sablonja is csinálja. A CommonJS jest-fájlok és a `src/content/schema.js` `.cjs` kiterjesztést kaptak. Ellenőrizve: a parancssori eszköz Node 26-on is betölti a configot; a Next `standalone` `server.js` ESM-es, és elindul. A `--input-type=module` kerülőút megszűnik.
|
||||
- A generált migráció (`src/migrations/<időbélyeg>_*.ts`, a kiinduló 1548 soros) kivétel a 400 soros fájlkorlát és a lint alól: generált kód, kézzel nem szerkesztjük.
|
||||
- **Közös config:** a `src/payload.shared.ts` mindent tartalmaz az adatbázis-illesztő kivételével. A `payload.config.ts` ebből épül PostgreSQL-lel, az átviteli script MongoDB-vel, így a tartalommodell nem térhet el.
|
||||
- **Seed-konstansok:** a referenciák és a tárhelycsomagok szövegei a `src/content/seeds/` alá költöztek.
|
||||
- A Mongo-adatmigrációk (8 fájl) és a segédfüggvényeik törlődnek. Az általuk elért állapot a stagingadatban van, és azt a D3 hozza át.
|
||||
|
||||
### D3: Egyszeri adatátvitel (`proto/scripts/transfer-content.ts`)
|
||||
|
||||
Két lépés, lépésenként egy Payload-példánnyal, a Payload saját interfészén. Nem nyers Mongo-dokumentumokkal dolgozik:
|
||||
|
||||
- **`export`:** a `sharedConfig` + MongoDB-illesztő olvas mindent `locale: 'all'`-lal (a lokalizált mező `{ hu, en }`), a nyitott vázlatokkal és a médiafájlokkal együtt, egy önálló JSON-csomagba (600-as jogosultság; kapcsolatfelvételi üzenetekkel személyes adatot tartalmaz, `--no-submissions` nélkül nem kerülhet Gitbe). A felhasználókat nem visszük át; az admint a `deploy.sh` seedelése hozza létre.
|
||||
- **`import`:** a webhely configja (PostgreSQL) **egy tranzakcióban** ír. Hibánál semmi nem marad bent; nem üres célnál el sem indul.
|
||||
- Nyelvenként ír: `hu` létrehozás, `en` frissítés, a config mezőleírása alapján (`src/lib/content-transfer.ts`, tiszta, tesztelt függvények).
|
||||
- A tömbsorok azonosítója megmarad, hogy az angol frissítés ugyanazokat a sorokat találja meg.
|
||||
- Az upload-hivatkozások az új azonosítókra képződnek le. A média `overwriteExistingFiles`-szal íródik, így a fájlnév változatlan marad.
|
||||
- **Futtatás:** 2026-09-29-én egy staging-másolaton, eldobható MongoDB-vel és PostgreSQL-lel az llmdev-en.
|
||||
- A számok egyeznek.
|
||||
- Mind a 14 publikus oldal szövege (hu és en) betűre egyezik a MongoDB-s staginggel.
|
||||
- A partnerlogó betölt, a partnervázlat átjött, a második futás semmit sem ír.
|
||||
|
||||
**A próba során talált két adatmodell-hiba** (MongoDB-ben rejtve maradtak):
|
||||
|
||||
1. **A jogi szakasz `id`-ja tartalmi horgony volt** (`bevezetes`), és egyben a tömbsor azonosítója. PostgreSQL-ben a tömbsor azonosítója táblaszinten egyedi kulcs, így a két jogi oldal ütközött. Javítás:
|
||||
- új `anchor` mező, a sorazonosítót a Payload adja;
|
||||
- az átvitel az `id`-t `anchor`-ra képezi, a sorazonosító `<slug>-<horgony>` lesz (`upgradeDoc`).
|
||||
2. **A `Products.status` enumja ugyanazt a nevet kapta**, mint a vázlatrendszer `_status`-a (`enum_products_status`). Emiatt csak a `draft` és a `published` érték volt menthető, az `active` nem. Javítás: saját `enumName` (`enum_products_lifecycle_status`), regressziós teszttel.
|
||||
|
||||
**Ismert korlát:** a Home `about.usps` és `services.items` sorai szintén saját, szerkeszthető `id`-t használnak. Egyetlen Global-dokumentum van, ezért nem ütközik, de egy duplikált azonosító mentési hibát adna. Külön ticket (átnevezés `key`-re).
|
||||
|
||||
### D4: Infrastruktúra
|
||||
|
||||
- **Compose (staging, prod)**, a Docker-háttér specifikáció szerint (`~/Projects/maintenance/docker-hatter-specifikacio.md`, 4., 5. és 7. pont):
|
||||
- `postgres:16-alpine` szolgáltatás `mozdit-postgres-<env>` névvel (a `mozdit-mongodb-<env>` mintájára);
|
||||
- `restart: unless-stopped`, healthcheck `pg_isready`-vel, `json-file` logkorlát (100m × 3), memórialimit (1G);
|
||||
- a projekt saját hálózatán, névvel ellátott volume-mal;
|
||||
- **nincs host-port**: az app a Compose-hálózaton éri el. Az 5432 foglalt (peakxi-dev). Ha kézi eszközhöz mégis kell port, csak szabad, `127.0.0.1`-re kötött, a portregiszterbe előre bejegyzett port használható;
|
||||
- a jelszó csak az `.env`-ben van, fallback nincs;
|
||||
- az adatbázis `mozdit_web`, külön felhasználóval.
|
||||
|
||||
Később ugyanitt lesz a `mozdit_catalog` adatbázis (PLATFM-15), saját felhasználóval.
|
||||
- **Port-ellenőrzés minden portdefiníció előtt** (tulajdonosi szabály, MITHOME-137): `scripts/check-ports.sh` a Compose-fájlra és minden eldobható konténer vagy alagút portjára, még az indítás előtt. A `deploy.sh` a build előtt automatikusan futtatja.
|
||||
- **Eldobható tesztkonténerek:** `mozdit-<cél>-test` név; a munka végén törölni kell őket.
|
||||
- **Környezeti változó:** `DATABASE_URI` (`postgresql://…`). A `MONGODB_URI` és a `MONGODB_DB` kikerül.
|
||||
- **`deploy.sh`:** a deploy előtt `pg_dump -Fc` mentés `~/backups/`-ba, 600-as jogosultsággal. A mostani kézi `mongodump` lépés helyett.
|
||||
- **Átmenet:** a MongoDB-szolgáltatás és a volume egy kiadásig megmarad, csak olvasásra, visszaútnak. A sikeres ellenőrzés után törlődik a Compose-ból, a végső `mongodump` archívummal együtt.
|
||||
|
||||
### D5: Tesztek
|
||||
|
||||
- A migrációs tesztek (fake-Mongo) az érintett migrációkkal együtt törlődnek.
|
||||
- **Az adatmigrációs script tesztje:** a transzformációs függvények (lokalizált alak, azonosítótérkép, vázlat kiválasztása) tiszta unit tesztek.
|
||||
- **Az integrációs és e2e tesztek** eldobható PostgreSQL-lel futnak az llmdev szerveren, a Docker-spec szerint.
|
||||
- **A config tesztjei** (`payload-config.test.ts`) nem változnak: nem függenek az illesztőtől.
|
||||
|
||||
## Risks / Trade-offs
|
||||
|
||||
- **[A Payload PostgreSQL-illesztője más szigorral kezeli a lokalizált tömböket és a kötelező mezőket]** → Az adatmigráció egy staging-másolaton fut; a nem átvihető dokumentumokat a script listázza, és nem ugorja át csendben.
|
||||
- **[A verzióelőzmények elvesznek]** → A migráció előtti `mongodump` archívum megmarad. A 2026-09-29 előtti előzményekre élesítés előtt nincs üzleti igény.
|
||||
- **[A kiinduló migráció nagy és generált]** → Csak a Payload generálja; kézzel nem szerkesztjük.
|
||||
- **[A Node 22 és a konténer Node 20-ja eltér]** → A migrációs fájl JS/TS kód, futásidőben verziófüggetlen. A konténer Node-verziójának emelése külön ticket.
|
||||
|
||||
## Migration Plan
|
||||
|
||||
**Staging-átállás lépései** (4.1; a Macről, a WireGuard VPN-en át az llmdev-re):
|
||||
|
||||
1. **Merge:** a `feature/MITHOME-136-postgres` ág a `main`-re. A `.env.staging`-be a szerveren felkerül a `POSTGRES_PASSWORD` (`openssl rand -hex 32`).
|
||||
2. **Export a futó staging MongoDB-ből**, még a deploy előtt. SSH-alagút a `127.0.0.1:27019`-re (port-ellenőrzés után), a staging MongoDB hitelesítő adataival:
|
||||
`transfer-content.ts export <csomag> --media-dir <a staging media volume másolata>`.
|
||||
3. **Deploy:** `deploy_to_stage_on_local.sh`. A `deploy.sh` a build előtt ment (`mongodump`), a PostgreSQL üresen indul, az app induláskor lefuttatja a kiinduló migrációt, és a `first-register` létrehozza az admint.
|
||||
4. **Import:** SSH-alagút a `mozdit-postgres-staging` konténer címére, `transfer-content.ts import <csomag>`. Ellenőrzés:
|
||||
- a számok;
|
||||
- a 14 publikus oldal szövege a 2. lépés előtti pillanatképpel;
|
||||
- a partnerlogó;
|
||||
- a smoke tesztek.
|
||||
5. **Rövid állásidő:** a 3. és 4. lépés között a staging oldalai tartalom nélkül futnak. Ez stagingen elfogadható.
|
||||
|
||||
**Visszaút az élesítésig:** a MongoDB-szolgáltatás és a volume érintetlen. A `main` visszaállítása az átállás előtti commitra, majd `deploy.sh staging`.
|
||||
|
||||
|
||||
1. Staging-másolaton (eldobható Mongo és PostgreSQL az llmdev-en): kiinduló migráció, adatmigráció, ellenőrzés (D3).
|
||||
2. Staging deploy:
|
||||
- `mongodump` archív mentés;
|
||||
- új Compose PostgreSQL-lel;
|
||||
- adatmigráció a futó staging Mongóból;
|
||||
- ellenőrzés és smoke tesztek.
|
||||
3. Egy kiadás múlva: a MongoDB kivezetése a Compose-ból, a `mongodb` csomagok törlése.
|
||||
|
||||
**Visszaút az élesítésig:** a commit visszaállítása és a MongoDB-volume újraindítása.
|
||||
@@ -0,0 +1,46 @@
|
||||
# Proposal
|
||||
|
||||
## Why
|
||||
|
||||
A tulajdonos 2026-09-29-én döntött:
|
||||
|
||||
- a termékkatalógus PostgreSQL-ben lesz, idősoros modellel (mitplatform PLATFM-15, ADR-0001);
|
||||
- egy PostgreSQL-szerver fut, külön adatbázissal a katalógusnak és a weboldalnak;
|
||||
- a weboldal **az élesítés előtt** áll át MongoDB-ről PostgreSQL-re.
|
||||
|
||||
Élesben még nincs adat, csak stagingadat, ezért most a legolcsóbb az átállás. Egy adatbázis-technológia marad (a célarchitektúra szerint PostgreSQL), közös üzemeltetéssel és mentéssel. Plane: **MITHOME-136**.
|
||||
|
||||
## What Changes
|
||||
|
||||
- **Payload adatbázis-illesztő:** `@payloadcms/db-mongodb` helyett `@payloadcms/db-postgres`, UUID-azonosítókkal. A séma csak migrációkkal változik; a fejlesztői „push” ki van kapcsolva.
|
||||
- **Új kiinduló migráció:** a jelenlegi config teljes sémája. A 8 Mongo-specifikus adatmigráció és a segédfüggvényeik (`rewriteDocs`, `localize-paths`, `migrate-global-docs`) kivezetésre kerülnek; a Git-előzmény megőrzi őket.
|
||||
- **Egyszeri adatmigráció** a staging MongoDB-ből a PostgreSQL-be:
|
||||
- minden Global és Collection publikált állapota mindkét nyelven, plusz a nyitott vázlatok;
|
||||
- a médiadokumentumok a meglévő fájlokkal;
|
||||
- a kapcsolatfelvételi üzenetek.
|
||||
|
||||
A felhasználókat nem visszük át: az admin a `deploy.sh` meglévő seedelésével jön létre. Ellenőrzés: dokumentumszámok és a publikus oldalak HTML-összevetése hu/en nyelven, a migráció előtt és után.
|
||||
- **Infrastruktúra:**
|
||||
- PostgreSQL 16 szolgáltatás a staging és a prod Compose-ban, csak belső hálózaton;
|
||||
- új változó: `DATABASE_URI` (a `MONGODB_URI` helyett);
|
||||
- a `deploy.sh` a deploy előtt `pg_dump` mentést készít.
|
||||
- **Eszközök:** `"type": "module"` a `proto/package.json`-ban (a CommonJS jest-fájlok `.cjs`-re nevezve). Ezzel a Payload parancssori eszköze Node 26-on is működik; az `ERR_REQUIRE_ASYNC_MODULE` oka a CommonJS-betöltés volt, nem a Node-verzió.
|
||||
- **Kivezetés:** a halott `src/lib/mongodb.ts`, a `mongodb` és a `@payloadcms/db-mongodb` csomag, a Mongo-utánzatos tesztek, valamint a MongoDB-szolgáltatás a Compose-ból egy kiadással később, sikeres ellenőrzés után.
|
||||
- **Dokumentáció:** `CLAUDE.md` (stack, környezeti változók), `.agent/steering/architecture.md`, `DOCKER.md`, `deploy.md`.
|
||||
|
||||
## Capabilities
|
||||
|
||||
### New Capabilities
|
||||
|
||||
- Nincs.
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
- `content-management`: a tartalom tárolása relációs adatbázisban, és a meglévő tartalom veszteségmentes átvitele.
|
||||
|
||||
## Impact
|
||||
|
||||
- **Kód:** `proto/src/payload.config.ts`, `proto/src/migrations/*`, `proto/src/lib/{migrate-global-docs,localize-paths,mongodb}.ts`, `proto/src/__tests__/*migration*`, `proto/src/__tests__/helpers/fake-mongo.ts`, az integrációs tesztek, új `proto/scripts/migrate-mongo-to-postgres.ts`, `proto/package.json`.
|
||||
- **Infra:** `docker-compose.staging.yml`, `docker-compose.prod.yml`, `deploy.sh`, a `.env` sablonok.
|
||||
- **Adat:** a staging tartalom egyszer átkerül. A verzióelőzmények nem jönnek át, a PostgreSQL-ben új előzmény indul. A migráció előtti `mongodump` archív mentésként megmarad.
|
||||
- **Kívül esik:** a katalógus-adatbázis (PLATFM-15) és a weboldal katalógus-szinkronja (külön ticket); a Node-verzió emelése a konténerben.
|
||||
@@ -0,0 +1,47 @@
|
||||
# Spec Delta
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Relational content storage
|
||||
|
||||
The CMS SHALL store all site content, media metadata, contact submissions and users in a
|
||||
PostgreSQL database dedicated to the website, separate from other databases on the same
|
||||
server. The database schema SHALL change only through versioned migrations that run
|
||||
automatically on production-mode startup before the site serves requests.
|
||||
|
||||
#### Scenario: Startup with a pending schema migration
|
||||
|
||||
- **WHEN** a new release with a pending schema migration starts in production mode
|
||||
- **THEN** the migration SHALL be applied before the site serves content, and a second
|
||||
start SHALL apply nothing
|
||||
|
||||
#### Scenario: Separate databases on one server
|
||||
|
||||
- **WHEN** the website connects to the PostgreSQL server
|
||||
- **THEN** it SHALL use its own database and credentials and SHALL NOT be able to write
|
||||
to the product catalogue database
|
||||
|
||||
### Requirement: Lossless migration of existing content to PostgreSQL
|
||||
|
||||
The existing MongoDB content SHALL be transferred to PostgreSQL once, before the
|
||||
production launch. For every global and collection the published state in both locales
|
||||
and any open draft SHALL be preserved; media documents SHALL keep their files and
|
||||
references; contact submissions SHALL be preserved. Public pages SHALL render the same
|
||||
content before and after the migration.
|
||||
|
||||
#### Scenario: Compare public pages after the migration
|
||||
|
||||
- **WHEN** the migration has run on a copy of the staging data
|
||||
- **THEN** the document counts per global and collection SHALL match, and the rendered
|
||||
text of every public page in Hungarian and English SHALL equal the pre-migration
|
||||
snapshot
|
||||
|
||||
#### Scenario: Partner logo references survive
|
||||
|
||||
- **WHEN** a partner referenced a media document before the migration
|
||||
- **THEN** it SHALL reference the migrated media document with the same file afterwards
|
||||
|
||||
#### Scenario: Re-running the migration
|
||||
|
||||
- **WHEN** the migration script runs again on the same target
|
||||
- **THEN** it SHALL detect the existing data and change nothing
|
||||
@@ -0,0 +1,25 @@
|
||||
# Tasks
|
||||
|
||||
## 1. Eszközök és illesztő
|
||||
|
||||
- [x] 1.1 `"type": "module"`, a CommonJS jest-fájlok és a `schema` `.cjs`-re nevezve, az ESLint-globok frissítve (D2). Ellenőrzés: a `payload migrate:status` betölti a configot; 516 unit teszt, tsc, lint, build és a `standalone` `server.js` indítása zöld.
|
||||
- [x] 1.2 `@payloadcms/db-postgres` (Payload-verzióval azonos), `postgresAdapter({ idType: 'uuid', push: false })`, `DATABASE_URI`. Ellenőrzés: `tsc`, `npm test`.
|
||||
- [x] 1.3 Kiinduló migráció (`migrate:create initial`), új `src/migrations/index.ts`; a 8 Mongo-migráció, a `migrate-global-docs`, a `localize-paths`, a `mongodb.ts` és a fake-Mongo tesztek törlése. Ellenőrzés: eldobható PostgreSQL-en a migráció kétszer fut, a második 0 lépés.
|
||||
|
||||
## 2. Adatmigráció
|
||||
|
||||
- [x] 2.1 `scripts/transfer-content.ts` (export/import) és `src/lib/content-transfer.ts` tiszta, tesztelt függvényekkel (nyelvi bontás, sorazonosítók, azonosítótérkép, `upgradeDoc`) (D3).
|
||||
- [x] 2.2 Futtatás egy staging-másolaton (eldobható Mongo és PostgreSQL az llmdev-en). Ellenőrzés: dokumentumszámok, a publikus hu/en oldalak szöveg-összevetése a pillanatképpel, partnerlogók, idempotens második futás.
|
||||
|
||||
## 3. Infrastruktúra
|
||||
|
||||
- [x] 3.1 Port-ellenőrzés (`scripts/check-ports.sh`) az új Compose-fájlokra, az indítás előtt. Compose (staging, prod): PostgreSQL 16 szolgáltatás, `mozdit_web` adatbázis és felhasználó, belső hálózat, volume; `.env` sablonok (D4).
|
||||
- [x] 3.2 `deploy.sh`: automatikus mentés a build előtt (`pg_dump` és az átállás idejére `mongodump`); a mentési blokkot a szerveren kipróbáltuk. Az admin-seedelés változatlanul a `first-register` végponttal. Ellenőrzés: a `pre-deploy-tests.sh` és a staging smoke tesztek.
|
||||
- [ ] 3.3 Az integrációs és e2e tesztek eldobható PostgreSQL-lel (D5). *Átírva (a `pg` klienssel; a dev compose PostgreSQL-re állt, host-port 5433, bejegyezve); élő dev stacken még nem futott.*
|
||||
|
||||
## 4. Kiadás és kivezetés
|
||||
|
||||
- [ ] 4.1 Staging-átállás a Migration Plan szerint (külön jóváhagyással), `mongodump` archívummal.
|
||||
- [x] 4.2 Dokumentáció: `CLAUDE.md` (stack, környezeti változók), `.agent/steering/architecture.md`, `DOCKER.md`, `.agent/workflows/deploy.md`.
|
||||
- [ ] 4.3 Egy kiadás múlva: a MongoDB-szolgáltatás és a `mongodb`, illetve `@payloadcms/db-mongodb` csomag törlése; a végső archívum helyének rögzítése.
|
||||
- [ ] 4.4 Plane (MITHOME-136) és `TODO.md` szinkron, commit, push.
|
||||
@@ -0,0 +1,27 @@
|
||||
schema: spec-driven
|
||||
|
||||
context: |
|
||||
Language: Hungarian
|
||||
All artifacts must be written in Hungarian.
|
||||
Keep OpenSpec structural headings and SHALL/MUST keywords in English.
|
||||
Project: mozdIT Bt. marketing website, built with Next.js App Router, React, TypeScript, Tailwind CSS, Payload CMS, and MongoDB.
|
||||
Architecture: website content is managed in Payload Globals/Collections and read through proto/src/lib/payload-content.ts; do not hardcode editable content in UI components.
|
||||
Plane project MITHOME is the authoritative task tracker. OpenSpec changes/specs describe requirements and implementation intent; they do not replace Plane status tracking or TODO.md synchronization.
|
||||
Follow .agent/AGENTS.md and .agent/steering/ for repository conventions, security, accessibility, and testing requirements.
|
||||
|
||||
rules:
|
||||
proposal:
|
||||
- Use OpenSpec for multi-step features, externally observable behavior changes, API/data model changes, and architectural decisions; small isolated bug fixes may use the existing fix workflow directly.
|
||||
- Identify relevant Plane MITHOME issues when known; do not invent issue identifiers.
|
||||
tasks:
|
||||
- Keep implementation tasks actionable and small; include relevant tests, documentation, and verification.
|
||||
- Plane remains authoritative for task ownership and status; keep Plane and TODO.md synchronized through the existing project process.
|
||||
|
||||
operations:
|
||||
apply:
|
||||
guidance:
|
||||
- Follow the project test and quality gates in .agent/steering/testing.md; never mark a task complete before its verification passes.
|
||||
- Keep user-editable website content in Payload CMS, not hardcoded in React components.
|
||||
archive:
|
||||
guidance:
|
||||
- Preserve archived change records as project history; do not remove openspec/specs or openspec/changes/archive.
|
||||
@@ -0,0 +1,47 @@
|
||||
# Application Logging Specification
|
||||
|
||||
## Purpose
|
||||
|
||||
Ez a capability egységes, biztonságos szerveroldali alkalmazásnaplókat biztosít,
|
||||
amelyeket a futtatókörnyezet vagy egy későbbi központi gyűjtő külön alkalmazáskód-módosítás nélkül felvehet.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement: Strukturált szerveroldali alkalmazásnaplók
|
||||
|
||||
Az alkalmazás SHALL a szerveroldali működési és hibanaplókat a standard outputra vagy
|
||||
standard errorre írni. Production környezetben a rekordok SHALL strukturált JSON
|
||||
formátumúak legyenek, és tartalmazzanak időbélyeget, súlyossági szintet, szolgáltatás-,
|
||||
környezet- és komponens-metaadatot. A naplózás SHALL NOT változtathatja meg az
|
||||
alkalmazáskérés HTTP-válaszának státuszát vagy törzsét.
|
||||
|
||||
#### Scenario: Szerveroldali API-művelet hibára fut
|
||||
|
||||
- **WHEN** egy szerveroldali API-művelet nem várt hibát észlel
|
||||
- **THEN** az alkalmazás SHALL strukturált hibanaplót írjon a standard outputra vagy
|
||||
standard errorre, a releváns komponenssel és biztonságos hibainformációval
|
||||
|
||||
#### Scenario: A távoli naplógyűjtő nem érhető el
|
||||
|
||||
- **WHEN** nincs elérhető távoli naplógyűjtő szolgáltatás
|
||||
- **THEN** az alkalmazáskérések feldolgozása SHALL folytatódjon, és a logkimenet SHALL
|
||||
továbbra is elérhető legyen a folyamat standard outputján vagy standard errorján
|
||||
|
||||
### Requirement: Érzékeny adatok védelme a naplókban
|
||||
|
||||
Az alkalmazás naplórekordjai SHALL NOT tartalmazhatják a kapcsolatfelvételi űrlap
|
||||
mezőinek értékeit, hitelesítési titkokat, hozzáférési tokeneket vagy szükségtelen
|
||||
személyes adatokat. A hibák naplózása SHALL csak a diagnosztikához szükséges
|
||||
információkat használhatja.
|
||||
|
||||
#### Scenario: A kapcsolatfelvételi beküldés mentése meghiúsul
|
||||
|
||||
- **WHEN** egy kapcsolatfelvételi beküldés mentése meghiúsul
|
||||
- **THEN** az alkalmazás SHALL rögzítse a hibát a beküldött név, e-mail-cím, tárgy,
|
||||
üzenet és hozzájárulási adat naplózása nélkül
|
||||
|
||||
#### Scenario: A hiba titkot vagy felhasználói adatot tartalmaz
|
||||
|
||||
- **WHEN** egy hibaobjektum vagy kapcsolódó metaadat titkot vagy felhasználói értéket
|
||||
tartalmaz
|
||||
- **THEN** a kiírt naplórekord SHALL hagyja ki vagy maszkolja az érzékeny értéket
|
||||
@@ -0,0 +1,81 @@
|
||||
# Contact Submissions Specification
|
||||
|
||||
## Purpose
|
||||
|
||||
A publikus kapcsolatfelvételi végpont validálását, visszajelzéseit és a beküldött
|
||||
üzenetek Payload CMS-ben történő, adminisztrálható tárolását írja le.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement: Validate and protect contact submissions
|
||||
|
||||
The contact endpoint SHALL accept contact submissions through `POST /api/contact`
|
||||
only when name, email, subject, message, and affirmative GDPR consent are present.
|
||||
It SHALL reject invalid email addresses, values longer than 100 characters for name,
|
||||
254 for email, 200 for subject, or 5000 for message, and content matching its
|
||||
configured spam keywords. It SHALL trim input and remove angle brackets before
|
||||
persistence.
|
||||
|
||||
#### Scenario: Submit valid contact details
|
||||
|
||||
- **WHEN** a visitor submits all required fields, a valid email address, and consent
|
||||
within the configured length limits without matching spam content
|
||||
- **THEN** the endpoint SHALL sanitize the submitted text and continue to persistence
|
||||
|
||||
#### Scenario: Submit invalid or disallowed contact details
|
||||
|
||||
- **WHEN** a required field or consent is missing, the email is invalid, a field
|
||||
exceeds its length limit, or the content matches a configured spam keyword
|
||||
- **THEN** the endpoint SHALL reject the request with HTTP 400 and SHALL NOT persist
|
||||
the submission
|
||||
|
||||
#### Scenario: Exceed the contact rate limit
|
||||
|
||||
- **WHEN** a client IP submits more than three requests during a 60-second rate-limit
|
||||
window
|
||||
- **THEN** the endpoint SHALL reject the excess request with HTTP 429
|
||||
|
||||
### Requirement: Persist accepted submissions
|
||||
|
||||
The endpoint SHALL persist each accepted submission in the Payload
|
||||
`contact-submissions` collection with GDPR consent set to true and initial status
|
||||
`new`. It SHALL return success only after persistence succeeds.
|
||||
|
||||
#### Scenario: Persist an accepted submission
|
||||
|
||||
- **WHEN** a valid submission is accepted and Payload persistence succeeds
|
||||
- **THEN** the endpoint SHALL return HTTP 200 with a success message, creation
|
||||
timestamp, and submission identifier
|
||||
|
||||
#### Scenario: Payload persistence fails
|
||||
|
||||
- **WHEN** Payload cannot persist an otherwise valid submission
|
||||
- **THEN** the endpoint SHALL return HTTP 500 and SHALL NOT report success
|
||||
|
||||
### Requirement: Restrict and manage submitted records
|
||||
|
||||
Contact submission records SHALL be available to authenticated administrators in the
|
||||
Payload admin. Unauthenticated API access SHALL NOT allow reading or changing those
|
||||
records. Administrators SHALL be able to manage the processing status using `new`,
|
||||
`read`, `replied`, and `archived` values.
|
||||
|
||||
#### Scenario: Administrator reviews a submission
|
||||
|
||||
- **WHEN** an authenticated administrator opens a stored submission in Payload
|
||||
- **THEN** the administrator SHALL be able to review its contact fields and update
|
||||
its processing status
|
||||
|
||||
#### Scenario: Unauthenticated user attempts to access stored submissions
|
||||
|
||||
- **WHEN** a request without an authenticated user attempts to read or modify a
|
||||
submission through the Payload API
|
||||
- **THEN** Payload SHALL deny the operation
|
||||
|
||||
### Requirement: Reject unsupported contact methods
|
||||
|
||||
The contact endpoint SHALL reject methods other than `POST` with HTTP 405.
|
||||
|
||||
#### Scenario: Submit using an unsupported method
|
||||
|
||||
- **WHEN** a client calls the contact endpoint using `GET`, `PUT`, or `DELETE`
|
||||
- **THEN** the endpoint SHALL return HTTP 405
|
||||
@@ -0,0 +1,259 @@
|
||||
# Content Management Specification
|
||||
|
||||
## Purpose
|
||||
|
||||
Leírja a weboldal Payload CMS-alapú tartalomszerkesztését, admin hozzáférését,
|
||||
publikálását és az adminisztrált média/partner tartalmak kezelését.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement: Protected Payload administration
|
||||
|
||||
The CMS SHALL require an authenticated user for administration and protected Users
|
||||
collection operations. The current user model SHALL treat every authenticated user as
|
||||
an administrator.
|
||||
|
||||
#### Scenario: Unauthenticated user attempts a protected admin operation
|
||||
|
||||
- **WHEN** a request without an authenticated user attempts to read or modify a
|
||||
protected Users or content record through the Payload API
|
||||
- **THEN** Payload SHALL deny the operation
|
||||
|
||||
#### Scenario: Login attempts exceed the configured limit
|
||||
|
||||
- **WHEN** an account reaches five failed login attempts
|
||||
- **THEN** Payload SHALL lock that account for ten minutes
|
||||
|
||||
### Requirement: Editable site content
|
||||
|
||||
The CMS SHALL provide editable Home, About, Services, Contact, and Common globals,
|
||||
and LegalPages, Partners, Media, ContactSubmissions, and Users collections. Public
|
||||
page content SHALL be obtained from these Payload records rather than hard-coded into
|
||||
page components.
|
||||
|
||||
#### Scenario: An administrator edits a public page global
|
||||
|
||||
- **WHEN** an authenticated administrator saves a supported global
|
||||
- **THEN** the CMS SHALL persist the global and make its published values available to
|
||||
the public site
|
||||
|
||||
#### Scenario: An administrator manages legal pages or partners
|
||||
|
||||
- **WHEN** an authenticated administrator creates or updates a LegalPages or
|
||||
Partners record
|
||||
- **THEN** the CMS SHALL persist the record for use by the corresponding public page
|
||||
|
||||
### Requirement: Draft and versioned publishing
|
||||
|
||||
The site globals and the LegalPages and Partners collections SHALL support drafts and
|
||||
version history, with a maximum of 50 retained versions per global or document.
|
||||
Publishing SHALL be an explicit administrator action. Public content reads SHALL
|
||||
return published data rather than drafts.
|
||||
|
||||
#### Scenario: Save an unpublished draft
|
||||
|
||||
- **WHEN** an administrator saves a draft of a supported global, legal page, or
|
||||
partner record
|
||||
- **THEN** the draft SHALL be retained in version history and SHALL NOT replace the
|
||||
published content rendered publicly
|
||||
|
||||
#### Scenario: Publish a draft
|
||||
|
||||
- **WHEN** an administrator explicitly publishes a saved draft
|
||||
- **THEN** subsequent public requests SHALL be able to render the newly published
|
||||
content without an application redeployment
|
||||
|
||||
### Requirement: Hungarian and English locale support
|
||||
|
||||
The CMS SHALL configure Hungarian (`hu`) and English (`en`) locales, use Hungarian as
|
||||
the default locale, and enable fallback to Hungarian for localized fields with no
|
||||
English value. This requirement applies only to fields configured as localized; it
|
||||
does not imply that every current content field has a translation.
|
||||
|
||||
#### Scenario: Read a localized field without an English translation
|
||||
|
||||
- **WHEN** the public site requests a localized field in English and that field has
|
||||
no English value
|
||||
- **THEN** Payload SHALL fall back to the Hungarian value
|
||||
|
||||
### Requirement: Localized page globals
|
||||
|
||||
The Home, About, Services, Contact, and Common globals SHALL store every translatable
|
||||
text value (titles, subtitles, descriptions, body paragraphs, labels, button texts,
|
||||
form messages, FAQ entries, metadata, and locale-dependent link targets) separately per
|
||||
locale. Structural values (icons, row identifiers, the external-link flag, and the
|
||||
postal address) SHALL be shared across locales. List items that consist of a single
|
||||
text value (paragraph lists, bullet lists, feature lists, specification item lists)
|
||||
SHALL be editable per locale, including a different number of items per locale. For
|
||||
lists of structured rows, the row count, order, and structural values SHALL be shared
|
||||
across locales, and only the text values within each row SHALL be localized.
|
||||
|
||||
#### Scenario: An administrator saves an English value
|
||||
|
||||
- **WHEN** an administrator edits a translatable global field in the `en` locale and
|
||||
publishes it
|
||||
- **THEN** the English public page SHALL render the English value and the Hungarian
|
||||
public page SHALL continue to render the unchanged Hungarian value
|
||||
|
||||
#### Scenario: An administrator changes a shared structural value
|
||||
|
||||
- **WHEN** an administrator changes a structural value such as an icon in either locale
|
||||
- **THEN** both locales SHALL render the changed value
|
||||
|
||||
#### Scenario: A paragraph list differs between locales
|
||||
|
||||
- **WHEN** the Hungarian version of a paragraph list has three items and the English
|
||||
version has two
|
||||
- **THEN** each locale's public page SHALL render exactly its own items
|
||||
|
||||
### Requirement: Lossless locale migration of existing content
|
||||
|
||||
When a previously non-localized global field becomes localized, its existing value
|
||||
SHALL be preserved as the Hungarian value, including values edited by administrators
|
||||
after the initial content import. The migration SHALL cover published content, saved
|
||||
drafts, and version history, SHALL NOT overwrite existing content with seed data, and
|
||||
SHALL be safe to run more than once. Deployed environments SHALL apply the migration
|
||||
without a manual step.
|
||||
|
||||
#### Scenario: Deploy onto a database with administrator edits
|
||||
|
||||
- **WHEN** the localized configuration is deployed onto a database whose globals were
|
||||
edited in the admin after the initial import
|
||||
- **THEN** after startup the Hungarian public pages SHALL render the edited values
|
||||
unchanged, and the English public pages SHALL render the same values through fallback
|
||||
|
||||
#### Scenario: Restore an older version after migration
|
||||
|
||||
- **WHEN** an administrator opens or restores a global version saved before the
|
||||
migration
|
||||
- **THEN** the version SHALL show its original text as the Hungarian value rather than
|
||||
empty fields
|
||||
|
||||
#### Scenario: Migration runs a second time
|
||||
|
||||
- **WHEN** the migration is executed on already migrated data
|
||||
- **THEN** stored values SHALL remain unchanged
|
||||
|
||||
### Requirement: Localized legal pages
|
||||
|
||||
Legal pages SHALL store their title, last-updated text, and section titles and
|
||||
contents separately per locale. The slug and section identifiers SHALL be shared across
|
||||
locales. Existing Hungarian legal content SHALL be preserved as the Hungarian value,
|
||||
including published content and version history.
|
||||
|
||||
#### Scenario: An administrator adds an English privacy policy
|
||||
|
||||
- **WHEN** an administrator edits a legal page in the `en` locale
|
||||
- **THEN** the Hungarian legal page content SHALL remain unchanged
|
||||
|
||||
#### Scenario: Existing legal page after migration
|
||||
|
||||
- **WHEN** the localized legal page configuration is deployed onto existing data
|
||||
- **THEN** the Hungarian legal pages SHALL render the same content as before
|
||||
|
||||
### Requirement: English translation status
|
||||
|
||||
Every page global and legal page SHALL carry an English translation status with the
|
||||
values "no translation", "AI draft awaiting review", and "approved", visible to
|
||||
administrators with a warning that AI drafts require review. Only an administrator
|
||||
action SHALL set the status to "approved".
|
||||
|
||||
#### Scenario: AI draft is imported
|
||||
|
||||
- **WHEN** machine-translated English content is imported for a page
|
||||
- **THEN** that page's status SHALL be "AI draft awaiting review"
|
||||
|
||||
#### Scenario: An administrator approves a translation
|
||||
|
||||
- **WHEN** an administrator sets the status to "approved" and publishes
|
||||
- **THEN** the page SHALL be marked as having an approved English translation
|
||||
|
||||
### Requirement: Non-destructive AI draft import
|
||||
|
||||
Importing AI-draft English content SHALL only fill English values that are empty and
|
||||
whose current Hungarian source text is identical to the text that was translated. It
|
||||
SHALL NOT change Hungarian values, shared values, or existing English values, SHALL
|
||||
keep placeholders such as `{year}`, `{min}` and `{privacyHref}` intact, and SHALL be
|
||||
safe to run more than once.
|
||||
|
||||
#### Scenario: Hungarian text changed after translation
|
||||
|
||||
- **WHEN** a Hungarian value differs from the source text in the translation memory
|
||||
- **THEN** its English value SHALL stay empty and the import SHALL report it
|
||||
|
||||
#### Scenario: An English value was already edited by a person
|
||||
|
||||
- **WHEN** a field already has an English value
|
||||
- **THEN** the import SHALL leave it unchanged
|
||||
|
||||
### Requirement: Validated English legal pages
|
||||
|
||||
The English translation of a legal page SHALL NOT be set to "approved" unless at least
|
||||
two distinct language models have reviewed it and their reviews are recorded in the CMS.
|
||||
Each review record SHALL contain the model name, the review date, the verdict (approve,
|
||||
approve with changes, reject), and the model's pasted answer. For each model only its
|
||||
latest review SHALL count, and a model whose latest verdict is "reject" SHALL NOT count.
|
||||
Reviews SHALL be run with the admin validation prompt, which covers meaning equivalence
|
||||
with the Hungarian text, data-protection terminology, omissions or additions, and
|
||||
preserved placeholders.
|
||||
|
||||
#### Scenario: Approving an unvalidated legal translation
|
||||
|
||||
- **WHEN** an administrator sets a legal page's English status to "approved" while fewer
|
||||
than two distinct models have a complete, non-rejecting latest review
|
||||
- **THEN** the CMS SHALL reject the save with a validation error
|
||||
|
||||
#### Scenario: Approving a validated legal translation
|
||||
|
||||
- **WHEN** two distinct models each have a complete latest review that does not reject
|
||||
the translation
|
||||
- **THEN** the CMS SHALL allow the status to be set to "approved"
|
||||
|
||||
#### Scenario: A rejection is superseded
|
||||
|
||||
- **WHEN** a model rejected the translation and, after corrections, a newer review by the
|
||||
same model approves it
|
||||
- **THEN** that model SHALL count towards the required reviews
|
||||
|
||||
#### Scenario: Page globals are not affected
|
||||
|
||||
- **WHEN** an administrator approves the English translation of a page global
|
||||
- **THEN** no legal validation record SHALL be required
|
||||
|
||||
### Requirement: Legal validation prompt in the admin
|
||||
|
||||
The legal page editor SHALL offer administrators a ready-to-use validation prompt for
|
||||
the English translation. The prompt SHALL contain the review criteria, the requested
|
||||
structured output format, and the current Hungarian and English text of every section
|
||||
of that page, and SHALL be copyable with a single action. The prompt SHALL be generated
|
||||
from the same template that is used for the project's own model validation.
|
||||
|
||||
#### Scenario: An administrator copies the validation prompt
|
||||
|
||||
- **WHEN** an administrator opens a legal page that has English content and uses the
|
||||
copy action of the validation prompt panel
|
||||
- **THEN** the clipboard SHALL contain a prompt with the review criteria and the
|
||||
Hungarian and English text of each section of the current version
|
||||
|
||||
#### Scenario: No English text yet
|
||||
|
||||
- **WHEN** a legal page has no English content
|
||||
- **THEN** the panel SHALL state that there is nothing to validate instead of offering
|
||||
a prompt
|
||||
|
||||
### Requirement: Public partner media
|
||||
|
||||
The CMS SHALL allow authenticated administrators to manage partner records and image
|
||||
media. Partner logos SHALL be optional in the CMS, but the public site SHALL render a
|
||||
partner only when a usable logo is available. Media reads required by public pages
|
||||
SHALL be publicly accessible; media writes SHALL remain protected.
|
||||
|
||||
#### Scenario: Public page loads a partner logo
|
||||
|
||||
- **WHEN** the public site requests an uploaded partner image
|
||||
- **THEN** the media endpoint SHALL allow the read without an administrator session
|
||||
|
||||
#### Scenario: An unauthenticated user attempts to change media
|
||||
|
||||
- **WHEN** an unauthenticated user attempts to create, update, or delete media
|
||||
- **THEN** the CMS SHALL deny the operation
|
||||
@@ -0,0 +1,46 @@
|
||||
# Health Check Specification
|
||||
|
||||
## Purpose
|
||||
|
||||
A futó Next.js alkalmazás állapotát és build-/környezet-azonosító adatait szolgáltató
|
||||
`/api/health` végpont jelenlegi szerződését írja le. A végpont jelenleg nem végez
|
||||
MongoDB-kapcsolatellenőrzést.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement: Report application health metadata
|
||||
|
||||
The health endpoint SHALL provide a non-cacheable JSON response to `GET /api/health`
|
||||
with HTTP 200 when the handler completes successfully. The response SHALL include
|
||||
`status: "ok"`, an ISO timestamp, process uptime, application version, deployment
|
||||
version (nullable), and runtime environment.
|
||||
|
||||
#### Scenario: Read health metadata
|
||||
|
||||
- **WHEN** a client sends `GET /api/health` and the handler completes successfully
|
||||
- **THEN** the endpoint SHALL return HTTP 200 with the application metadata and
|
||||
`Cache-Control: no-cache, no-store, must-revalidate`
|
||||
|
||||
#### Scenario: Health handler fails
|
||||
|
||||
- **WHEN** the handler encounters an unexpected error
|
||||
- **THEN** the endpoint SHALL return HTTP 503 with `status: "error"`, a timestamp,
|
||||
and a generic health failure message
|
||||
|
||||
### Requirement: Support lightweight HEAD health checks
|
||||
|
||||
The health endpoint SHALL support `HEAD /api/health` without a response body and with
|
||||
HTTP 200 and a non-cacheable response header.
|
||||
|
||||
#### Scenario: Probe health using HEAD
|
||||
|
||||
- **WHEN** a client sends `HEAD /api/health`
|
||||
- **THEN** the endpoint SHALL return HTTP 200, no response body, and
|
||||
`Cache-Control: no-cache, no-store, must-revalidate`
|
||||
|
||||
## Open Questions
|
||||
|
||||
- The current response is a direct status object, while `.agent/steering/architecture.md`
|
||||
and other documentation describe a shared `{ success, data, error }` response
|
||||
envelope. The contact endpoint also uses endpoint-specific response objects. Should
|
||||
these endpoint contracts or the shared convention be changed in a future change?
|
||||
@@ -0,0 +1,85 @@
|
||||
# Public Site Specification
|
||||
|
||||
## Purpose
|
||||
|
||||
A mozdIT Bt. publikus, magyar és angol nyelvű weboldalának útvonalait, tartalmát és
|
||||
megjelenítési viselkedését írja le.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement: Locale-prefixed routes
|
||||
|
||||
The public site SHALL serve the Hungarian and English locales under `/hu` and `/en`
|
||||
URL prefixes respectively. The bare root URL SHALL redirect to the default Hungarian
|
||||
home route `/hu`.
|
||||
|
||||
#### Scenario: Open the home page in a supported locale
|
||||
|
||||
- **WHEN** a visitor opens `/hu` or `/en`
|
||||
- **THEN** the site SHALL render the home page in the requested locale
|
||||
|
||||
#### Scenario: Open a localized content page
|
||||
|
||||
- **WHEN** a visitor opens a supported page using its locale-specific slug, such as
|
||||
`/hu/rolunk` or `/en/about`
|
||||
- **THEN** the site SHALL resolve and render that page in the URL locale
|
||||
|
||||
### Requirement: CMS-backed public content
|
||||
|
||||
The public site SHALL read editable page content from the Payload CMS through the
|
||||
server-side content adapter. It SHALL render the home, about, services, contact,
|
||||
privacy, and terms pages, and SHALL include partner entries with usable logos on the
|
||||
home page.
|
||||
|
||||
#### Scenario: An administrator publishes page content
|
||||
|
||||
- **WHEN** a published page or global is read by a public request
|
||||
- **THEN** the site SHALL render the current published Payload content without
|
||||
requiring an application rebuild or redeployment
|
||||
|
||||
#### Scenario: A partner has no usable logo
|
||||
|
||||
- **WHEN** a partner has no uploaded logo URL
|
||||
- **THEN** the public home page SHALL omit that partner from the rendered partner list
|
||||
|
||||
### Requirement: Unknown public routes return not found
|
||||
|
||||
The public site SHALL return its not-found page for unsupported locale prefixes and
|
||||
unknown or unsupported page slugs.
|
||||
|
||||
#### Scenario: Open a route with an unsupported locale or slug
|
||||
|
||||
- **WHEN** a visitor requests a locale outside `hu` and `en`, or a slug not mapped to
|
||||
a supported page in that locale
|
||||
- **THEN** the site SHALL render the not-found response
|
||||
|
||||
### Requirement: Locale-specific page metadata
|
||||
|
||||
The public site SHALL generate page titles, descriptions, and Open Graph locale
|
||||
metadata for the requested locale where page metadata is available.
|
||||
|
||||
#### Scenario: Request metadata for a localized page
|
||||
|
||||
- **WHEN** metadata is generated for a supported page and locale
|
||||
- **THEN** its title and description SHALL use that locale's page content or configured
|
||||
localized fallback text
|
||||
|
||||
### Requirement: Approved English content only
|
||||
|
||||
An English public page SHALL render its English content only when that page's English
|
||||
translation status is "approved". Otherwise it SHALL render the Hungarian content of the
|
||||
same page. Routing, navigation labels, and shared values SHALL be unaffected by the
|
||||
status.
|
||||
|
||||
#### Scenario: English translation is an unapproved AI draft
|
||||
|
||||
- **WHEN** a visitor opens an English page whose translation status is "AI draft
|
||||
awaiting review"
|
||||
- **THEN** the page SHALL render the Hungarian content
|
||||
|
||||
#### Scenario: English translation is approved
|
||||
|
||||
- **WHEN** a visitor opens an English page whose translation status is "approved" and
|
||||
the page is published
|
||||
- **THEN** the page SHALL render the English values, falling back to Hungarian for any
|
||||
field without an English value
|
||||
@@ -39,3 +39,9 @@ yarn-error.log*
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
|
||||
# Payload CMS — local upload storage (MITHOME-89). Runtime data, not source;
|
||||
# needs a persistent Docker volume in staging/production (see MITHOME-97).
|
||||
/media
|
||||
# Payload CMS — generated TS types (payload.config.ts typescript.outputFile)
|
||||
src/payload-types.ts
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
import { expect, test, type APIRequestContext } from '@playwright/test'
|
||||
|
||||
/**
|
||||
* MITHOME-127 — production launch SEO checks (run at go-live and after every
|
||||
* production release): `BASE_URL=https://mozdit.hu npm run test:seo:production`.
|
||||
*
|
||||
* The site must be indexable, every sitemap URL must be final (200, no
|
||||
* redirect), canonical/hreflang must point at those final URLs, and content +
|
||||
* internal links must be in the server-rendered HTML (no JS needed).
|
||||
* Host-level redirects (http→https, www→apex) are nginx's job (MITHOME-15):
|
||||
* set SEO_CHECK_HOST_REDIRECTS=1 once the production domain is live.
|
||||
*/
|
||||
|
||||
const text = async (request: APIRequestContext, path: string) => {
|
||||
const response = await request.get(path, { maxRedirects: 0 })
|
||||
expect(response.status(), `${path} status`).toBe(200)
|
||||
return response.text()
|
||||
}
|
||||
|
||||
const locs = (xml: string) => [...xml.matchAll(/<loc>([^<]+)<\/loc>/g)].map((m) => m[1])
|
||||
const attr = (html: string, pattern: RegExp) => html.match(pattern)?.[1]
|
||||
|
||||
test('robots.txt allows crawling and points to the sitemap', async ({ request, baseURL }) => {
|
||||
const robots = await text(request, '/robots.txt')
|
||||
expect(robots).not.toMatch(/^Disallow:\s*\/\s*$/im)
|
||||
expect(robots).toContain(`Sitemap: ${baseURL}/sitemap.xml`)
|
||||
})
|
||||
|
||||
test('every sitemap URL is final, indexable and correctly annotated', async ({ request, baseURL }) => {
|
||||
const urls = locs(await text(request, '/sitemap.xml'))
|
||||
// MITHOME-130: 12 core URLs, +2 once a hosting plan is active.
|
||||
expect(urls.length).toBeGreaterThanOrEqual(12)
|
||||
|
||||
for (const url of urls) {
|
||||
expect(url.startsWith(`${baseURL}/`), `${url} is on ${baseURL}`).toBe(true)
|
||||
const html = await text(request, url)
|
||||
expect(html, `${url} has no noindex`).not.toMatch(/<meta[^>]*name="robots"[^>]*noindex/i)
|
||||
expect(attr(html, /<link rel="canonical" href="([^"]+)"/), `${url} canonical`).toBe(url)
|
||||
for (const lang of ['hu', 'en', 'x-default']) {
|
||||
const alternate = attr(html, new RegExp(`<link rel="alternate" hrefLang="${lang}" href="([^"]+)"`))
|
||||
expect(urls, `${url} hreflang ${lang} → ${alternate}`).toContain(alternate)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
test('content and internal links are in the server-rendered HTML', async ({ request }) => {
|
||||
const html = await text(request, '/hu')
|
||||
expect(html).toMatch(/<h1[^>]*>[^<]+/)
|
||||
for (const path of ['/hu/rolunk', '/hu/szolgaltatasok', '/hu/kapcsolat', '/en']) {
|
||||
expect(html, `link to ${path}`).toContain(`href="${path}"`)
|
||||
}
|
||||
})
|
||||
|
||||
test('the site root redirects to /hu in one step', async ({ request }) => {
|
||||
const response = await request.get('/', { maxRedirects: 0 })
|
||||
expect([301, 302, 307, 308]).toContain(response.status())
|
||||
expect(new URL(response.headers()['location'], 'http://x').pathname).toBe('/hu')
|
||||
})
|
||||
|
||||
test('unknown pages return a real 404', async ({ request }) => {
|
||||
const response = await request.get('/hu/nincs-ilyen-oldal', { maxRedirects: 0 })
|
||||
expect(response.status()).toBe(404)
|
||||
})
|
||||
|
||||
test('host variants redirect to the canonical origin in one step', async ({ request, baseURL }) => {
|
||||
test.skip(!process.env.SEO_CHECK_HOST_REDIRECTS, 'nginx host redirects are checked once the production domain is live (MITHOME-15)')
|
||||
const canonical = new URL(baseURL!)
|
||||
const variants = [`http://${canonical.host}/hu`, `https://www.${canonical.host}/hu`]
|
||||
for (const variant of variants) {
|
||||
const response = await request.get(variant, { maxRedirects: 0 })
|
||||
expect([301, 308], `${variant} status`).toContain(response.status())
|
||||
expect(response.headers()['location'], `${variant} target`).toBe(`${canonical.origin}/hu`)
|
||||
}
|
||||
})
|
||||
@@ -31,10 +31,10 @@ test('SMOKE-02: homepage renders its critical shell without console errors', asy
|
||||
|
||||
test('SMOKE-03: main navigation opens every public core page', async ({ page }) => {
|
||||
const targets = [
|
||||
['Kezdőlap', '/'],
|
||||
['Rólunk', '/rolunk'],
|
||||
['Szolgáltatások', '/szolgaltatasok'],
|
||||
['Kapcsolat', '/kapcsolat'],
|
||||
['Kezdőlap', '/hu'],
|
||||
['Rólunk', '/hu/rolunk'],
|
||||
['Szolgáltatások', '/hu/szolgaltatasok'],
|
||||
['Kapcsolat', '/hu/kapcsolat'],
|
||||
] as const
|
||||
|
||||
await page.goto('/')
|
||||
@@ -48,7 +48,69 @@ test('SMOKE-03: main navigation opens every public core page', async ({ page })
|
||||
test('SMOKE-04: service content and contact CTA are visible', async ({ page }) => {
|
||||
await page.goto('/')
|
||||
await expect(page.getByRole('heading', { name: 'Szolgáltatásaink' })).toBeVisible()
|
||||
await expect(page.getByRole('link', { name: /kérjen ajánlatot/i })).toHaveAttribute('href', '/kapcsolat')
|
||||
await expect(page.getByRole('link', { name: /kérjen ajánlatot/i })).toHaveAttribute('href', '/hu/kapcsolat')
|
||||
})
|
||||
|
||||
// MITHOME-123 regression: SMOKE-02 only checked the hero CTA was visible,
|
||||
// so its stale "/kapcsolat" target (404) went unnoticed.
|
||||
for (const [locale, contactPath] of [['hu', '/hu/kapcsolat'], ['en', '/en/contact']] as const) {
|
||||
test(`SMOKE-06-${locale}: hero CTA opens the ${locale} contact page`, async ({ page }) => {
|
||||
await page.goto(`/${locale}`)
|
||||
const cta = page.locator('section').first().locator('a.btn-primary').first()
|
||||
await expect(cta).toHaveAttribute('href', contactPath)
|
||||
const response = await page.request.get(contactPath)
|
||||
expect(response.status()).toBe(200)
|
||||
})
|
||||
}
|
||||
|
||||
// MITHOME-124: external links always open in a new tab (the home Webmail
|
||||
// button used to open in the same tab while other webmail links did not).
|
||||
test('SMOKE-07: external links on the homepage open in a new tab', async ({ page }) => {
|
||||
await page.goto('/hu')
|
||||
const external = page.locator('a[href^="http"]:not([href^="' + new URL(page.url()).origin + '"])')
|
||||
expect(await external.count()).toBeGreaterThan(0)
|
||||
for (const link of await external.all()) {
|
||||
await expect(link).toHaveAttribute('target', '_blank')
|
||||
await expect(link).toHaveAttribute('rel', /noopener/)
|
||||
}
|
||||
})
|
||||
|
||||
// MITHOME-115: the language switcher keeps the current page (translated slug).
|
||||
test('SMOKE-08: language switcher opens the same page in the other language', async ({ page }) => {
|
||||
await page.goto('/hu/szolgaltatasok')
|
||||
const english = page.getByRole('group', { name: 'Nyelv kiválasztása' }).first().getByRole('link', { name: 'English' })
|
||||
await expect(english).toHaveAttribute('href', '/en/services')
|
||||
await english.click()
|
||||
await expect(page).toHaveURL(/\/en\/services$/)
|
||||
await expect(page.getByRole('group', { name: 'Choose language' }).first().getByRole('link', { name: 'Magyar' })).toHaveAttribute('href', '/hu/szolgaltatasok')
|
||||
})
|
||||
|
||||
// MITHOME-116: pages announce both languages (hreflang), and staging is
|
||||
// never indexed (disallow-all robots.txt, empty sitemap, noindex meta).
|
||||
test('SMOKE-09: hreflang alternates and staging noindex', async ({ page, request }) => {
|
||||
await page.goto('/hu/szolgaltatasok')
|
||||
const origin = new URL(page.url()).origin
|
||||
await expect(page.locator('link[rel="alternate"][hreflang="en"]')).toHaveAttribute('href', `${origin}/en/services`)
|
||||
await expect(page.locator('link[rel="alternate"][hreflang="x-default"]')).toHaveAttribute('href', `${origin}/hu/szolgaltatasok`)
|
||||
await expect(page.locator('link[rel="canonical"]')).toHaveAttribute('href', `${origin}/hu/szolgaltatasok`)
|
||||
await expect(page.locator('meta[name="robots"]')).toHaveAttribute('content', /noindex/)
|
||||
|
||||
const robots = await (await request.get('/robots.txt')).text()
|
||||
expect(robots).toMatch(/Disallow: \/\s*$/m)
|
||||
expect(robots).not.toContain('Sitemap:')
|
||||
})
|
||||
|
||||
// MITHOME-130: staging shows the draft hosting plans for review (production
|
||||
// shows only active ones), with the menu item and both languages.
|
||||
test('SMOKE-10: hosting plans page and menu item', async ({ page }) => {
|
||||
await page.goto('/hu')
|
||||
await page.getByRole('navigation').getByRole('link', { name: 'Tárhelycsomagok' }).first().click()
|
||||
await expect(page).toHaveURL(/\/hu\/tarhely-csomagok$/)
|
||||
await expect(page.getByRole('heading', { level: 2, name: 'mIT Start' })).toBeVisible()
|
||||
await expect(page.getByRole('heading', { level: 2, name: 'mIT Mid' })).toBeVisible()
|
||||
await expect(page.getByText(/\+ ÁFA \/ év/).first()).toBeVisible()
|
||||
const english = page.getByRole('group', { name: 'Nyelv kiválasztása' }).first().getByRole('link', { name: 'English' })
|
||||
await expect(english).toHaveAttribute('href', '/en/hosting-plans')
|
||||
})
|
||||
|
||||
test('SMOKE-05: empty contact form is blocked client-side without API submission', async ({ page }) => {
|
||||
@@ -57,7 +119,7 @@ test('SMOKE-05: empty contact form is blocked client-side without API submission
|
||||
if (request.method() === 'POST' && new URL(request.url()).pathname === '/api/contact') contactPostCount++
|
||||
})
|
||||
|
||||
await page.goto('/kapcsolat')
|
||||
await page.goto('/hu/kapcsolat')
|
||||
await page.getByRole('button', { name: 'Üzenet küldése' }).click()
|
||||
await expect(page.getByRole('textbox', { name: 'Név *' })).toBeVisible()
|
||||
await expect.poll(() => contactPostCount).toBe(0)
|
||||
|
||||
+11
-3
@@ -16,6 +16,12 @@ const eslintConfig = [
|
||||
"out/**",
|
||||
"build/**",
|
||||
"next-env.d.ts",
|
||||
// Generated test output (Playwright report/traces, Jest coverage) — not source.
|
||||
"playwright-report/**",
|
||||
"test-results/**",
|
||||
"coverage/**",
|
||||
// MITHOME-136: generated by `payload migrate:create` — not edited by hand.
|
||||
"src/migrations/2*.ts",
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -25,9 +31,11 @@ const eslintConfig = [
|
||||
files: [
|
||||
"**/*.test.ts",
|
||||
"**/*.test.tsx",
|
||||
"jest.config*.js",
|
||||
"jest.setup*.js",
|
||||
"jest.globalSetup*.js",
|
||||
// MITHOME-136: package is "type": "module", so the CommonJS jest files are .cjs.
|
||||
"jest.config*.cjs",
|
||||
"jest.setup*.cjs",
|
||||
"jest.globalSetup*.cjs",
|
||||
"jest.globalTeardown*.cjs",
|
||||
"playwright.config.ts",
|
||||
],
|
||||
rules: {
|
||||
|
||||
@@ -7,7 +7,7 @@ const createJestConfig = nextJest({
|
||||
|
||||
// Add any custom config to be passed to Jest
|
||||
const customJestConfig = {
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.cjs'],
|
||||
moduleNameMapper: {
|
||||
// Handle module aliases (this will be automatically configured for you based on your tsconfig.json paths)
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
@@ -8,7 +8,7 @@ const createJestConfig = nextJest({
|
||||
// Integration tests configuration - runs in Node.js environment with fetch polyfill
|
||||
const integrationJestConfig = {
|
||||
displayName: 'Integration Tests',
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.integration.js'],
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.integration.cjs'],
|
||||
moduleNameMapper: {
|
||||
// Handle module aliases
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
@@ -19,8 +19,8 @@ const integrationJestConfig = {
|
||||
'<rootDir>/src/__tests__/e2e-docker.test.ts'
|
||||
],
|
||||
testTimeout: 30000, // Longer timeout for integration tests
|
||||
globalSetup: '<rootDir>/jest.globalSetup.integration.js',
|
||||
globalTeardown: '<rootDir>/jest.globalTeardown.integration.js'
|
||||
globalSetup: '<rootDir>/jest.globalSetup.integration.cjs',
|
||||
globalTeardown: '<rootDir>/jest.globalTeardown.integration.cjs'
|
||||
}
|
||||
|
||||
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
|
||||
@@ -8,7 +8,7 @@ const createJestConfig = nextJest({
|
||||
// Unit tests configuration - runs in Node.js environment
|
||||
const unitJestConfig = {
|
||||
displayName: 'Unit Tests',
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.cjs'],
|
||||
moduleNameMapper: {
|
||||
// Handle module aliases
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
@@ -74,9 +74,6 @@ jest.mock('winston', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
// Mock winston-loki
|
||||
jest.mock('winston-loki', () => jest.fn().mockImplementation(() => ({ name: 'loki' })))
|
||||
|
||||
// Let individual test files handle their own logger mocks
|
||||
// This allows for more specific testing of the logger module itself
|
||||
|
||||
@@ -133,12 +130,6 @@ if (!global.process.env) {
|
||||
|
||||
// Logger will be mocked by the winston mock above
|
||||
|
||||
// Mock Loki transport
|
||||
jest.mock('winston-loki', () => jest.fn(() => ({
|
||||
log: jest.fn(),
|
||||
close: jest.fn()
|
||||
})))
|
||||
|
||||
// Mock Next.js router
|
||||
jest.mock('next/router', () => ({
|
||||
useRouter: () => ({
|
||||
@@ -261,7 +252,6 @@ global.NextResponse = {
|
||||
// Set up environment variables for tests
|
||||
process.env.MONGODB_URI = 'mongodb://localhost:27017/test'
|
||||
process.env.MONGODB_DB = 'test'
|
||||
process.env.LOKI_HOST = 'http://loki:3100'
|
||||
process.env.NODE_ENV = 'test'
|
||||
process.env.NEXT_PUBLIC_CONTACT_EMAIL = 'info@mozdit.hu'
|
||||
process.env.NEXT_PUBLIC_SITE_URL = 'https://localhost:3000'
|
||||
@@ -274,4 +264,4 @@ afterEach(() => {
|
||||
})
|
||||
|
||||
// Import React Testing Library DOM (using require for Jest setup files)
|
||||
require('@testing-library/jest-dom')
|
||||
require('@testing-library/jest-dom')
|
||||
Generated
+1377
-483
File diff suppressed because it is too large
Load Diff
+21
-11
@@ -2,19 +2,21 @@
|
||||
"name": "proto",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "next dev --turbopack",
|
||||
"build": "next build --turbopack",
|
||||
"start": "next start",
|
||||
"lint": "eslint",
|
||||
"test": "jest --config jest.config.unit.js",
|
||||
"test:watch": "jest --config jest.config.unit.js --watch",
|
||||
"test:coverage": "jest --config jest.config.unit.js --coverage",
|
||||
"test:unit": "jest --config jest.config.unit.js",
|
||||
"test:browser": "jest --config jest.config.js src/__tests__/browser-integration.test.ts",
|
||||
"test:integration": "INTEGRATION_TESTS=1 jest --config jest.config.integration.js src/__tests__/integration.test.ts",
|
||||
"test:e2e": "E2E_TESTS=1 jest --config jest.config.integration.js src/__tests__/e2e-docker.test.ts",
|
||||
"test:smoke:staging": "playwright test --config=playwright.config.ts",
|
||||
"test": "jest --config jest.config.unit.cjs",
|
||||
"test:watch": "jest --config jest.config.unit.cjs --watch",
|
||||
"test:coverage": "jest --config jest.config.unit.cjs --coverage",
|
||||
"test:unit": "jest --config jest.config.unit.cjs",
|
||||
"test:browser": "jest --config jest.config.cjs src/__tests__/browser-integration.test.ts",
|
||||
"test:integration": "INTEGRATION_TESTS=1 jest --config jest.config.integration.cjs src/__tests__/integration.test.ts",
|
||||
"test:e2e": "E2E_TESTS=1 jest --config jest.config.integration.cjs src/__tests__/e2e-docker.test.ts",
|
||||
"test:smoke:staging": "playwright test --config=playwright.config.ts --project=staging",
|
||||
"test:seo:production": "playwright test --config=playwright.config.ts --project=production-seo",
|
||||
"test:docker": "npm run test:integration && npm run test:e2e",
|
||||
"test:all": "npm run test:unit && npm run test:browser && npm run test:docker",
|
||||
"test:report": "npm test -- --json --outputFile=test-results.json --silent && node ../scripts/sync-test-management.js",
|
||||
@@ -28,10 +30,17 @@
|
||||
"docker:dev:logs": "cd .. && docker-compose -f docker-compose.dev.yml logs -f app",
|
||||
"docker:build": "docker build -t mozdit-app .",
|
||||
"docker:run": "docker run -p 3000:3000 --env-file .env.local mozdit-app",
|
||||
"migrate:content": "node --env-file=.env.local --import tsx scripts/migrate-content-to-payload.ts"
|
||||
"migrate:content": "node --env-file=.env.local --import tsx scripts/migrate-content-to-payload.ts",
|
||||
"test:payload": "node --env-file=.env.local --import tsx scripts/test-payload-local-api.ts",
|
||||
"payload": "payload",
|
||||
"generate:types": "payload generate:types",
|
||||
"generate:importmap": "payload generate:importmap",
|
||||
"migrate:create": "payload migrate:create",
|
||||
"migrate:status": "payload migrate:status"
|
||||
},
|
||||
"dependencies": {
|
||||
"@payloadcms/db-mongodb": "^3.88.0",
|
||||
"@payloadcms/db-postgres": "^3.88.0",
|
||||
"@payloadcms/next": "^3.88.0",
|
||||
"@payloadcms/richtext-lexical": "^3.88.0",
|
||||
"graphql": "^16.14.2",
|
||||
@@ -52,6 +61,7 @@
|
||||
"@testing-library/user-event": "^14.5",
|
||||
"@types/jest": "^29.5",
|
||||
"@types/node": "^20",
|
||||
"@types/pg": "8.20.0",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"@types/winston": "^2.4",
|
||||
@@ -59,11 +69,11 @@
|
||||
"eslint-config-next": "^16.3.4",
|
||||
"jest": "^29.7",
|
||||
"jest-environment-jsdom": "^29.7",
|
||||
"pg": "8.20.0",
|
||||
"tailwindcss": "^4",
|
||||
"tsx": "^4.23.13",
|
||||
"typescript": "^5",
|
||||
"undici": "^7.15.0",
|
||||
"winston": "^3.11",
|
||||
"winston-loki": "^6.0"
|
||||
"winston": "^3.11"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,28 @@
|
||||
import { defineConfig, devices } from '@playwright/test'
|
||||
|
||||
// MITHOME-127: two projects with opposite indexing expectations —
|
||||
// `staging` (smoke, expects noindex) and `production-seo` (expects an
|
||||
// indexable site). BASE_URL overrides the target of either.
|
||||
export default defineConfig({
|
||||
testDir: './e2e',
|
||||
timeout: 30_000,
|
||||
retries: process.env.CI ? 1 : 0,
|
||||
reporter: [['list'], ['html', { open: 'never' }]],
|
||||
use: {
|
||||
baseURL: process.env.BASE_URL || 'https://stage.mozdit.hu',
|
||||
trace: 'retain-on-failure',
|
||||
screenshot: 'only-on-failure',
|
||||
video: 'retain-on-failure',
|
||||
},
|
||||
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
|
||||
projects: [
|
||||
{
|
||||
name: 'staging',
|
||||
testMatch: 'staging-smoke.spec.ts',
|
||||
use: { ...devices['Desktop Chrome'], baseURL: process.env.BASE_URL || 'https://stage.mozdit.hu' },
|
||||
},
|
||||
{
|
||||
name: 'production-seo',
|
||||
testMatch: 'production-seo.spec.ts',
|
||||
use: { ...devices['Desktop Chrome'], baseURL: process.env.BASE_URL || 'https://mozdit.hu' },
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* MITHOME-93 biztonsági lépés: a régi egyedi CMS (content-editor.js +
|
||||
* scripts/cms-*.js) eltávolítása előtt exportálja a Payload jelenlegi
|
||||
* (publikált) szöveges tartalmát egy olvasható JSON fájlba — mindkét
|
||||
* locale-lal (hu, en) —, hogy git-committolt, ember által is átnézhető
|
||||
* biztonsági mentés maradjon a leépítés pillanatáról.
|
||||
*
|
||||
* NEM helyettesíti a git history-t (a src/content/*.json fájlok minden
|
||||
* korábbi szerkesztése megvan commit-onként), és nem helyettesíti a
|
||||
* MongoDB-t (az az élő forrás) — ez egy plusz, könnyen olvasható
|
||||
* pillanatkép a "mielőtt törlünk, mentsünk" elv jegyében.
|
||||
*
|
||||
* Futtatás (proto/ mappából, futó MongoDB-vel és beállított env-ekkel):
|
||||
* node --env-file=.env.local --import tsx scripts/export-content-snapshot.ts
|
||||
*/
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
import { getPayload, type Payload } from 'payload'
|
||||
import config from '../src/payload.config'
|
||||
|
||||
const scriptDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
const outDir = path.resolve(scriptDir, '../../docs/backups')
|
||||
|
||||
const GLOBAL_SLUGS = ['home', 'about', 'services', 'contact', 'common'] as const
|
||||
const LOCALES = ['hu', 'en'] as const
|
||||
|
||||
async function exportGlobals(payload: Payload) {
|
||||
const result: Record<string, Record<string, unknown>> = {}
|
||||
for (const slug of GLOBAL_SLUGS) {
|
||||
result[slug] = {}
|
||||
for (const locale of LOCALES) {
|
||||
result[slug][locale] = await payload.findGlobal({ slug, locale })
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
async function exportCollection(payload: Payload, collection: 'legal-pages' | 'partners') {
|
||||
const result: Record<string, unknown> = {}
|
||||
for (const locale of LOCALES) {
|
||||
const { docs } = await payload.find({ collection, locale, limit: 1000 })
|
||||
result[locale] = docs
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
async function run() {
|
||||
const payload = await getPayload({ config })
|
||||
|
||||
const snapshot = {
|
||||
exportedAt: new Date().toISOString(),
|
||||
reason: 'MITHOME-93 — régi CMS (content-editor.js) leépítése előtti biztonsági mentés',
|
||||
globals: await exportGlobals(payload),
|
||||
collections: {
|
||||
legalPages: await exportCollection(payload, 'legal-pages'),
|
||||
partners: await exportCollection(payload, 'partners'),
|
||||
},
|
||||
}
|
||||
|
||||
fs.mkdirSync(outDir, { recursive: true })
|
||||
const filename = `payload-content-snapshot-${snapshot.exportedAt.replace(/[:.]/g, '-')}.json`
|
||||
const outPath = path.join(outDir, filename)
|
||||
fs.writeFileSync(outPath, JSON.stringify(snapshot, null, 2), 'utf8')
|
||||
|
||||
payload.logger.info(`Snapshot kiírva: ${outPath}`)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
run()
|
||||
@@ -1,35 +1,77 @@
|
||||
/**
|
||||
* MITHOME-87: egyszeri migrációs script — a proto/src/content/pages/*.json
|
||||
* MITHOME-87/88: egyszeri migrációs script — a proto/src/content/pages/*.json
|
||||
* + common.json tartalmát átemeli a Payload Globals-ekbe (Home, About,
|
||||
* Services, Contact, Common) a Local API-n keresztül.
|
||||
* Services, Contact, Common) és a LegalPages collection-be a Local API-n
|
||||
* keresztül.
|
||||
*
|
||||
* Futtatás (proto/ mappából, futó MongoDB-vel és beállított env-ekkel):
|
||||
* node --env-file=.env.local --import tsx scripts/migrate-content-to-payload.ts
|
||||
*
|
||||
* Idempotens: updateGlobal-t hív, tetszőlegesen többször futtatható —
|
||||
* mindig a JSON az aktuális "forrás igazság", felülírja a Payload-ban
|
||||
* lévő korábbi állapotot. NEM törli/nem érinti a JSON fájlokat.
|
||||
* Idempotens: updateGlobal-t / slug-alapú upsert-et hív, tetszőlegesen
|
||||
* többször futtatható — mindig a JSON az aktuális "forrás igazság", felül-
|
||||
* írja a Payload-ban lévő korábbi állapotot. NEM törli/nem érinti a JSON
|
||||
* fájlokat.
|
||||
*
|
||||
* MITHOME-92 tapasztalat: a versions.drafts bekapcsolása után a `_status`
|
||||
* mező defaultValue-ja 'draft' — ha egy create/update hívás data-jában
|
||||
* nincs explicit `_status`, ÚJ dokumentum létrehozásakor 'draft' lesz, és
|
||||
* frissítéskor a meglévő (draft) érték marad meg (nem íródik felül
|
||||
* automatikusan 'published'-re). Ezért itt minden Globals/LegalPages/
|
||||
* Partners írás explicit `_status: 'published'`-t ad át — a migrációs
|
||||
* script eredménye mindig publikált tartalom legyen, sosem draft.
|
||||
*
|
||||
* MITHOME-110 tapasztalat: ha egy mezőt utólag `localized: true`-ra
|
||||
* állítasz, a korábban beírt érték a régi, nem-lokalizált tárolási alakban
|
||||
* marad, és `locale: defaultLocale`-lal nem olvasható vissza (üresnek
|
||||
* látszik). MITHOME-111 óta ezt NEM ennek a scriptnek az újrafuttatásával
|
||||
* kezeljük (az felülírná az admin-szerkesztéseket), hanem Payload
|
||||
* migrációval (src/migrations/, prodMigrations) — egy újabb retrofitnál
|
||||
* (pl. MITHOME-112) is új migráció kell, a src/lib/localize-paths.ts
|
||||
* helperekkel. Explicit `locale` paramétert egyik updateGlobal/update hívás
|
||||
* sem ad meg itt, ezért mindig a `defaultLocale` (hu) alá ír.
|
||||
*/
|
||||
import { getPayload } from 'payload'
|
||||
import path from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
import { getPayload, type Payload } from 'payload'
|
||||
import config from '../src/payload.config'
|
||||
import { internalPathToPageKey } from '../src/lib/cta-link'
|
||||
import { CONFIRMED_CLIENT_REFERENCES, REFERENCES_SECTION_COPY } from '../src/content/seeds/references'
|
||||
|
||||
import homeJson from '../src/content/pages/home.json'
|
||||
import aboutJson from '../src/content/pages/about.json'
|
||||
import servicesJson from '../src/content/pages/services.json'
|
||||
import contactJson from '../src/content/pages/contact.json'
|
||||
import commonJson from '../src/content/common.json'
|
||||
import adatvedelemJson from '../src/content/pages/adatvedelem.json'
|
||||
import hasznalatiFeltetelekJson from '../src/content/pages/hasznalati-feltetelek.json'
|
||||
|
||||
const scriptDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
const publicDir = path.resolve(scriptDir, '../public')
|
||||
|
||||
/** string[] -> [{ value: string }] — lásd src/globals/fields/stringArray.ts */
|
||||
function toStringArray(items: readonly string[]): { value: string }[] {
|
||||
return items.map((value) => ({ value }))
|
||||
}
|
||||
|
||||
// `external` in the legacy JSON is ignored: new-tab behaviour is derived
|
||||
// from the URL itself (MITHOME-124).
|
||||
type CtaJson = { text: string; href: string }
|
||||
|
||||
/** MITHOME-123: internal JSON paths become page links, the rest stay URLs. */
|
||||
function toCtaLink({ text, href }: CtaJson) {
|
||||
const page = internalPathToPageKey(href)
|
||||
return page
|
||||
? { text, linkType: 'page' as const, page }
|
||||
: { text, linkType: 'url' as const, href }
|
||||
}
|
||||
|
||||
function buildHomeData(json: typeof homeJson) {
|
||||
const { hero, about, services, cta, serviceFeatures } = json
|
||||
return {
|
||||
hero: {
|
||||
...hero,
|
||||
trustBullets: toStringArray(hero.trustBullets),
|
||||
cta: { primary: toCtaLink(hero.cta.primary), secondary: toCtaLink(hero.cta.secondary) },
|
||||
},
|
||||
about,
|
||||
services: {
|
||||
@@ -41,9 +83,27 @@ function buildHomeData(json: typeof homeJson) {
|
||||
},
|
||||
cta,
|
||||
serviceFeatures,
|
||||
// MITHOME-131: seeded in the default locale (hu); en comes from the migration.
|
||||
referencesSection: {
|
||||
clientsTitle: REFERENCES_SECTION_COPY.clientsTitle.hu,
|
||||
clientsSubtitle: REFERENCES_SECTION_COPY.clientsSubtitle.hu,
|
||||
partnersTitle: REFERENCES_SECTION_COPY.partnersTitle.hu,
|
||||
partnersSubtitle: REFERENCES_SECTION_COPY.partnersSubtitle.hu,
|
||||
relationshipLabels: Object.fromEntries(
|
||||
Object.entries(REFERENCES_SECTION_COPY.relationshipLabels).map(([key, copy]) => [key, copy.hu]),
|
||||
) as Record<keyof typeof REFERENCES_SECTION_COPY.relationshipLabels, string>,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/** MITHOME-131: the JSON partners are confirmed client references with written permission. */
|
||||
function partnerMeta(name: string) {
|
||||
const confirmed = CONFIRMED_CLIENT_REFERENCES.find((c) => c.name === name)
|
||||
return confirmed
|
||||
? { relationship: 'client-reference' as const, publicationPermission: confirmed.permission, permissionReference: confirmed.permissionReference }
|
||||
: { relationship: 'client-reference' as const, publicationPermission: 'none' as const }
|
||||
}
|
||||
|
||||
function buildAboutData(json: typeof aboutJson) {
|
||||
const { meta, hero, story, mission, team, cta } = json
|
||||
return {
|
||||
@@ -76,25 +136,118 @@ function buildServicesData(json: typeof servicesJson) {
|
||||
}
|
||||
}
|
||||
|
||||
type LegalPageJson = {
|
||||
title: string
|
||||
lastUpdated: string
|
||||
sections: { id: string; title: string; content: string }[]
|
||||
}
|
||||
|
||||
/** MITHOME-136: the JSON section `id` is the section anchor. */
|
||||
function toLegalData({ sections, ...rest }: LegalPageJson) {
|
||||
return { ...rest, sections: sections.map(({ id, ...section }) => ({ anchor: id, ...section })) }
|
||||
}
|
||||
|
||||
/** Collections have no per-document "known slug" API like Globals do —
|
||||
* find-by-slug, then update or create. Idempotent across re-runs. */
|
||||
async function upsertLegalPage(payload: Payload, slug: string, json: LegalPageJson) {
|
||||
const existing = await payload.find({
|
||||
collection: 'legal-pages',
|
||||
where: { slug: { equals: slug } },
|
||||
limit: 1,
|
||||
})
|
||||
|
||||
if (existing.docs.length > 0) {
|
||||
await payload.update({
|
||||
collection: 'legal-pages',
|
||||
id: existing.docs[0].id,
|
||||
data: { slug, ...toLegalData(json), _status: 'published' },
|
||||
})
|
||||
} else {
|
||||
await payload.create({
|
||||
collection: 'legal-pages',
|
||||
data: { slug, ...toLegalData(json), _status: 'published' },
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
type PartnerJson = { name: string; url: string; logo: string }
|
||||
|
||||
/**
|
||||
* MITHOME-89 (MVP): a home.json partners.items publikus /partners/*.png
|
||||
* útvonalait tölti fel Media collection dokumentumként, majd Partner
|
||||
* rekordot hoz létre/frissít rá hivatkozva. Idempotens: a Media dokumentumot
|
||||
* `alt` (== partner név) alapján, a Partnert `name` alapján keresi.
|
||||
*/
|
||||
async function upsertPartner(payload: Payload, partner: PartnerJson) {
|
||||
const existingMedia = await payload.find({
|
||||
collection: 'media',
|
||||
where: { alt: { equals: partner.name } },
|
||||
limit: 1,
|
||||
})
|
||||
|
||||
let mediaId: string | number
|
||||
if (existingMedia.docs.length > 0) {
|
||||
mediaId = existingMedia.docs[0].id
|
||||
} else {
|
||||
const filePath = path.resolve(publicDir, partner.logo.replace(/^\//, ''))
|
||||
const created = await payload.create({
|
||||
collection: 'media',
|
||||
data: { alt: partner.name },
|
||||
filePath,
|
||||
})
|
||||
mediaId = created.id
|
||||
}
|
||||
|
||||
const existingPartner = await payload.find({
|
||||
collection: 'partners',
|
||||
where: { name: { equals: partner.name } },
|
||||
limit: 1,
|
||||
})
|
||||
|
||||
if (existingPartner.docs.length > 0) {
|
||||
await payload.update({
|
||||
collection: 'partners',
|
||||
id: existingPartner.docs[0].id,
|
||||
data: { name: partner.name, url: partner.url, logo: mediaId, ...partnerMeta(partner.name), _status: 'published' },
|
||||
})
|
||||
} else {
|
||||
await payload.create({
|
||||
collection: 'partners',
|
||||
data: { name: partner.name, url: partner.url, logo: mediaId, ...partnerMeta(partner.name), _status: 'published' },
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function run() {
|
||||
const payload = await getPayload({ config })
|
||||
|
||||
await payload.updateGlobal({ slug: 'home', data: buildHomeData(homeJson) })
|
||||
await payload.updateGlobal({ slug: 'home', data: { ...buildHomeData(homeJson), _status: 'published' } })
|
||||
payload.logger.info('Home global migrálva')
|
||||
|
||||
await payload.updateGlobal({ slug: 'about', data: buildAboutData(aboutJson) })
|
||||
await payload.updateGlobal({ slug: 'about', data: { ...buildAboutData(aboutJson), _status: 'published' } })
|
||||
payload.logger.info('About global migrálva')
|
||||
|
||||
await payload.updateGlobal({ slug: 'services', data: buildServicesData(servicesJson) })
|
||||
await payload.updateGlobal({ slug: 'services', data: { ...buildServicesData(servicesJson), _status: 'published' } })
|
||||
payload.logger.info('Services global migrálva')
|
||||
|
||||
await payload.updateGlobal({ slug: 'contact', data: contactJson })
|
||||
await payload.updateGlobal({ slug: 'contact', data: { ...contactJson, _status: 'published' } })
|
||||
payload.logger.info('Contact global migrálva')
|
||||
|
||||
await payload.updateGlobal({ slug: 'common', data: commonJson })
|
||||
await payload.updateGlobal({ slug: 'common', data: { ...commonJson, _status: 'published' } })
|
||||
payload.logger.info('Common global migrálva')
|
||||
|
||||
payload.logger.info('MITHOME-87 migráció kész.')
|
||||
await upsertLegalPage(payload, 'adatvedelem', adatvedelemJson)
|
||||
payload.logger.info('LegalPages/adatvedelem migrálva')
|
||||
|
||||
await upsertLegalPage(payload, 'hasznalati-feltetelek', hasznalatiFeltetelekJson)
|
||||
payload.logger.info('LegalPages/hasznalati-feltetelek migrálva')
|
||||
|
||||
for (const partner of homeJson.partners.items) {
|
||||
await upsertPartner(payload, partner)
|
||||
payload.logger.info(`Partners/${partner.name} migrálva`)
|
||||
}
|
||||
|
||||
payload.logger.info('MITHOME-87/88/89 migráció kész.')
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
/**
|
||||
* MITHOME-96 — Payload Local API integrációs teszt.
|
||||
*
|
||||
* Ez a "Local API integrációs tesztek" rész a ticketből: valódi, futó
|
||||
* MongoDB-vel ellenőrzi, hogy a src/lib/payload-content.ts adapter-réteg
|
||||
* ténylegesen jó alakú adatot ad vissza a Globals/Collections-ökből — nem
|
||||
* mock-olt Payload-dal, hanem éles Local API hívásokkal.
|
||||
*
|
||||
* WHY sima node script és nem Jest teszt: a Payload csomag (és több
|
||||
* függősége, pl. @payloadcms/richtext-lexical) ESM-only dist-et ad ki —
|
||||
* Jest (a next/jest SWC transformjával is) alapból nem transzformálja a
|
||||
* node_modules-t, így `import { getPayload } from 'payload'` egy Jest
|
||||
* tesztben `SyntaxError: Cannot use import statement outside a module`-lel
|
||||
* bukik (kipróbálva). A `transformIgnorePatterns` kiterjesztése a teljes
|
||||
* Payload-függőségi fára törékeny és karbantartás-igényes lenne — ehelyett
|
||||
* ugyanazt a bevált mintát követjük, mint a migrate-content-to-payload.ts /
|
||||
* export-content-snapshot.ts scriptek: `node --import tsx`, valódi Node
|
||||
* ESM-mel, semmilyen Jest-transzform nem kell.
|
||||
*
|
||||
* Futtatás (proto/ mappából, futó MongoDB-vel, migrált tartalommal):
|
||||
* MONGODB_URI="mongodb://admin:password123@localhost:27018/mozdit?authSource=admin" \
|
||||
* npm run test:payload
|
||||
*/
|
||||
import assert from 'assert/strict'
|
||||
import { getPayload } from 'payload'
|
||||
import config from '../src/payload.config'
|
||||
import {
|
||||
getCommonContent,
|
||||
getHomeContent,
|
||||
getAboutContent,
|
||||
getServicesContent,
|
||||
getContactContent,
|
||||
getLegalPage,
|
||||
getPartners,
|
||||
} from '../src/lib/payload-content'
|
||||
|
||||
let passed = 0
|
||||
|
||||
async function test(name: string, fn: () => Promise<void>) {
|
||||
try {
|
||||
await fn()
|
||||
passed++
|
||||
console.log(`✅ ${name}`)
|
||||
} catch (error) {
|
||||
console.error(`❌ ${name}`)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
async function run() {
|
||||
const payload = await getPayload({ config })
|
||||
|
||||
await test('getCommonContent visszaad hu és en tartalmat', async () => {
|
||||
const hu = await getCommonContent('hu')
|
||||
const en = await getCommonContent('en')
|
||||
assert.ok(hu.buttons.webmail, 'hiányzó hu webmail gomb szöveg')
|
||||
assert.ok(en.buttons.webmail, 'hiányzó en webmail gomb szöveg')
|
||||
})
|
||||
|
||||
await test('getHomeContent unwrap-eli a trustBullets és services.items.features tömböket', async () => {
|
||||
const home = await getHomeContent('hu')
|
||||
assert.ok(Array.isArray(home.hero.trustBullets))
|
||||
assert.ok(home.hero.trustBullets.every((v) => typeof v === 'string'))
|
||||
for (const item of home.services.items) {
|
||||
assert.ok(Array.isArray(item.features))
|
||||
assert.ok(item.features.every((v) => typeof v === 'string'))
|
||||
}
|
||||
})
|
||||
|
||||
await test('getAboutContent unwrap-eli a story és team paragraphs tömböket', async () => {
|
||||
const about = await getAboutContent('hu')
|
||||
assert.ok(Array.isArray(about.story.paragraphs))
|
||||
assert.ok(Array.isArray(about.team.paragraphs))
|
||||
})
|
||||
|
||||
await test('getServicesContent unwrap-eli a specs.items tömböket', async () => {
|
||||
const services = await getServicesContent('hu')
|
||||
for (const service of services.details.services) {
|
||||
assert.ok(Array.isArray(service.specs.items))
|
||||
}
|
||||
})
|
||||
|
||||
await test('getContactContent visszaadja a form mezőket', async () => {
|
||||
const contact = await getContactContent('hu')
|
||||
assert.ok(contact.form.fields.email.label)
|
||||
})
|
||||
|
||||
await test('getLegalPage megtalálja mindkét jogi oldalt', async () => {
|
||||
const privacy = await getLegalPage('adatvedelem', 'hu')
|
||||
const terms = await getLegalPage('hasznalati-feltetelek', 'hu')
|
||||
assert.equal(privacy?.slug, 'adatvedelem')
|
||||
assert.equal(terms?.slug, 'hasznalati-feltetelek')
|
||||
})
|
||||
|
||||
await test('getPartners csak logóval rendelkező partnereket ad vissza', async () => {
|
||||
const partners = await getPartners()
|
||||
for (const partner of partners) {
|
||||
assert.ok(partner.logo.url)
|
||||
assert.ok(partner.name)
|
||||
}
|
||||
})
|
||||
|
||||
await test('create/findByID/delete ciklus működik (contact-submissions)', async () => {
|
||||
const created = await payload.create({
|
||||
collection: 'contact-submissions',
|
||||
data: {
|
||||
name: 'Local API Test',
|
||||
email: 'local-api-test@example.com',
|
||||
subject: 'MITHOME-96 Local API teszt',
|
||||
message: 'Ez a rekord a test-payload-local-api.ts futása során jön létre és törlődik.',
|
||||
gdprConsent: true,
|
||||
status: 'new',
|
||||
},
|
||||
})
|
||||
assert.ok(created.id)
|
||||
|
||||
const found = await payload.findByID({ collection: 'contact-submissions', id: created.id })
|
||||
assert.equal(found.email, 'local-api-test@example.com')
|
||||
|
||||
await payload.delete({ collection: 'contact-submissions', id: created.id })
|
||||
|
||||
await assert.rejects(
|
||||
payload.findByID({ collection: 'contact-submissions', id: created.id })
|
||||
)
|
||||
})
|
||||
|
||||
console.log(`\n${passed}/${passed} Payload Local API teszt zöld.`)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
run().catch((error) => {
|
||||
console.error('\nPayload Local API teszt sikertelen:', error)
|
||||
process.exit(1)
|
||||
})
|
||||
@@ -0,0 +1,198 @@
|
||||
/**
|
||||
* MITHOME-136: one-off content transfer MongoDB → PostgreSQL, in two steps
|
||||
* so that only one Payload instance runs per process and the bundle can be
|
||||
* reviewed (and reused to seed a fresh database).
|
||||
*
|
||||
* export — reads through the shared config with the MongoDB adapter:
|
||||
* MONGODB_URI=… PAYLOAD_SECRET=… node --import tsx scripts/transfer-content.ts export <bundle.json> [--no-submissions] [--media-dir media]
|
||||
* import — writes through the site's config (PostgreSQL); refuses a non-empty target:
|
||||
* DATABASE_URI=… PAYLOAD_SECRET=… node --import tsx scripts/transfer-content.ts import <bundle.json>
|
||||
*
|
||||
* The bundle holds every global and collection except users (the admin is
|
||||
* re-created by deploy.sh), the published state in both locales, open drafts,
|
||||
* and the upload files. It contains personal data (contact submissions) unless
|
||||
* exported with --no-submissions: keep it out of git, chmod 600.
|
||||
*/
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import {
|
||||
buildConfig,
|
||||
commitTransaction,
|
||||
createLocalReq,
|
||||
getPayload,
|
||||
initTransaction,
|
||||
killTransaction,
|
||||
type CollectionConfig,
|
||||
type Payload,
|
||||
type PayloadRequest,
|
||||
} from 'payload'
|
||||
import { mongooseAdapter } from '@payloadcms/db-mongodb'
|
||||
|
||||
import { sharedConfig } from '../src/payload.shared'
|
||||
import { bundleCounts, localeData, upgradeDoc, type BundleDoc, type IdMap, type TransferBundle } from '../src/lib/content-transfer'
|
||||
|
||||
type Data = Record<string, unknown>
|
||||
type Slug = Parameters<Payload['find']>[0]['collection']
|
||||
type GlobalSlug = Parameters<Payload['findGlobal']>[0]['slug']
|
||||
|
||||
const [mode, bundlePath, ...flags] = process.argv.slice(2)
|
||||
const flag = (name: string) => flags.includes(name)
|
||||
const option = (name: string, fallback: string) => {
|
||||
const i = flags.indexOf(name)
|
||||
return i >= 0 && flags[i + 1] ? flags[i + 1] : fallback
|
||||
}
|
||||
|
||||
const collections = (sharedConfig.collections ?? []).filter((c) => c.slug !== 'users')
|
||||
const globals = sharedConfig.globals ?? []
|
||||
const hasDrafts = (c: { versions?: unknown }) => typeof c.versions === 'object' && c.versions !== null && 'drafts' in c.versions && Boolean((c.versions as { drafts?: unknown }).drafts)
|
||||
const LOCALES = ['hu', 'en'] as const
|
||||
|
||||
async function exportBundle(file: string) {
|
||||
const config = buildConfig({ ...sharedConfig, db: mongooseAdapter({ url: process.env.MONGODB_URI || '' }) })
|
||||
const payload = await getPayload({ config })
|
||||
const mediaDir = path.resolve(option('--media-dir', 'media'))
|
||||
const bundle: TransferBundle = { exportedAt: new Date().toISOString(), source: 'mongodb', globals: {}, collections: {}, files: {} }
|
||||
|
||||
for (const g of globals) {
|
||||
const slug = g.slug as GlobalSlug
|
||||
const published = (await payload.findGlobal({ slug, locale: 'all', depth: 0 })) as unknown as Data
|
||||
const latest = (await payload.findGlobal({ slug, locale: 'all', depth: 0, draft: true })) as unknown as Data
|
||||
bundle.globals[slug] = { published, ...(hasDrafts(g) && latest._status === 'draft' ? { draft: latest } : {}) }
|
||||
}
|
||||
|
||||
for (const c of collections) {
|
||||
if (c.slug === 'contact-submissions' && flag('--no-submissions')) continue
|
||||
const slug = c.slug as Slug
|
||||
const published = (await payload.find({ collection: slug, locale: 'all', depth: 0, pagination: false })).docs as unknown as Data[]
|
||||
const latest = hasDrafts(c)
|
||||
? ((await payload.find({ collection: slug, locale: 'all', depth: 0, pagination: false, draft: true })).docs as unknown as Data[])
|
||||
: []
|
||||
const byId = new Map<string, BundleDoc>(published.map((doc) => [String(doc.id), { published: doc }]))
|
||||
for (const doc of latest) {
|
||||
const entry = byId.get(String(doc.id))
|
||||
if (doc._status !== 'draft') continue
|
||||
if (entry) entry.draft = doc
|
||||
else byId.set(String(doc.id), { published: { ...doc }, draft: doc }) // never published
|
||||
}
|
||||
bundle.collections[slug] = [...byId.values()]
|
||||
|
||||
if (c.upload) {
|
||||
for (const { published: doc } of bundle.collections[slug]) {
|
||||
const name = String(doc.filename)
|
||||
bundle.files[name] = { mimeType: String(doc.mimeType), base64: fs.readFileSync(path.join(mediaDir, name)).toString('base64') }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fs.writeFileSync(file, JSON.stringify(bundle, null, 2), { mode: 0o600 })
|
||||
payload.logger.info(`MITHOME-136 export: ${JSON.stringify(bundleCounts(bundle))} → ${file}`)
|
||||
}
|
||||
|
||||
async function assertEmptyTarget(payload: Payload) {
|
||||
for (const c of collections) {
|
||||
const { totalDocs } = await payload.count({ collection: c.slug as Slug })
|
||||
if (totalDocs > 0) throw new Error(`Target is not empty: ${c.slug} has ${totalDocs} document(s). Nothing was written.`)
|
||||
}
|
||||
}
|
||||
|
||||
async function importCollection(payload: Payload, req: PayloadRequest, c: CollectionConfig, docs: BundleDoc[], bundle: TransferBundle, ids: IdMap) {
|
||||
const slug = c.slug as Slug
|
||||
const drafts = hasDrafts(c)
|
||||
for (const raw of docs) {
|
||||
const entry: BundleDoc = { published: upgradeDoc(c.slug, raw.published), ...(raw.draft ? { draft: upgradeDoc(c.slug, raw.draft) } : {}) }
|
||||
const oldId = String(entry.published.id)
|
||||
const neverPublished = entry.published._status === 'draft'
|
||||
const status = drafts ? { _status: neverPublished ? 'draft' : 'published' } : {}
|
||||
const file = c.upload
|
||||
? (() => {
|
||||
const name = String(entry.published.filename)
|
||||
const stored = bundle.files[name]
|
||||
const data = Buffer.from(stored.base64, 'base64')
|
||||
return { data, mimetype: stored.mimeType, name, size: data.length }
|
||||
})()
|
||||
: undefined
|
||||
|
||||
const created = await payload.create({
|
||||
req,
|
||||
collection: slug,
|
||||
locale: 'hu',
|
||||
data: { ...localeData(c.fields, entry.published, 'hu', ids), ...status } as never,
|
||||
...(file ? { file, overwriteExistingFiles: true } : {}),
|
||||
draft: neverPublished,
|
||||
})
|
||||
ids.set(oldId, String(created.id))
|
||||
await payload.update({
|
||||
req,
|
||||
collection: slug,
|
||||
id: created.id,
|
||||
locale: 'en',
|
||||
data: { ...localeData(c.fields, entry.published, 'en', ids), ...status } as never,
|
||||
draft: neverPublished,
|
||||
})
|
||||
if (entry.draft && !neverPublished) {
|
||||
for (const locale of LOCALES) {
|
||||
await payload.update({ req, collection: slug, id: created.id, locale, draft: true, data: localeData(c.fields, entry.draft, locale, ids) as never })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function importBundle(file: string) {
|
||||
const bundle = JSON.parse(fs.readFileSync(file, 'utf8')) as TransferBundle
|
||||
const { default: config } = await import('../src/payload.config')
|
||||
const payload = await getPayload({ config })
|
||||
await assertEmptyTarget(payload)
|
||||
|
||||
// One transaction: a failure leaves the target untouched ("change nothing").
|
||||
const req = await createLocalReq({}, payload)
|
||||
await initTransaction(req)
|
||||
try {
|
||||
const ids: IdMap = new Map()
|
||||
// Uploads first, so relationships can be mapped to the new ids.
|
||||
const ordered = [...collections].sort((a, b) => Number(Boolean(b.upload)) - Number(Boolean(a.upload)))
|
||||
for (const c of ordered) {
|
||||
await importCollection(payload, req, c, bundle.collections[c.slug] ?? [], bundle, ids)
|
||||
}
|
||||
|
||||
for (const g of globals) {
|
||||
const entry = bundle.globals[g.slug]
|
||||
if (!entry) continue
|
||||
const slug = g.slug as GlobalSlug
|
||||
const status = hasDrafts(g) ? { _status: 'published' } : {}
|
||||
for (const locale of LOCALES) {
|
||||
await payload.updateGlobal({ req, slug, locale, data: { ...localeData(g.fields, entry.published, locale, ids), ...status } as never })
|
||||
}
|
||||
if (entry.draft) {
|
||||
for (const locale of LOCALES) {
|
||||
await payload.updateGlobal({ req, slug, locale, draft: true, data: localeData(g.fields, entry.draft, locale, ids) as never })
|
||||
}
|
||||
}
|
||||
}
|
||||
await commitTransaction(req)
|
||||
} catch (error) {
|
||||
await killTransaction(req)
|
||||
throw error
|
||||
}
|
||||
|
||||
const counts: Record<string, number> = {}
|
||||
for (const c of collections) counts[c.slug] = (await payload.count({ collection: c.slug as Slug })).totalDocs
|
||||
payload.logger.info(`MITHOME-136 import: expected ${JSON.stringify(bundleCounts(bundle))}, got ${JSON.stringify(counts)}`)
|
||||
}
|
||||
|
||||
async function main() {
|
||||
if (!bundlePath || (mode !== 'export' && mode !== 'import')) {
|
||||
console.error('Usage: transfer-content.ts export|import <bundle.json> [--no-submissions] [--media-dir DIR]')
|
||||
process.exit(2)
|
||||
}
|
||||
if (mode === 'export') await exportBundle(bundlePath)
|
||||
else await importBundle(bundlePath)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
// Payload validation errors carry the failing fields in data.errors.
|
||||
const details = (error as { data?: { collection?: string; errors?: unknown } })?.data
|
||||
console.error('MITHOME-136 transfer failed:', error instanceof Error ? error.message : error)
|
||||
if (details) console.error(JSON.stringify(details, null, 2))
|
||||
process.exit(1)
|
||||
})
|
||||
@@ -1,91 +0,0 @@
|
||||
/**
|
||||
* Regression test for the Content Editor browser script: deleting an array
|
||||
* item via its ❌ button must reindex the remaining items, otherwise collect()
|
||||
* produces sparse arrays (null holes) that fail schema validation
|
||||
* ("$.details.services[1].specs.items[0]: string érték szükséges").
|
||||
*
|
||||
* Runs the REAL scripts/cms-editor-client.js in jsdom and clicks the actual
|
||||
* delete buttons — earlier coverage only exercised reindexItems() directly,
|
||||
* which missed that the onclick handler removed the node BEFORE looking up
|
||||
* its container (detached node → closest() === null → no reindex).
|
||||
*/
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
const clientJs = fs.readFileSync(path.join(__dirname, '../../../scripts/cms-editor-client.js'), 'utf8')
|
||||
|
||||
const service = (n: number) => ({
|
||||
id: `svc-${n}`,
|
||||
title: `Szolgáltatás ${n}`,
|
||||
description: `Leírás ${n}`,
|
||||
icon: '🔧',
|
||||
features: [`feature ${n}`],
|
||||
ctaText: 'CTA',
|
||||
})
|
||||
|
||||
const makeData = () => ({
|
||||
details: {
|
||||
title: 'Részletek',
|
||||
subtitle: 'Alcím',
|
||||
services: [
|
||||
{ icon: 'a', title: 's0', description: 'd0', specs: { title: 't0', items: ['a0', 'b0', 'c0'] } },
|
||||
{ icon: 'b', title: 's1', description: 'd1', specs: { title: 't1', items: ['a1', 'b1', 'c1'] } },
|
||||
{ icon: 'c', title: 's2', description: 'd2', specs: { title: 't2', items: ['a2', 'b2', 'c2'] } },
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
function bootClient(data: unknown) {
|
||||
;(global as any).DATA = data
|
||||
;(global as any).FILE = 'services'
|
||||
;(global as any).CSRF_TOKEN = 'test-token'
|
||||
;(global as any).fetch = jest.fn()
|
||||
document.body.innerHTML = '<div id="editor"></div>'
|
||||
// sloppy-mode eval publishes the script's functions on the global object
|
||||
;(0, eval)(clientJs)
|
||||
}
|
||||
|
||||
function deleteButtonFor(dataPath: string): HTMLButtonElement {
|
||||
const field = document.querySelector(`[data-path="${CSS.escape(dataPath)}"]`) as HTMLElement
|
||||
expect(field).not.toBeNull()
|
||||
const wrap = field.closest('.str-item') as HTMLElement
|
||||
expect(wrap).not.toBeNull()
|
||||
return wrap.querySelector('.btn-del') as HTMLButtonElement
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
delete (global as any).DATA
|
||||
delete (global as any).FILE
|
||||
delete (global as any).CSRF_TOKEN
|
||||
})
|
||||
|
||||
describe('Content Editor client delete/reindex', () => {
|
||||
it('deleting a nested string array item keeps the remaining items dense', () => {
|
||||
const data = makeData()
|
||||
bootClient(data)
|
||||
|
||||
deleteButtonFor('details.services[1].specs.items[0]').click()
|
||||
|
||||
const collected = (global as any).collect()
|
||||
expect(collected.details.services[1].specs.items).toEqual(['b1', 'c1'])
|
||||
expect(collected.details.services[0].specs.items).toEqual(['a0', 'b0', 'c0'])
|
||||
expect(collected.details.services[2].specs.items).toEqual(['a2', 'b2', 'c2'])
|
||||
})
|
||||
|
||||
it('deleting an object card reindexes the outer array', () => {
|
||||
const data = makeData()
|
||||
bootClient(data)
|
||||
|
||||
const cardHeader = Array.from(document.querySelectorAll('.card-header'))
|
||||
.find(h => h.textContent === 'details.services[1]') as HTMLElement
|
||||
expect(cardHeader).not.toBeNull()
|
||||
const card = cardHeader.closest('.obj-card') as HTMLElement
|
||||
;(card.querySelector('.btn-del-card') as HTMLButtonElement).click()
|
||||
|
||||
const collected = (global as any).collect()
|
||||
expect(collected.details.services).toHaveLength(2)
|
||||
expect(collected.details.services[0].title).toBe('s0')
|
||||
expect(collected.details.services[1].title).toBe('s2')
|
||||
expect(collected.details.services[1].specs.items).toEqual(['a2', 'b2', 'c2'])
|
||||
})
|
||||
})
|
||||
@@ -1,102 +0,0 @@
|
||||
/**
|
||||
* Regression tests for the Content Editor keyboard shortcuts (MITHOME-75).
|
||||
* Runs the real scripts/cms-editor-client.js in jsdom, dispatches actual
|
||||
* KeyboardEvents and asserts:
|
||||
* 1. Ctrl+S calls save (fetch /save) and the browser save dialog is
|
||||
* suppressed (preventDefault)
|
||||
* 2. Ctrl+P calls publish
|
||||
* 3. Ctrl+Shift+V opens the versions page in a new tab
|
||||
* 4. '?' opens the shortcuts overlay, Esc closes it
|
||||
* 5. plain 's' inside an input does NOT trigger save
|
||||
*/
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
const clientJs = fs.readFileSync(path.join(__dirname, '../../../scripts/cms-editor-client.js'), 'utf8')
|
||||
+ '\n' + fs.readFileSync(path.join(__dirname, '../../../scripts/cms-editor-shortcuts.js'), 'utf8')
|
||||
|
||||
const makeData = () => ({
|
||||
hero: { title: 'T', subtitle: 'S', description: 'D' },
|
||||
})
|
||||
|
||||
function press(target: Document | Element, init: KeyboardEventInit) {
|
||||
const ev = new KeyboardEvent('keydown', { bubbles: true, cancelable: true, ...init })
|
||||
target.dispatchEvent(ev)
|
||||
return ev
|
||||
}
|
||||
|
||||
const flush = () => new Promise(r => setTimeout(r, 0))
|
||||
|
||||
// Globals must exist BEFORE the eval — the client script boots immediately
|
||||
// (render(DATA, …)). The eval runs ONCE: every eval would add another keydown
|
||||
// listener to the shared jsdom document, and the toggle-style overlay handler
|
||||
// would then open/close itself multiple times per keypress.
|
||||
;(global as any).DATA = makeData()
|
||||
;(global as any).FILE = 'home'
|
||||
;(global as any).CSRF_TOKEN = 'boot'
|
||||
;(global as any).CONTENT_HASH = 'x'.repeat(64)
|
||||
;(global as any).fetch = jest.fn(async () => ({ status: 200, ok: true, json: async () => ({ ok: true }) }))
|
||||
;(global as any).window = global
|
||||
document.body.innerHTML = '<div id="editor"></div>'
|
||||
;(0, eval)(clientJs)
|
||||
|
||||
describe('Content Editor keyboard shortcuts', () => {
|
||||
let fetchCalls: Array<{ url: string; init?: RequestInit }>
|
||||
|
||||
beforeEach(() => {
|
||||
fetchCalls = []
|
||||
;(global as any).DATA = makeData()
|
||||
;(global as any).FILE = 'home'
|
||||
;(global as any).CSRF_TOKEN = 'test-csrf'
|
||||
;(global as any).CONTENT_HASH = 'x'.repeat(64)
|
||||
;(global as any).fetch = jest.fn(async (url: string, init?: RequestInit) => {
|
||||
fetchCalls.push({ url, init })
|
||||
return { status: 200, ok: true, json: async () => ({ ok: true, contentHash: 'y'.repeat(64) }) }
|
||||
})
|
||||
;(global as any).window = global
|
||||
;(window as any).open = jest.fn()
|
||||
document.body.innerHTML = '<div id="editor"></div><span id="saveStatus" style="display:none"></span><button id="publishBtn">pub</button>'
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
delete (global as any).DATA
|
||||
delete (global as any).FILE
|
||||
delete (global as any).CSRF_TOKEN
|
||||
delete (global as any).CONTENT_HASH
|
||||
})
|
||||
|
||||
it('Ctrl+S saves via fetch and suppresses the browser save dialog', () => {
|
||||
const ev = press(document, { key: 's', ctrlKey: true })
|
||||
expect(ev.defaultPrevented).toBe(true)
|
||||
expect(fetchCalls.length).toBeGreaterThanOrEqual(1)
|
||||
expect(fetchCalls[0].url).toContain('/save?file=home')
|
||||
})
|
||||
|
||||
it('Cmd+P publishes', async () => {
|
||||
const ev = press(document, { key: 'p', metaKey: true })
|
||||
expect(ev.defaultPrevented).toBe(true)
|
||||
await flush() // publish awaits save() before its own fetch
|
||||
expect(fetchCalls.some(c => c.url === '/publish')).toBe(true)
|
||||
})
|
||||
|
||||
it('Ctrl+Shift+V opens the versions page in a new tab', () => {
|
||||
const ev = press(document, { key: 'V', ctrlKey: true, shiftKey: true })
|
||||
expect(ev.defaultPrevented).toBe(true)
|
||||
expect((window as any).open).toHaveBeenCalledWith('/versions?file=home', '_blank')
|
||||
})
|
||||
|
||||
it("'?' opens the shortcuts overlay and Esc closes it", () => {
|
||||
press(document, { key: '?' })
|
||||
expect(document.getElementById('shortcuts-overlay')).not.toBeNull()
|
||||
press(document, { key: 'Escape' })
|
||||
expect(document.getElementById('shortcuts-overlay')).toBeNull()
|
||||
})
|
||||
|
||||
it('plain typing in an input never triggers save', () => {
|
||||
const input = document.createElement('input')
|
||||
document.body.appendChild(input)
|
||||
const ev = press(input, { key: 's' })
|
||||
expect(ev.defaultPrevented).toBe(false)
|
||||
expect(fetchCalls.length).toBe(0)
|
||||
})
|
||||
})
|
||||
@@ -1,6 +1,10 @@
|
||||
/**
|
||||
* End-to-End tests for the Docker environment
|
||||
* These tests verify the full application flow in the Docker stack
|
||||
*
|
||||
* MITHOME-96: routes are locale-prefixed (/hu/..., /en/...) since the
|
||||
* Payload CMS migration (MITHOME-91/114) — updated from the old unprefixed
|
||||
* paths.
|
||||
*/
|
||||
|
||||
describe('Docker E2E Tests', () => {
|
||||
@@ -27,24 +31,24 @@ describe('Docker E2E Tests', () => {
|
||||
expect(html).toContain('mozdIT Bt.')
|
||||
|
||||
// Test navigation links exist in homepage
|
||||
expect(html).toContain('href="/rolunk"')
|
||||
expect(html).toContain('href="/szolgaltatasok"')
|
||||
expect(html).toContain('href="/kapcsolat"')
|
||||
expect(html).toContain('href="/hu/rolunk"')
|
||||
expect(html).toContain('href="/hu/szolgaltatasok"')
|
||||
expect(html).toContain('href="/hu/kapcsolat"')
|
||||
|
||||
// Test about page
|
||||
response = await fetch(`${APP_URL}/rolunk`)
|
||||
response = await fetch(`${APP_URL}/hu/rolunk`)
|
||||
expect(response.status).toBe(200)
|
||||
html = await response.text()
|
||||
expect(html).toContain('Rólunk')
|
||||
|
||||
// Test services page
|
||||
response = await fetch(`${APP_URL}/szolgaltatasok`)
|
||||
response = await fetch(`${APP_URL}/hu/szolgaltatasok`)
|
||||
expect(response.status).toBe(200)
|
||||
html = await response.text()
|
||||
expect(html).toContain('Szolgáltatásaink')
|
||||
|
||||
// Test contact page
|
||||
response = await fetch(`${APP_URL}/kapcsolat`)
|
||||
response = await fetch(`${APP_URL}/hu/kapcsolat`)
|
||||
expect(response.status).toBe(200)
|
||||
html = await response.text()
|
||||
expect(html).toContain('Kapcsolat')
|
||||
@@ -210,9 +214,9 @@ describe('Docker E2E Tests', () => {
|
||||
|
||||
const pages = [
|
||||
{ url: '', title: 'mozdIT Bt.' },
|
||||
{ url: '/rolunk', title: 'Rólunk' },
|
||||
{ url: '/szolgaltatasok', title: 'Szolgáltatásaink' },
|
||||
{ url: '/kapcsolat', title: 'Kapcsolatfelvétel' }
|
||||
{ url: '/hu/rolunk', title: 'Rólunk' },
|
||||
{ url: '/hu/szolgaltatasok', title: 'Szolgáltatásaink' },
|
||||
{ url: '/hu/kapcsolat', title: 'Kapcsolat' }
|
||||
]
|
||||
|
||||
for (const page of pages) {
|
||||
|
||||
@@ -1,21 +1,39 @@
|
||||
/**
|
||||
* Integration tests for the Docker development environment
|
||||
* These tests run against the real services in the Docker stack
|
||||
*
|
||||
* MITHOME-96: updated for the Payload CMS migration (MITHOME-85 epic) —
|
||||
* routes are now locale-prefixed (/hu/..., /en/...) and content lives in
|
||||
* Payload collections/globals (`globals`, `legal-pages`, `partners`,
|
||||
* `contact-submissions`), not the old raw `site_config`/`contact_submissions`
|
||||
* Mongoose collections. Assumes the Docker dev DB already has content
|
||||
* migrated (`npm run migrate:content`) — see docs/backups for a snapshot if
|
||||
* you need to reseed a throwaway environment.
|
||||
*
|
||||
* MITHOME-136: the stack runs PostgreSQL (dev host port 5433, registered);
|
||||
* MITHOME-137: grafana moved to 3012 (3001 is taken on llmdev).
|
||||
*/
|
||||
|
||||
import { MongoClient, ObjectId } from 'mongodb'
|
||||
import { Client } from 'pg'
|
||||
|
||||
const DOCKER_SERVICES = {
|
||||
app: 'http://localhost:8080',
|
||||
mongoExpress: 'http://localhost:8081',
|
||||
grafana: 'http://localhost:3001',
|
||||
grafana: 'http://localhost:3012',
|
||||
loki: 'http://localhost:3100',
|
||||
mongodb: 'mongodb://admin:password123@localhost:27018/mozdit?authSource=admin'
|
||||
postgres: 'postgresql://mozdit_web:devpassword@localhost:5433/mozdit_web',
|
||||
}
|
||||
|
||||
async function query<T extends Record<string, unknown>>(sql: string, params: unknown[] = []): Promise<T[]> {
|
||||
const client = new Client({ connectionString: DOCKER_SERVICES.postgres })
|
||||
await client.connect()
|
||||
try {
|
||||
return (await client.query<T>(sql, params)).rows
|
||||
} finally {
|
||||
await client.end()
|
||||
}
|
||||
}
|
||||
|
||||
describe('Docker Environment Integration Tests', () => {
|
||||
let mongoClient: MongoClient | null = null
|
||||
|
||||
beforeAll(async () => {
|
||||
// Skip integration tests if not in Docker environment
|
||||
if (process.env.NODE_ENV === 'test' && !process.env.INTEGRATION_TESTS) {
|
||||
@@ -24,12 +42,6 @@ describe('Docker Environment Integration Tests', () => {
|
||||
}
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
if (mongoClient) {
|
||||
await mongoClient.close()
|
||||
}
|
||||
})
|
||||
|
||||
describe('Service Health Checks', () => {
|
||||
it('should connect to Next.js app', async () => {
|
||||
if (process.env.NODE_ENV === 'test' && !process.env.INTEGRATION_TESTS) {
|
||||
@@ -47,70 +59,40 @@ describe('Docker Environment Integration Tests', () => {
|
||||
expect(data).toHaveProperty('environment')
|
||||
})
|
||||
|
||||
it('should connect to MongoDB directly', async () => {
|
||||
it('should connect to PostgreSQL directly', async () => {
|
||||
if (process.env.NODE_ENV === 'test' && !process.env.INTEGRATION_TESTS) {
|
||||
return
|
||||
}
|
||||
|
||||
mongoClient = new MongoClient(DOCKER_SERVICES.mongodb)
|
||||
await mongoClient.connect()
|
||||
|
||||
const adminDb = mongoClient.db('admin')
|
||||
const result = await adminDb.admin().ping()
|
||||
expect(result).toEqual({ ok: 1 })
|
||||
const [row] = await query<{ ok: number }>('select 1 as ok')
|
||||
expect(row.ok).toBe(1)
|
||||
})
|
||||
|
||||
it('should verify MongoDB initialization', async () => {
|
||||
it('should verify the schema migrations ran', async () => {
|
||||
if (process.env.NODE_ENV === 'test' && !process.env.INTEGRATION_TESTS) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!mongoClient) {
|
||||
mongoClient = new MongoClient(DOCKER_SERVICES.mongodb)
|
||||
await mongoClient.connect()
|
||||
const tables = (await query<{ table_name: string }>(
|
||||
"select table_name from information_schema.tables where table_schema = 'public'",
|
||||
)).map((t) => t.table_name)
|
||||
for (const table of ['home', 'legal_pages', 'partners', 'contact_submissions', 'users', 'products', 'payload_migrations']) {
|
||||
expect(tables).toContain(table)
|
||||
}
|
||||
|
||||
const mozditDb = mongoClient.db('mozdit')
|
||||
const collections = await mozditDb.listCollections().toArray()
|
||||
|
||||
const collectionNames = collections.map(c => c.name)
|
||||
expect(collectionNames).toContain('site_config')
|
||||
expect(collectionNames).toContain('contact_submissions')
|
||||
expect(collectionNames).toContain('users')
|
||||
const migrations = await query<{ name: string }>('select name from payload_migrations')
|
||||
expect(migrations.map((m) => m.name)).toEqual(expect.arrayContaining([expect.stringMatching(/_initial$/)]))
|
||||
})
|
||||
|
||||
it('should verify site config data exists', async () => {
|
||||
it('should verify the Home global exists and is published', async () => {
|
||||
if (process.env.NODE_ENV === 'test' && !process.env.INTEGRATION_TESTS) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!mongoClient) {
|
||||
mongoClient = new MongoClient(DOCKER_SERVICES.mongodb)
|
||||
await mongoClient.connect()
|
||||
}
|
||||
|
||||
const mozditDb = mongoClient.db('mozdit')
|
||||
const siteConfig = await mozditDb.collection('site_config').findOne()
|
||||
|
||||
if (!siteConfig) throw new Error('site_config document not found')
|
||||
expect(siteConfig).toBeTruthy()
|
||||
expect(siteConfig).toHaveProperty('type', 'site_config')
|
||||
expect(siteConfig).toHaveProperty('environment', 'development')
|
||||
expect(siteConfig).toHaveProperty('data')
|
||||
expect(siteConfig.data).toHaveProperty('general')
|
||||
expect(siteConfig.data.general).toHaveProperty('name', 'mozdIT Bt.')
|
||||
})
|
||||
|
||||
it('should access Mongo Express UI', async () => {
|
||||
if (process.env.NODE_ENV === 'test' && !process.env.INTEGRATION_TESTS) {
|
||||
return
|
||||
}
|
||||
|
||||
const response = await fetch(DOCKER_SERVICES.mongoExpress)
|
||||
expect(response.status).toBe(200)
|
||||
|
||||
const html = await response.text()
|
||||
expect(html).toContain('Mongo Express')
|
||||
const [home] = await query<{ _status: string }>('select _status from home limit 1')
|
||||
if (!home) throw new Error('Home global row not found')
|
||||
expect(home._status).toBe('published')
|
||||
const titles = await query<{ hero_title: string }>("select hero_title from home_locales where _locale = 'hu'")
|
||||
expect(titles[0]?.hero_title).toBeTruthy()
|
||||
})
|
||||
|
||||
it('should access Grafana UI', async () => {
|
||||
@@ -173,14 +155,10 @@ describe('Docker Environment Integration Tests', () => {
|
||||
expect(result).toHaveProperty('timestamp')
|
||||
expect(result).toHaveProperty('submissionId')
|
||||
|
||||
if (!mongoClient) {
|
||||
mongoClient = new MongoClient(DOCKER_SERVICES.mongodb)
|
||||
await mongoClient.connect()
|
||||
}
|
||||
const savedSubmission = await mongoClient
|
||||
.db('mozdit')
|
||||
.collection('contact_submissions')
|
||||
.findOne({ _id: new ObjectId(result.submissionId) })
|
||||
const [savedSubmission] = await query(
|
||||
'select name, email, subject, message, gdpr_consent as "gdprConsent", status from contact_submissions where id = $1',
|
||||
[result.submissionId],
|
||||
)
|
||||
expect(savedSubmission).toEqual(expect.objectContaining({
|
||||
name: contactData.name,
|
||||
email: contactData.email,
|
||||
@@ -256,7 +234,7 @@ describe('Docker Environment Integration Tests', () => {
|
||||
|
||||
const result = await response.json()
|
||||
if (response.status === 400) {
|
||||
expect(result).toHaveProperty('error', 'Spam gyanús tartalom észlelve')
|
||||
expect(result).toHaveProperty('error', 'Az üzenet spam gyanús tartalmat tartalmaz.')
|
||||
} else if (response.status === 429) {
|
||||
expect(result).toHaveProperty('error')
|
||||
expect(result.error).toContain('Túl sok')
|
||||
@@ -270,13 +248,14 @@ describe('Docker Environment Integration Tests', () => {
|
||||
return
|
||||
}
|
||||
|
||||
// MITHOME-91/114: bare "/" 307-redirects to "/hu" — fetch follows
|
||||
// redirects by default, so this still lands on the real homepage.
|
||||
const response = await fetch(DOCKER_SERVICES.app)
|
||||
expect(response.status).toBe(200)
|
||||
|
||||
|
||||
const html = await response.text()
|
||||
expect(html).toContain('mozdIT Bt.')
|
||||
expect(html).toContain('Megbízható web‑ és email‑szolgáltatás')
|
||||
expect(html).toContain('Webmail Ugrás')
|
||||
expect(html).toContain('Megbízható web- és email szolgáltatás')
|
||||
})
|
||||
|
||||
it('should load about page', async () => {
|
||||
@@ -284,9 +263,9 @@ describe('Docker Environment Integration Tests', () => {
|
||||
return
|
||||
}
|
||||
|
||||
const response = await fetch(`${DOCKER_SERVICES.app}/rolunk`)
|
||||
const response = await fetch(`${DOCKER_SERVICES.app}/hu/rolunk`)
|
||||
expect(response.status).toBe(200)
|
||||
|
||||
|
||||
const html = await response.text()
|
||||
expect(html).toContain('Rólunk')
|
||||
expect(html).toContain('mozdIT Bt.')
|
||||
@@ -297,14 +276,14 @@ describe('Docker Environment Integration Tests', () => {
|
||||
return
|
||||
}
|
||||
|
||||
const response = await fetch(`${DOCKER_SERVICES.app}/szolgaltatasok`)
|
||||
const response = await fetch(`${DOCKER_SERVICES.app}/hu/szolgaltatasok`)
|
||||
expect(response.status).toBe(200)
|
||||
|
||||
|
||||
const html = await response.text()
|
||||
expect(html).toContain('Szolgáltatásaink')
|
||||
expect(html).toContain('Web Hosting')
|
||||
expect(html).toContain('Email Szolgáltatás')
|
||||
expect(html).toContain('DNS Adminisztráció')
|
||||
expect(html).toContain('Webtárhely')
|
||||
expect(html).toContain('E-mail szolgáltatás')
|
||||
expect(html).toContain('DNS adminisztráció')
|
||||
})
|
||||
|
||||
it('should load contact page', async () => {
|
||||
@@ -312,9 +291,9 @@ describe('Docker Environment Integration Tests', () => {
|
||||
return
|
||||
}
|
||||
|
||||
const response = await fetch(`${DOCKER_SERVICES.app}/kapcsolat`)
|
||||
const response = await fetch(`${DOCKER_SERVICES.app}/hu/kapcsolat`)
|
||||
expect(response.status).toBe(200)
|
||||
|
||||
|
||||
const html = await response.text()
|
||||
// The page title is "Kapcsolat" not "Kapcsolatfelvétel"
|
||||
expect(html).toContain('Kapcsolat')
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
import type { Metadata } from 'next'
|
||||
import { notFound } from 'next/navigation'
|
||||
import AboutView from '@/components/views/AboutView'
|
||||
import ServicesView from '@/components/views/ServicesView'
|
||||
import ContactView from '@/components/views/ContactView'
|
||||
import LegalPageView from '@/components/views/LegalPageView'
|
||||
import HostingPlansView from '@/components/views/HostingPlansView'
|
||||
import { resolvePageKey, isLocale, localePath, type Locale } from '@/lib/i18n'
|
||||
import { absoluteUrl, pageAlternates } from '@/lib/seo'
|
||||
import {
|
||||
getAboutContent,
|
||||
getServicesContent,
|
||||
getContactContent,
|
||||
getHomeContent,
|
||||
getCommonContent,
|
||||
getLegalPage,
|
||||
getHostingPlans,
|
||||
getHostingPlansContent,
|
||||
} from '@/lib/payload-content'
|
||||
import { siteConfig, getOgLocale } from '@/config/site'
|
||||
|
||||
type Params = { locale: string; slug: string }
|
||||
|
||||
// WHY force-dynamic: lásd ../layout.tsx — nincs generateStaticParams, minden
|
||||
// kérés élőben olvassa a Payload-ot, admin publikálás azonnal látszik.
|
||||
export const dynamic = 'force-dynamic'
|
||||
|
||||
const LEGAL_META: Record<'privacy' | 'terms', Record<Locale, string>> = {
|
||||
privacy: {
|
||||
hu: 'Adatvédelmi tájékoztató - ismerje meg, hogyan kezeljük személyes adatait.',
|
||||
en: 'Privacy policy — learn how we handle your personal data.',
|
||||
},
|
||||
terms: {
|
||||
hu: 'Általános Szerződési Feltételek - Ismerje meg a mozdIT Bt. szolgáltatásainak használati feltételeit.',
|
||||
en: 'Terms of Service — learn about the terms and conditions of mozdIT Bt.’s services.',
|
||||
},
|
||||
}
|
||||
|
||||
export async function generateMetadata({ params }: { params: Promise<Params> }): Promise<Metadata> {
|
||||
const { locale: rawLocale, slug } = await params
|
||||
if (!isLocale(rawLocale)) return {}
|
||||
const locale: Locale = rawLocale
|
||||
const key = resolvePageKey(locale, slug)
|
||||
if (!key) return {}
|
||||
|
||||
const base = (title: string, description: string, ogDescription = description) => ({
|
||||
title: `${title} | ${siteConfig.general.name}`,
|
||||
description,
|
||||
openGraph: {
|
||||
title: `${title} | ${siteConfig.general.name}`,
|
||||
description: ogDescription,
|
||||
url: absoluteUrl(localePath(locale, key)),
|
||||
locale: getOgLocale(locale),
|
||||
},
|
||||
// MITHOME-116: self canonical + hreflang pairs (hu, en, x-default).
|
||||
alternates: pageAlternates(locale, key),
|
||||
})
|
||||
|
||||
if (key === 'about') {
|
||||
const about = await getAboutContent(locale)
|
||||
return base(about.meta.title, about.meta.description, about.meta.ogDescription)
|
||||
}
|
||||
if (key === 'services') {
|
||||
const services = await getServicesContent(locale)
|
||||
return base(services.meta.title, services.meta.description, services.meta.ogDescription)
|
||||
}
|
||||
if (key === 'contact') {
|
||||
const contact = await getContactContent(locale)
|
||||
return base(contact.meta.title, contact.meta.description)
|
||||
}
|
||||
if (key === 'hostingPlans') {
|
||||
const plans = await getHostingPlansContent(locale)
|
||||
return plans.meta ? base(plans.meta.title, plans.meta.description) : {}
|
||||
}
|
||||
if (key === 'privacy') {
|
||||
const page = await getLegalPage('adatvedelem', locale)
|
||||
return base(page?.title ?? 'Adatvédelem', LEGAL_META.privacy[locale])
|
||||
}
|
||||
// terms
|
||||
const page = await getLegalPage('hasznalati-feltetelek', locale)
|
||||
return base(page?.title ?? 'ÁSZF', LEGAL_META.terms[locale])
|
||||
}
|
||||
|
||||
export default async function CatchAllPage({ params }: { params: Promise<Params> }) {
|
||||
const { locale: rawLocale, slug } = await params
|
||||
if (!isLocale(rawLocale)) notFound()
|
||||
const locale: Locale = rawLocale
|
||||
const key = resolvePageKey(locale, slug)
|
||||
if (!key) notFound()
|
||||
|
||||
if (key === 'about') {
|
||||
const content = await getAboutContent(locale)
|
||||
return <AboutView content={content} locale={locale} />
|
||||
}
|
||||
|
||||
if (key === 'services') {
|
||||
const [content, home, common] = await Promise.all([
|
||||
getServicesContent(locale),
|
||||
getHomeContent(locale),
|
||||
getCommonContent(locale),
|
||||
])
|
||||
return (
|
||||
<ServicesView
|
||||
content={content}
|
||||
homeServices={home.services.items}
|
||||
featuresLabel={common.labels.features}
|
||||
webmailHref={home.hero.cta.secondary?.href ?? siteConfig.general.url}
|
||||
locale={locale}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
// MITHOME-130: not found while no plan is showable (the menu and sitemap follow the same gate).
|
||||
if (key === 'hostingPlans') {
|
||||
const [content, plans] = await Promise.all([getHostingPlansContent(locale), getHostingPlans(locale)])
|
||||
if (plans.length === 0) notFound()
|
||||
return <HostingPlansView content={content} plans={plans} locale={locale} />
|
||||
}
|
||||
|
||||
if (key === 'contact') {
|
||||
const [content, home, common] = await Promise.all([
|
||||
getContactContent(locale),
|
||||
getHomeContent(locale),
|
||||
getCommonContent(locale),
|
||||
])
|
||||
return (
|
||||
<ContactView
|
||||
content={content}
|
||||
contactEmail={siteConfig.contact.email}
|
||||
footerAddress={common.footer.address}
|
||||
webmailHref={home.hero.cta.secondary?.href ?? siteConfig.general.url}
|
||||
locale={locale}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const page = await getLegalPage(key === 'privacy' ? 'adatvedelem' : 'hasznalati-feltetelek', locale)
|
||||
if (!page) notFound()
|
||||
return <LegalPageView page={page} locale={locale} />
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user