@marvalt/digivalt-core 0.2.11 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,116 @@
1
+ # AI local bootstrap runbook — full WordPress control
2
+
3
+ This runbook is for projects scaffolded by AI tools (Cursor, Claude Code, Antigravity, Lovable) when you want full control from WordPress-managed static pages, menus, header/footer blocks, and theme styles.
4
+
5
+ Primary goal: after AI scaffolding is complete, the human should only need env values before first local run:
6
+
7
+ ```bash
8
+ npm run build && npm run dev
9
+ ```
10
+
11
+ ---
12
+
13
+ ## What AI must already have done
14
+
15
+ Before using this runbook, the generated project should already include:
16
+
17
+ - `@marvalt/digivalt-core@latest`
18
+ - `vite-node` and `react-helmet-async`
19
+ - `npx digivalt-init` output (or equivalent)
20
+ - `scripts/generate.ts` wired to `@marvalt/digivalt-core/generators`
21
+ - `functions/` + `wrangler.toml` for Pages Functions
22
+ - `.gitignore` rules for `.env`, `.env.local`, `.env.*.local`, `.dev.vars`
23
+
24
+ If missing, run:
25
+
26
+ ```bash
27
+ npm install @marvalt/digivalt-core@latest
28
+ npm install -D vite-node
29
+ npm install react-helmet-async
30
+ npx digivalt-init
31
+ ```
32
+
33
+ ---
34
+
35
+ ## Human-only step: set env values
36
+
37
+ Create/update `.env` and `.env.local` from the generated examples (`.env.example`, `.env.local.example`) and set values.
38
+
39
+ Important local rule:
40
+
41
+ - Do **not** set `VITE_IS_LOVABLE=true` locally for full-data mode.
42
+
43
+ ### Minimum env matrix for first successful full-data build
44
+
45
+ | Group | Required for first local `build` | Keys |
46
+ |------|------|------|
47
+ | WordPress static generation | Yes | `VITE_WORDPRESS_API_URL` (or `WORDPRESS_API_URL`) |
48
+ | WordPress auth | Usually yes (if API protected) | `VITE_WP_API_USERNAME` + `VITE_WP_APP_PASSWORD` (or `WP_API_USERNAME` + `WP_APP_PASSWORD`) |
49
+ | Gravity Forms | Uses WP creds by default | Optional dedicated keys: `VITE_GRAVITY_FORMS_API_URL`, `VITE_GRAVITY_FORMS_USERNAME`, `VITE_GRAVITY_FORMS_PASSWORD` |
50
+ | Mautic | Optional; generator skips when URL missing | `VITE_MAUTIC_URL` (+ optional `VITE_MAUTIC_API_PUBLIC_KEY`, `VITE_MAUTIC_API_SECRET_KEY`) |
51
+ | Cloudflare Access (if WP/API behind Zero Trust) | Conditional | `VITE_CF_ACCESS_CLIENT_ID`, `VITE_CF_ACCESS_CLIENT_SECRET` |
52
+ | SEO defaults | Recommended | `VITE_SEO_SITE_URL`, `VITE_SEO_SITE_NAME`, `VITE_SEO_DEFAULT_TITLE`, `VITE_SEO_DEFAULT_DESCRIPTION`, `VITE_SEO_DEFAULT_OG_IMAGE` |
53
+
54
+ ---
55
+
56
+ ## First local run
57
+
58
+ From app root:
59
+
60
+ ```bash
61
+ npm install
62
+ npm run build
63
+ npm run dev
64
+ ```
65
+
66
+ `npm run build` runs generation first and should produce/update:
67
+
68
+ - `public/wordpress-data.json`
69
+ - `public/gravity-forms-data.json`
70
+ - `src/data/mautic-data.json` (if Mautic configured)
71
+ - `public/sitemap-paths.json`
72
+
73
+ ---
74
+
75
+ ## Verification checklist
76
+
77
+ - Build succeeds without missing env errors.
78
+ - WordPress shell renders (menu/header/footer/theme) from static data.
79
+ - `public/sitemap-paths.json` is generated.
80
+ - No static `public/sitemap.xml` exists when using `functions/sitemap.xml.ts`.
81
+ - Local secrets are not tracked by git.
82
+
83
+ ---
84
+
85
+ ## Quick failure recovery
86
+
87
+ ### `Missing WordPress API URL`
88
+
89
+ Set `VITE_WORDPRESS_API_URL` (or `WORDPRESS_API_URL`) in env and rerun build.
90
+
91
+ ### WordPress or Gravity Forms auth failures
92
+
93
+ Verify app password credentials:
94
+
95
+ - `VITE_WP_API_USERNAME`
96
+ - `VITE_WP_APP_PASSWORD`
97
+
98
+ Or set dedicated GF credentials if needed.
99
+
100
+ ### No Mautic output
101
+
102
+ If `VITE_MAUTIC_URL` is missing, Mautic generation is skipped by design. Set it only if needed for your app.
103
+
104
+ ### Build behaves like fixture mode
105
+
106
+ Ensure `VITE_IS_LOVABLE` is not set to `true` locally.
107
+
108
+ ---
109
+
110
+ ## References
111
+
112
+ - [digivalt-npm-packages/digivalt-core/src/generators/wp.ts](../src/generators/wp.ts)
113
+ - [digivalt-npm-packages/digivalt-core/src/generators/gf.ts](../src/generators/gf.ts)
114
+ - [digivalt-npm-packages/digivalt-core/src/generators/mautic.ts](../src/generators/mautic.ts)
115
+ - [digivalt-npm-packages/digivalt-core/src/generators/sitemap-paths.ts](../src/generators/sitemap-paths.ts)
116
+ - [digivalt-landing/DIGIVALT_SETUP.md](../../../digivalt-landing/DIGIVALT_SETUP.md)
@@ -0,0 +1,140 @@
1
+ # AI master prompt — DigiVAlt full local WordPress control
2
+
3
+ Use this as a single copy-paste master prompt in Cursor, Claude Code, Antigravity, Lovable, or similar AI coding tools.
4
+
5
+ The objective is a DigiValt app scaffold that is production-shaped from day one, where after generation a human only needs to set `.env` / `.env.local` values before first local run:
6
+
7
+ ```bash
8
+ npm run build && npm run dev
9
+ ```
10
+
11
+ ## Scope
12
+
13
+ - **AI responsibilities:** scaffold code, install/wire dependencies, run `digivalt-init`, ensure scripts/files are correct, keep cloud/function wiring and SEO enabled, and build a WordPress-driven shell.
14
+ - **Human responsibilities:** set real env values on local PC and cloud dashboard, run first local build/dev, replace placeholder static data with real generated exports as needed.
15
+
16
+ ## Canonical sources
17
+
18
+ - [README.md](../README.md)
19
+ - [template/DIGIVALT_SETUP.md](../template/DIGIVALT_SETUP.md)
20
+ - [template/scripts/generate.ts](../template/scripts/generate.ts)
21
+ - [docs/SEO-PERFORMANCE.md](./SEO-PERFORMANCE.md)
22
+ - [digivalt-landing/DIGIVALT_SETUP.md](../../../digivalt-landing/DIGIVALT_SETUP.md)
23
+
24
+ ---
25
+
26
+ ## Master prompt text (paste below into your AI tool)
27
+
28
+ You are a senior full-stack engineer scaffolding a DigiValt consumer app (Vite + React + TypeScript) with full WordPress-controlled static content behavior. This workflow must work the same whether run from Cursor, Claude Code, Antigravity, Lovable, or another AI assistant.
29
+
30
+ ### Non-negotiables
31
+
32
+ - Install `@marvalt/digivalt-core@latest`.
33
+ - Use `npx digivalt-init` to enforce DigiValt-managed scaffold files and scripts.
34
+ - Keep Cloudflare Pages Functions + `wrangler.toml` enabled.
35
+ - Keep SEO enabled by default (Helmet provider + DigiValt SEO helpers).
36
+ - Keep local secrets out of git and ignore `.env`, `.env.local`, `.env.*.local`, `.dev.vars`.
37
+ - Do not hand-maintain `public/sitemap-paths.json`; it is generated.
38
+ - Do not create `public/sitemap.xml` when using `functions/sitemap.xml.ts`.
39
+
40
+ ### File/path requirements
41
+
42
+ Use these exact static data paths:
43
+
44
+ - `public/wordpress-data.json`
45
+ - `public/gravity-forms-data.json`
46
+ - `src/data/mautic-data.json`
47
+
48
+ If real exports are unavailable, use template starter fixtures (or equivalent minimal placeholders) so the app boots. Mark placeholders clearly.
49
+
50
+ ### Build wiring requirements
51
+
52
+ Ensure these commands exist and are used:
53
+
54
+ ```bash
55
+ npm install @marvalt/digivalt-core@latest
56
+ npm install -D vite-node
57
+ npx digivalt-init
58
+ npm install react-helmet-async
59
+ ```
60
+
61
+ Expected scripts:
62
+
63
+ - `generate`: `npx vite-node --options.deps.inline="@marvalt/digivalt-core/generators" scripts/generate.ts`
64
+ - `build`: `npx vite-node --options.deps.inline="@marvalt/digivalt-core/generators" scripts/generate.ts && vite build`
65
+ - `build:dev`: `npx vite-node --options.deps.inline="@marvalt/digivalt-core/generators" scripts/generate.ts && vite build --mode development`
66
+ - `dev`: `vite`
67
+
68
+ ### `scripts/generate.ts` behavior
69
+
70
+ Import from `@marvalt/digivalt-core/generators` only:
71
+
72
+ - In hosted fixture mode (`VITE_IS_LOVABLE=true`): skip fetch, run `generateSitemapPathsSafe()`.
73
+ - In normal local mode (default): run `generateAllData()` then sitemap; on fetch failure still run sitemap safe fallback.
74
+
75
+ ### WordPress-driven runtime wiring (must implement)
76
+
77
+ After `loadWordPressData()` from `@marvalt/digivalt-core/static`, wire the app shell and routes using WordPress static data:
78
+
79
+ 1. Menus from `getNavigationMenu()` / `getMenuById()` (+ `getParsedHeader()` / `getHeaderMenuId()`).
80
+ 2. Header/footer template blocks from `getHeader()` / `getFooter()`.
81
+ 3. Site identity from `getSiteSettings()` / `getLogoUrl()` / `getSiteIconUrl()`.
82
+ 4. Theme styles from `getWordPressData().theme_styles` mapped into app styling/tokens.
83
+ 5. Pages/posts/CPT routes from `getWordPressPages()`, `getWordPressPageBySlug()`, `getWordPressPosts()`, and `front_page`.
84
+
85
+ For forms, support Gravity Forms and Mautic via `@marvalt/digivalt-core/services` and/or JSON static stores.
86
+
87
+ ### Cloudflare and sitemap requirements
88
+
89
+ - Keep `functions/sitemap.xml.ts`.
90
+ - Keep `functions/api/*` handlers from template and keep `wrangler.toml`.
91
+ - Ensure sitemap flow is active:
92
+ - input: `public/sitemap-static-paths.json`
93
+ - generated output: `public/sitemap-paths.json`
94
+ - runtime endpoint: `/sitemap.xml` from Pages Function
95
+
96
+ ### AI output constraints
97
+
98
+ - Do not request humans to hand-edit code before first run.
99
+ - After scaffolding, the only required manual step before first run is env values in `.env` / `.env.local`.
100
+ - Provide a final validation checklist and commands:
101
+ - `npm run build`
102
+ - `npm run dev`
103
+
104
+ ---
105
+
106
+ ## Built-in defaults (use unless humans override later)
107
+
108
+ - Package: `@marvalt/digivalt-core@latest`
109
+ - Static data: template starter fixtures for WordPress, Gravity Forms, Mautic
110
+ - SEO: ON
111
+ - Cloudflare Functions + `wrangler.toml`: ON
112
+ - Form/page mapping: derive from WordPress content and shortcodes first
113
+
114
+ ---
115
+
116
+ ## Pre-flight checklist
117
+
118
+ | Step | Done |
119
+ |------|------|
120
+ | `@marvalt/digivalt-core@latest` installed | ☐ |
121
+ | `digivalt-init` run and scripts verified | ☐ |
122
+ | Required static data files exist (`wordpress`, `gravity-forms`, `mautic`) | ☐ |
123
+ | `sitemap-static-paths.json` exists and `sitemap-paths.json` is generated | ☐ |
124
+ | Cloudflare functions/wrangler files present | ☐ |
125
+ | SEO imports + `HelmetProvider` wired | ☐ |
126
+ | `.gitignore` excludes local secret files | ☐ |
127
+
128
+ ---
129
+
130
+ ## Reference paths in this monorepo
131
+
132
+ | Concern | File |
133
+ |---------|------|
134
+ | Local setup baseline | [digivalt-landing/DIGIVALT_SETUP.md](../../../digivalt-landing/DIGIVALT_SETUP.md) |
135
+ | Template setup baseline | [template/DIGIVALT_SETUP.md](../template/DIGIVALT_SETUP.md) |
136
+ | Init behavior and script expectations | [README.md](../README.md) |
137
+ | Generator script template | [template/scripts/generate.ts](../template/scripts/generate.ts) |
138
+ | Landing generator implementation | [digivalt-landing/scripts/generate.ts](../../../digivalt-landing/scripts/generate.ts) |
139
+ | SEO and sitemap behavior | [docs/SEO-PERFORMANCE.md](./SEO-PERFORMANCE.md) |
140
+ | WP static getters and shell helpers | [src/static/wpStatic.ts](../src/static/wpStatic.ts) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marvalt/digivalt-core",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "Core glue logic and shared context for DigiVAlt frontend applications",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "main": "dist/index.cjs",
@@ -0,0 +1,7 @@
1
+ {
2
+ "_placeholder": true,
3
+ "_placeholder_note": "Replace with generated Gravity Forms data before production.",
4
+ "generated_at": "1970-01-01T00:00:00.000Z",
5
+ "total_forms": 0,
6
+ "forms": []
7
+ }
@@ -1,3 +1,3 @@
1
- {
2
- "paths": []
3
- }
1
+ {
2
+ "paths": []
3
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "_placeholder": true,
3
+ "_placeholder_note": "Replace with generated WordPress data before production.",
4
+ "generated_at": "1970-01-01T00:00:00.000Z",
5
+ "frontend_id": "lovable-starter",
6
+ "frontend_name": "Lovable Starter",
7
+ "front_page": null,
8
+ "site_settings": {
9
+ "site_name": "DigiValt Starter",
10
+ "site_description": "Placeholder data",
11
+ "logo": null,
12
+ "site_icon": null
13
+ },
14
+ "theme_styles": {
15
+ "colors": {
16
+ "theme_palette": []
17
+ },
18
+ "typography": {}
19
+ },
20
+ "header": {
21
+ "slug": "header",
22
+ "area": "header",
23
+ "blocks": [],
24
+ "blocks_count": 0
25
+ },
26
+ "footer": {
27
+ "slug": "footer",
28
+ "area": "footer",
29
+ "blocks": [],
30
+ "blocks_count": 0
31
+ },
32
+ "navigation_menu": {
33
+ "id": 0,
34
+ "name": "Primary",
35
+ "slug": "primary",
36
+ "items": []
37
+ },
38
+ "menus": {},
39
+ "pages": [],
40
+ "posts": [],
41
+ "config": {
42
+ "post_types": {}
43
+ }
44
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "_placeholder": true,
3
+ "_placeholder_note": "Replace with generated Mautic data before production.",
4
+ "generated_at": "1970-01-01T00:00:00.000Z",
5
+ "total_forms": 0,
6
+ "forms": []
7
+ }