oneie 3.6.7 → 3.6.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.
Files changed (168) hide show
  1. package/.claude/agents/agent-backend.md +83 -0
  2. package/.claude/agents/agent-designer.md +97 -0
  3. package/.claude/agents/agent-director.md +118 -7
  4. package/.claude/agents/agent-documenter.md +93 -0
  5. package/.claude/agents/agent-frontend.md +96 -0
  6. package/.claude/agents/agent-ops.md +264 -32
  7. package/.claude/agents/agent-problem-solver.md +166 -0
  8. package/.claude/agents/agent-quality.md +127 -0
  9. package/.claude/commands/build.md +293 -0
  10. package/.claude/commands/cascade.md +231 -127
  11. package/.claude/commands/deploy.md +56 -17
  12. package/.claude/commands/mcp-toggle.md +93 -0
  13. package/.claude/commands/one.md +78 -127
  14. package/.claude/commands/plan.md +394 -80
  15. package/.claude/commands/push.md +75 -14
  16. package/.claude/commands/release.md +89 -25
  17. package/.claude/commands/server.md +2 -0
  18. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  19. package/.claude/hooks/root-cleanup.py +75 -0
  20. package/.claude/skills/INDEX.md +523 -0
  21. package/.claude/skills/REGISTRY.md +529 -0
  22. package/.claude/skills/agent-backend-create-mutation.md +319 -0
  23. package/.claude/skills/agent-designer-create-wireframe.md +341 -0
  24. package/.claude/skills/agent-frontend-create-page.md +413 -0
  25. package/.claude/skills/agents/README.md +238 -0
  26. package/dist/clone-web.js +1 -1
  27. package/dist/clone-web.js.map +1 -1
  28. package/folders.yaml +1 -1
  29. package/one/.obsidian/workspace.json +38 -38
  30. package/one/connections/api/queries-reference.md +842 -0
  31. package/one/connections/api-reference.md +1011 -0
  32. package/one/connections/integration-examples.md +875 -0
  33. package/one/connections/integration-guide.md +869 -0
  34. package/one/connections/integration-phase2.md +736 -0
  35. package/one/events/API_ROUTES_FIXES_SUMMARY.md +262 -0
  36. package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +636 -0
  37. package/one/events/BEFORE_AFTER_COMPARISON.md +960 -0
  38. package/one/events/CONNECTIONS_DEMO.md +501 -0
  39. package/one/events/DELIVERABLES.md +432 -0
  40. package/one/events/DEMO-GROUPS-PAGE.md +392 -0
  41. package/one/events/DEMO-TESTING-SUMMARY.md +518 -0
  42. package/one/events/DEMO_COMPONENTS.md +487 -0
  43. package/one/events/DEMO_HOOKS_INDEX.md +334 -0
  44. package/one/events/DEMO_INFRASTRUCTURE.md +905 -0
  45. package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +570 -0
  46. package/one/events/DEMO_INTEGRATION_CHECKLIST.md +431 -0
  47. package/one/events/DEMO_QUICK_REFERENCE.md +441 -0
  48. package/one/events/DEMO_SETUP.md +476 -0
  49. package/one/events/EFFECT_TS_API_PATTERN.md +478 -0
  50. package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +414 -0
  51. package/one/events/HOOKS-DEMO.md +441 -0
  52. package/one/events/ONTOLOGY-HOOKS-README.md +700 -0
  53. package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +365 -0
  54. package/one/events/QA-CHECKLIST.md +674 -0
  55. package/one/events/QUICK-START-ONTOLOGY.md +408 -0
  56. package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +639 -0
  57. package/one/events/SEARCH_DEMO_DELIVERY.md +415 -0
  58. package/one/events/SEARCH_DEMO_SUMMARY.md +303 -0
  59. package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +381 -0
  60. package/one/events/TEST-PLAN-INDEX.md +346 -0
  61. package/one/events/TEST-PLAN.md +1417 -0
  62. package/one/events/TESTING-DELIVERY.txt +372 -0
  63. package/one/events/TRANSITIONS-QUICK-START.md +141 -0
  64. package/one/events/TYPESCRIPT_FIXES.md +152 -0
  65. package/one/events/TYPESCRIPT_FIXES_COMPLETE.txt +412 -0
  66. package/one/events/TYPESCRIPT_FIXES_INDEX.md +341 -0
  67. package/one/events/VIEW-TRANSITIONS.md +428 -0
  68. package/one/events/backend-integration-tests.md +606 -0
  69. package/one/events/backend-structure-diagram.txt +393 -0
  70. package/one/events/backend-structure-summary.txt +269 -0
  71. package/one/events/cloudflare-pages-infrastructure-setup.md +264 -0
  72. package/one/events/convex-analysis-index.md +304 -0
  73. package/one/events/convex-structure-analysis.md +700 -0
  74. package/one/events/design-spec-complete.md +208 -0
  75. package/one/events/ontology-test-examples.md +562 -0
  76. package/one/events/phase1-backend-implementation-complete.md +518 -0
  77. package/one/events/test-dashboard.md +345 -0
  78. package/one/events/test-index.md +361 -0
  79. package/one/events/test-report-ontology.md +582 -0
  80. package/one/events/testing-summary.md +344 -0
  81. package/one/groups/features.md +2878 -0
  82. package/one/groups/strategy copy.md +869 -0
  83. package/one/knowledge/backend-api-reference.md +710 -0
  84. package/one/knowledge/documentation-summary.md +285 -0
  85. package/one/knowledge/lessons-learned.md +294 -4
  86. package/one/knowledge/ontology-visual-guide.md +360 -0
  87. package/one/knowledge/ontology.md +9 -17
  88. package/one/things/demo-accessibility-animations.md +999 -0
  89. package/one/things/demo-components.md +1304 -0
  90. package/one/things/demo-design-summary.md +629 -0
  91. package/one/things/demo-design-system.md +919 -0
  92. package/one/things/demo-page-layouts.md +989 -0
  93. package/one/things/designs/accessibility-audit.md +790 -0
  94. package/one/things/designs/component-specifications.md +757 -0
  95. package/one/things/designs/design-overview.md +318 -0
  96. package/one/things/designs/design-tokens.md +414 -0
  97. package/one/things/designs/wireframes-dashboard.md +653 -0
  98. package/one/things/docs/api-requests.md +923 -0
  99. package/one/things/features/0 All Features.md +2 -0
  100. package/one/things/implementation/backend-guide.md +412 -0
  101. package/one/things/plans/2-backend-agnostic-frontend.md +11 -8
  102. package/one/things/plans/2-sites.md +895 -0
  103. package/one/things/plans/ai-elements.md +1259 -0
  104. package/one/things/plans/ai-integration.md +947 -0
  105. package/one/things/plans/ai-sdk.md +761 -0
  106. package/one/things/plans/app.md +1 -1
  107. package/one/things/plans/architecture-summary.md +283 -0
  108. package/one/things/plans/async-ai-agents.md +215 -0
  109. package/one/things/plans/backend-agnostic-frontend.md +11 -6
  110. package/one/things/plans/backend-cleanup-quickstart.md +346 -0
  111. package/one/things/plans/backend-ontology-conformance.md +416 -0
  112. package/one/things/plans/backend-status.md +541 -0
  113. package/one/things/plans/backend-structure.md +799 -0
  114. package/one/things/plans/backend-target-structure.md +438 -0
  115. package/one/things/plans/backend.md +1133 -0
  116. package/one/things/plans/better-auth-any-backend.md +11 -11
  117. package/one/things/plans/cli-updates-required.md +280 -0
  118. package/one/things/plans/complete-step-by-step.md +1302 -0
  119. package/one/things/plans/convex-agents.md +1005 -0
  120. package/one/things/plans/deployment-architecture.md +426 -0
  121. package/one/things/plans/development-plan.md +1220 -0
  122. package/one/things/plans/effect.md +808 -48
  123. package/one/things/plans/integrate-frontend-and-backend.md +579 -0
  124. package/one/things/plans/mcp-clear-context-prompt.md +60 -0
  125. package/one/things/plans/mcp-simple.md +228 -0
  126. package/one/things/plans/one.md +8 -7
  127. package/one/things/plans/ontology-6-dimensions.md +20 -14
  128. package/one/things/plans/quick-wins.md +1273 -0
  129. package/one/things/plans/readme-backend-cleanup.md +361 -0
  130. package/one/things/plans/separate-demo.md +830 -0
  131. package/one/things/plans/separate.md +3 -3
  132. package/one/things/plans/sequence.md +1897 -0
  133. package/one/things/plans/sync-checklist.md +321 -0
  134. package/one/things/plans/unified-implementation-plan.md +3 -3
  135. package/one/things/plans/update-demos.md +513 -0
  136. package/package.json +1 -1
  137. package/.claude/agents/backend-specialist.md +0 -169
  138. package/.claude/agents/designer.md +0 -216
  139. package/.claude/agents/frontend-specialist.md +0 -236
  140. package/.claude/commands/done.md +0 -35
  141. package/.claude/commands/infer.md +0 -138
  142. package/.claude/commands/next.md +0 -53
  143. package/.claude/commands/one copy.md +0 -565
  144. package/.claude/commands/one-template.md +0 -106
  145. package/.claude/commands/one-v1.md +0 -609
  146. package/.claude/hooks/__pycache__/knowledge-post.cpython-313.pyc +0 -0
  147. package/.claude/hooks/__pycache__/knowledge-pre.cpython-313.pyc +0 -0
  148. package/one/groups/nine-padel-customers.md +0 -138
  149. package/one/groups/nine-padel-data-structure.md +0 -167
  150. package/one/groups/nine-padel-ontology-specification.md +0 -359
  151. package/one/groups/nine-padel-ontology.md +0 -143
  152. package/one/groups/nine-padel-strategy.md +0 -234
  153. package/one/groups/nine-padel.md +0 -211
  154. package/one/groups/nine-padle-contents.baked.md +0 -1252
  155. package/one/groups/nine-padle-contents.md +0 -6
  156. package/one/things/features/1-1-agent-prompts/design.md +0 -470
  157. package/one/things/features/1-1-agent-prompts/tests.md +0 -264
  158. package/one/things/features/1-2-yaml-orchestrator/design.md +0 -497
  159. package/one/things/features/1-2-yaml-orchestrator/tests.md +0 -227
  160. package/one/things/features/1-3-event-coordination/design.md +0 -544
  161. package/one/things/features/1-3-event-coordination/tests.md +0 -223
  162. package/one/things/features/1-4-knowledge-management/design.md +0 -609
  163. package/one/things/features/1-4-knowledge-management/tests.md +0 -195
  164. package/one/things/features/1-5-quality-loops/design.md +0 -797
  165. package/one/things/features/1-5-quality-loops/tests.md +0 -212
  166. package/one/things/features/1-6-numbering-structure/design.md +0 -610
  167. package/one/things/features/1-6-numbering-structure/tests.md +0 -213
  168. package/one/things/features/dataprovider-interface/1-tests.md +0 -1522
@@ -0,0 +1,830 @@
1
+ # Separate Development from Customer Releases
2
+
3
+ **Problem:** We develop the full ONE Platform in `/web` but need to release different versions:
4
+ 1. Main platform website (one.ie)
5
+ 2. Demo/starter template (web.one.ie) - same as what users download via `npx oneie`
6
+
7
+ **Current Flow:**
8
+ ```
9
+ /web (development)
10
+ → rsync →
11
+ apps/one/web (assembly)
12
+ → build → deploy →
13
+ Cloudflare Pages (one.ie)
14
+ ```
15
+
16
+ **New Flow:**
17
+ ```
18
+ /web (development - full features)
19
+ ├→ rsync → apps/oneie/web → Deploy → one.ie (main site)
20
+ └→ rsync → apps/one/web → Deploy → demo.one.ie (demo)
21
+ ↓
22
+ Also: git push → one-ie/one
23
+ ↓
24
+ Available via: npx oneie
25
+ ```
26
+
27
+ **Requirement:**
28
+ - one.ie = Full platform/marketing site (oneie project)
29
+ - demo.one.ie = Demo/starter template (one project, matches `npx oneie` download)
30
+ - Users get same code whether they visit demo.one.ie or run `npx oneie`
31
+
32
+ ---
33
+
34
+ ## Recommended Strategy: Multi-Site Deployment
35
+
36
+ ### Architecture Overview
37
+
38
+ ```
39
+ ┌─────────────────────────────────────────────────────────────┐
40
+ │ DEVELOPMENT REPOSITORY: /web │
41
+ │ - Full ONE Platform features │
42
+ │ - All navigation and admin tools │
43
+ │ - Internal development environment variables │
44
+ │ - Test with: bun run dev (localhost:4321) │
45
+ └──────────────────┬──────────────────────────────────────────┘
46
+ │
47
+ ├─────────────────┐
48
+ ↓ ↓
49
+ ┌──────────────────────────────┐ ┌──────────────────────────────┐
50
+ │ MAIN SITE: apps/oneie/web │ │ DEMO SITE: apps/one/web │
51
+ │ - Full platform features │ │ - Starter template │
52
+ │ - Marketing content │ │ - Minimal features │
53
+ │ - Deploy → one.ie │ │ - Deploy → demo.one.ie │
54
+ │ - Repo: one-ie/oneie │ │ - Repo: one-ie/one │
55
+ └──────────────────────────────┘ └────────────┬─────────────────┘
56
+ │
57
+ ↓
58
+ ┌──────────────────────────────┐
59
+ │ CLI DISTRIBUTION │
60
+ │ - npx oneie │
61
+ │ - git clone one-ie/one │
62
+ │ - Same code as demo.one.ie │
63
+ └──────────────────────────────┘
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Implementation Plan
69
+
70
+ ### Phase 1: Environment-Based Feature Flags
71
+
72
+ **Create environment-specific configuration:**
73
+
74
+ ```bash
75
+ # /web/.env.local (DEVELOPMENT - full features)
76
+ # This is what you use during development
77
+ ORG_NAME=one
78
+ ORG_WEBSITE=https://one.ie
79
+ ONE_BACKEND=on
80
+ ENABLE_ADMIN_FEATURES=true
81
+ ENABLE_EXPERIMENTAL_FEATURES=true
82
+ SHOW_FULL_NAVIGATION=true
83
+ SITE_TYPE=development
84
+ ```
85
+
86
+ ```bash
87
+ # /web/.env.main (MAIN SITE - one.ie)
88
+ # This gets copied to apps/one/web during release
89
+ ORG_NAME=one
90
+ ORG_WEBSITE=https://one.ie
91
+ ONE_BACKEND=on
92
+ ENABLE_ADMIN_FEATURES=false
93
+ ENABLE_EXPERIMENTAL_FEATURES=false
94
+ SHOW_FULL_NAVIGATION=true
95
+ SITE_TYPE=main
96
+ ```
97
+
98
+ ```bash
99
+ # /web/.env.demo (DEMO/STARTER - demo.one.ie)
100
+ # This gets copied to apps/one/web during release
101
+ # Also: what users get via npx oneie
102
+ ORG_NAME=one
103
+ ORG_WEBSITE=https://demo.one.ie
104
+ ONE_BACKEND=off
105
+ ENABLE_ADMIN_FEATURES=false
106
+ ENABLE_EXPERIMENTAL_FEATURES=false
107
+ SHOW_FULL_NAVIGATION=false
108
+ SITE_TYPE=demo
109
+ ```
110
+
111
+ **Usage in code:**
112
+
113
+ ```typescript
114
+ // src/config/features.ts
115
+ export const features = {
116
+ adminPanel: import.meta.env.ENABLE_ADMIN_FEATURES === 'true',
117
+ experimental: import.meta.env.ENABLE_EXPERIMENTAL_FEATURES === 'true',
118
+ fullNavigation: import.meta.env.SHOW_FULL_NAVIGATION === 'true',
119
+ orgName: import.meta.env.ORG_NAME || 'one',
120
+ backendEnabled: import.meta.env.ONE_BACKEND === 'on',
121
+ };
122
+
123
+ // src/components/Sidebar.tsx
124
+ import { features } from '@/config/features';
125
+
126
+ export function Sidebar() {
127
+ const navItems = features.fullNavigation
128
+ ? [/* all nav items */]
129
+ : [/* customer nav items only */];
130
+
131
+ return <nav>{/* ... */}</nav>;
132
+ }
133
+ ```
134
+
135
+ ---
136
+
137
+ ### Phase 2: Enhanced Release Script
138
+
139
+ **Update `scripts/release.sh` to support multiple deployment targets:**
140
+
141
+ Add this after line 356 (after web sync):
142
+
143
+ ```bash
144
+ # ============================================================
145
+ # STEP 4B: PREPARE DEPLOYMENT TARGET
146
+ # ============================================================
147
+
148
+ section "Step 4b: Prepare Deployment Target"
149
+
150
+ step "4b"
151
+
152
+ # Determine deployment target from argument
153
+ DEPLOYMENT_TARGET="${2:-production}" # Default: production
154
+
155
+ case "$DEPLOYMENT_TARGET" in
156
+ main)
157
+ info "Target: Main Site (apps/oneie/web → one.ie)"
158
+ TARGET_DIR="apps/oneie/web"
159
+ ENV_FILE="web/.env.main"
160
+ PROJECT_NAME="oneie"
161
+ DOMAIN="one.ie"
162
+ REPO="one-ie/oneie"
163
+ ;;
164
+
165
+ demo)
166
+ info "Target: Demo Site (apps/one/web → demo.one.ie)"
167
+ TARGET_DIR="apps/one/web"
168
+ ENV_FILE="web/.env.demo"
169
+ PROJECT_NAME="one"
170
+ DOMAIN="demo.one.ie"
171
+ REPO="one-ie/one"
172
+ ;;
173
+
174
+ *)
175
+ error "Unknown deployment target: $DEPLOYMENT_TARGET"
176
+ echo "Valid targets: main, demo"
177
+ echo ""
178
+ echo "Examples:"
179
+ echo " ./scripts/release.sh patch main # Deploy to one.ie"
180
+ echo " ./scripts/release.sh patch demo # Deploy to demo.one.ie"
181
+ exit 1
182
+ ;;
183
+ esac
184
+
185
+ # Create target directory if needed
186
+ mkdir -p "$(dirname "$TARGET_DIR")"
187
+
188
+ # Sync web to target (already done for apps/one/web)
189
+ if [ "$TARGET_DIR" != "apps/one/web" ]; then
190
+ info "Syncing web/ → $TARGET_DIR"
191
+ rsync -av --delete \
192
+ --exclude='.git' \
193
+ --exclude='node_modules' \
194
+ --exclude='dist' \
195
+ --exclude='.astro' \
196
+ --exclude='.wrangler' \
197
+ web/ "$TARGET_DIR/"
198
+ success "Synced to $TARGET_DIR"
199
+ fi
200
+
201
+ # Copy appropriate .env file
202
+ if [ -f "$ENV_FILE" ]; then
203
+ info "Copying environment: $ENV_FILE → $TARGET_DIR/.env.local"
204
+ cp "$ENV_FILE" "$TARGET_DIR/.env.local"
205
+ success "Environment configured for $DEPLOYMENT_TARGET"
206
+ else
207
+ warning "Environment file not found: $ENV_FILE"
208
+ warning "Using default .env.local from source"
209
+ fi
210
+
211
+ # Optional: Remove development-only files
212
+ if [ "$DEPLOYMENT_TARGET" != "development" ]; then
213
+ info "Cleaning development artifacts from $TARGET_DIR"
214
+
215
+ # Remove files that shouldn't be in production
216
+ rm -f "$TARGET_DIR/.env.local.example"
217
+ rm -f "$TARGET_DIR/README-DEV.md"
218
+
219
+ success "Cleaned development artifacts"
220
+ fi
221
+
222
+ echo ""
223
+ success "Deployment target prepared: $TARGET_DIR"
224
+
225
+ # Store for later use in deployment step
226
+ DEPLOY_FROM_DIR="$TARGET_DIR"
227
+ ```
228
+
229
+ **Update the deployment step (line 736+) to use `$DEPLOY_FROM_DIR`:**
230
+
231
+ ```bash
232
+ # Replace WEB_DIR="apps/one/web" with:
233
+ WEB_DIR="${DEPLOY_FROM_DIR:-apps/one/web}"
234
+ PROJECT_NAME="${PROJECT_NAME:-web}"
235
+ ```
236
+
237
+ **Usage:**
238
+
239
+ ```bash
240
+ # Deploy to main site (one.ie)
241
+ ./scripts/release.sh patch main
242
+
243
+ # Deploy to demo site (web.one.ie + npx oneie)
244
+ ./scripts/release.sh patch demo
245
+
246
+ # Deploy both
247
+ ./scripts/release.sh patch main && ./scripts/release.sh patch demo
248
+
249
+ # Sync files only, no deployment
250
+ ./scripts/release.sh sync
251
+ ```
252
+
253
+ ---
254
+
255
+ ### Phase 3: Component-Level Feature Gating
256
+
257
+ **Pattern for conditionally rendering features:**
258
+
259
+ ```typescript
260
+ // src/components/features/admin/AdminPanel.tsx
261
+ import { features } from '@/config/features';
262
+
263
+ export function AdminPanel() {
264
+ // Don't even render in production builds
265
+ if (!features.adminPanel) {
266
+ return null;
267
+ }
268
+
269
+ return (
270
+ <div className="admin-panel">
271
+ {/* Admin-only features */}
272
+ </div>
273
+ );
274
+ }
275
+ ```
276
+
277
+ ```astro
278
+ ---
279
+ // src/pages/admin/index.astro
280
+ import { features } from '@/config/features';
281
+ import AdminPanel from '@/components/features/admin/AdminPanel';
282
+
283
+ // Redirect if admin features disabled
284
+ if (!features.adminPanel) {
285
+ return Astro.redirect('/');
286
+ }
287
+ ---
288
+
289
+ <Layout>
290
+ <AdminPanel client:load />
291
+ </Layout>
292
+ ```
293
+
294
+ **Benefits:**
295
+ - Development: See all features
296
+ - Production: Features completely removed from bundle
297
+ - No runtime overhead checking flags
298
+
299
+ ---
300
+
301
+ ### Phase 4: Deployment Targets in Cloudflare
302
+
303
+ **Create separate Cloudflare Pages projects:**
304
+
305
+ ```bash
306
+ # Main site (full platform)
307
+ wrangler pages project create one
308
+ # Custom domain: one.ie
309
+
310
+ # Demo site (starter template)
311
+ wrangler pages project create oneie
312
+ # Custom domain: web.one.ie
313
+
314
+ # Development (internal, optional)
315
+ wrangler pages project create dev
316
+ # Custom domain: dev.one.ie
317
+ ```
318
+
319
+ **Set environment variables per project:**
320
+
321
+ Via Cloudflare Dashboard or wrangler:
322
+
323
+ ```bash
324
+ # Main site project (one.ie)
325
+ wrangler pages secret put ENABLE_ADMIN_FEATURES --project-name=one
326
+ # Enter: false
327
+ wrangler pages secret put SITE_TYPE --project-name=one
328
+ # Enter: main
329
+
330
+ # Demo site project (web.one.ie)
331
+ wrangler pages secret put ONE_BACKEND --project-name=oneie
332
+ # Enter: off
333
+ wrangler pages secret put SITE_TYPE --project-name=oneie
334
+ # Enter: demo
335
+
336
+ # Dev project (optional)
337
+ wrangler pages secret put ENABLE_ADMIN_FEATURES --project-name=dev
338
+ # Enter: true
339
+ wrangler pages secret put SITE_TYPE --project-name=dev
340
+ # Enter: development
341
+ ```
342
+
343
+ ---
344
+
345
+ ### Phase 5: Create New Repo and CLI Distribution
346
+
347
+ **Step 1: Create one-ie/oneie repository**
348
+
349
+ ```bash
350
+ # On GitHub, create new repository: one-ie/oneie
351
+ # Description: ONE Platform Starter Template - Download via npx oneie
352
+
353
+ # Clone locally
354
+ cd ~/workspace
355
+ git clone https://github.com/one-ie/oneie.git
356
+ cd oneie
357
+
358
+ # Initialize with same structure as apps/oneie after sync
359
+ git init
360
+ git remote add origin https://github.com/one-ie/oneie.git
361
+ ```
362
+
363
+ **Step 2: Update release script to push to one-ie/oneie**
364
+
365
+ After syncing to `apps/oneie/`, also push to the separate repo:
366
+
367
+ ```bash
368
+ # In scripts/release.sh, add after apps/oneie sync:
369
+
370
+ if [ "$DEPLOYMENT_TARGET" == "demo" ]; then
371
+ section "Push to one-ie/oneie repository"
372
+
373
+ # Ensure oneie repo exists locally
374
+ if [ ! -d "oneie/.git" ]; then
375
+ info "Cloning one-ie/oneie repository..."
376
+ git clone https://github.com/one-ie/oneie.git oneie
377
+ fi
378
+
379
+ # Note: For demo target, also sync to separate one-ie/one repo
380
+ section "Push to one-ie/one repository"
381
+
382
+ # Ensure one repo exists locally
383
+ if [ ! -d "one/.git" ]; then
384
+ info "Cloning one-ie/one repository..."
385
+ git clone https://github.com/one-ie/one.git one
386
+ fi
387
+
388
+ # Note: apps/one already gets pushed to one-ie/one automatically
389
+ # by the standard release script (step 11)
390
+ # This happens in the main release flow, no extra sync needed
391
+
392
+ # What happens:
393
+ # 1. Sync /web → apps/one/web
394
+ # 2. Sync /one → apps/one/one
395
+ # 3. Sync /.claude → apps/one/.claude
396
+ # 4. Commit and push apps/one/ to one-ie/one
397
+ # 5. Deploy apps/one/web to Cloudflare "one" project → demo.one.ie
398
+
399
+ success "Demo site synced and ready for deployment"
400
+ fi
401
+ ```
402
+
403
+ **Step 3: Update CLI to download from one-ie/oneie**
404
+
405
+ Update `cli/index.js` (or wherever npx oneie is implemented):
406
+
407
+ ```javascript
408
+ // Instead of downloading from one-ie/one, download from one-ie/oneie
409
+ const REPO_URL = 'https://github.com/one-ie/oneie.git';
410
+
411
+ // Or use npm package distribution:
412
+ // npx oneie downloads pre-built tarball
413
+ ```
414
+
415
+ **Directory Structure After Sync:**
416
+
417
+ ```
418
+ ONE/ # Local workspace
419
+ ├── web/ # Development website (all features)
420
+ ├── one/ # Documentation
421
+ ├── .claude/ # Claude configuration
422
+ │
423
+ └── apps/
424
+ ├── oneie/ # Main site assembly (complete structure)
425
+ │ ├── web/ # → Deployed to one.ie
426
+ │ ├── one/ # Documentation
427
+ │ └── .claude/ # Claude config
428
+ │ → Pushed to one-ie/oneie
429
+ │
430
+ └── one/ # Demo site assembly (complete structure)
431
+ ├── web/ # → Deployed to demo.one.ie
432
+ ├── one/ # Documentation
433
+ └── .claude/ # Claude config
434
+ → Pushed to one-ie/one
435
+
436
+ GitHub Repositories (full structure):
437
+
438
+ one-ie/oneie/ # Main site
439
+ ├── web/ # Website for one.ie
440
+ ├── one/ # Documentation
441
+ └── .claude/ # Claude config
442
+
443
+ one-ie/one/ # Demo/starter (what npx oneie clones)
444
+ ├── web/ # Website for demo.one.ie
445
+ ├── one/ # Documentation
446
+ └── .claude/ # Claude config
447
+ ```
448
+
449
+ **Result:**
450
+
451
+ - `apps/oneie/` → Pushed to one-ie/oneie → web/ deployed to one.ie
452
+ - `apps/one/` → Pushed to one-ie/one → web/ deployed to demo.one.ie
453
+ - `npx oneie` → Clones entire one-ie/one repo (web/, one/, .claude/)
454
+ - Users get complete structure: website + docs + Claude config
455
+
456
+ ---
457
+
458
+ ## Alternative Strategies (Considered)
459
+
460
+ ### Option A: Separate Branches
461
+
462
+ **Pros:**
463
+ - Clear separation
464
+ - Git-based history
465
+
466
+ **Cons:**
467
+ - Merge conflicts
468
+ - Duplicate code
469
+ - Hard to keep in sync
470
+
471
+ **Verdict:** ❌ Not recommended - creates maintenance burden
472
+
473
+ ### Option B: Monorepo with Workspaces
474
+
475
+ **Pros:**
476
+ - Shared code via packages
477
+ - Independent deployments
478
+
479
+ **Cons:**
480
+ - Complex setup
481
+ - Overhead for small differences
482
+
483
+ **Verdict:** ⚠️ Overkill for feature flags
484
+
485
+ ### Option C: Build-Time Code Stripping
486
+
487
+ **Pros:**
488
+ - No runtime overhead
489
+ - Clean production builds
490
+
491
+ **Cons:**
492
+ - Complex build process
493
+ - Hard to debug
494
+
495
+ **Verdict:** ⚠️ Good for optimization, not primary strategy
496
+
497
+ ---
498
+
499
+ ## Migration Path
500
+
501
+ ### Week 1: Setup Feature Flags
502
+
503
+ ```bash
504
+ # 1. Create environment files
505
+ cp web/.env.local web/.env.local.backup
506
+ cat > web/.env.production <<EOF
507
+ # Production environment (customer-facing)
508
+ ORG_NAME=one
509
+ ORG_WEBSITE=https://one.ie
510
+ ONE_BACKEND=on
511
+ ENABLE_ADMIN_FEATURES=false
512
+ ENABLE_EXPERIMENTAL_FEATURES=false
513
+ SHOW_FULL_NAVIGATION=false
514
+ EOF
515
+
516
+ # 2. Create feature config
517
+ cat > web/src/config/features.ts <<EOF
518
+ export const features = {
519
+ adminPanel: import.meta.env.ENABLE_ADMIN_FEATURES === 'true',
520
+ experimental: import.meta.env.ENABLE_EXPERIMENTAL_FEATURES === 'true',
521
+ fullNavigation: import.meta.env.SHOW_FULL_NAVIGATION === 'true',
522
+ orgName: import.meta.env.ORG_NAME || 'one',
523
+ backendEnabled: import.meta.env.ONE_BACKEND === 'on',
524
+ };
525
+ EOF
526
+
527
+ # 3. Test locally with production env
528
+ cd web
529
+ cp .env.production .env.local
530
+ bun run build
531
+ # Verify: admin features should be disabled
532
+ ```
533
+
534
+ ### Week 2: Update Components
535
+
536
+ ```bash
537
+ # Update navigation
538
+ # Update admin pages
539
+ # Add feature checks to experimental features
540
+ # Test thoroughly
541
+ ```
542
+
543
+ ### Week 3: Update Release Script
544
+
545
+ ```bash
546
+ # Add multi-target support to scripts/release.sh
547
+ # Test with: ./scripts/release.sh sync production
548
+ # Verify: apps/one/web has production .env
549
+ ```
550
+
551
+ ### Week 4: Deploy and Verify
552
+
553
+ ```bash
554
+ # Deploy production
555
+ ./scripts/release.sh patch production
556
+
557
+ # Deploy demo (optional)
558
+ ./scripts/release.sh patch demo
559
+
560
+ # Verify both deployments
561
+ # Check feature flags working correctly
562
+ ```
563
+
564
+ ---
565
+
566
+ ## Development Workflow
567
+
568
+ ### Day-to-Day Development
569
+
570
+ ```bash
571
+ # 1. Develop with full features
572
+ cd web
573
+ bun run dev
574
+ # localhost:4321 - full ONE Platform
575
+
576
+ # 2. Test production build locally
577
+ cp .env.production .env.local
578
+ bun run build
579
+ bun run preview
580
+ # Verify customer experience
581
+
582
+ # 3. Restore development environment
583
+ cp .env.local.backup .env.local
584
+
585
+ # 4. Commit changes
586
+ git add .
587
+ git commit -m "feat: add new feature"
588
+ git push
589
+
590
+ # 5. Release to production
591
+ cd ..
592
+ ./scripts/release.sh patch production
593
+ ```
594
+
595
+ ### Testing Customer Experience
596
+
597
+ ```bash
598
+ # Quick test of production build
599
+ cd web
600
+ cp .env.production .env.local
601
+ bun run build && bun run preview
602
+
603
+ # Full test with deployment
604
+ cd ..
605
+ ./scripts/release.sh sync production
606
+ cd apps/one/web
607
+ bun run build && bun run preview
608
+ ```
609
+
610
+ ---
611
+
612
+ ## Benefits of This Approach
613
+
614
+ ✅ **Single Codebase:** No duplicate code to maintain
615
+
616
+ ✅ **Environment-Based:** Simple `.env` files control features
617
+
618
+ ✅ **Clean Builds:** Production builds only include enabled features
619
+
620
+ ✅ **Multiple Targets:** Can deploy to production, demo, dev simultaneously
621
+
622
+ ✅ **Existing Infrastructure:** Uses current rsync + Cloudflare setup
623
+
624
+ ✅ **Type Safety:** TypeScript checks feature flags at compile time
625
+
626
+ ✅ **Easy Testing:** Can test customer experience locally
627
+
628
+ ✅ **Flexible:** Add new deployment targets easily (enterprise, whitelabel, etc.)
629
+
630
+ ✅ **No Vendor Lock-in:** Not tied to specific build tools or frameworks
631
+
632
+ ---
633
+
634
+ ## Security Considerations
635
+
636
+ **Never expose sensitive features in production:**
637
+
638
+ ```typescript
639
+ // ✅ CORRECT: Feature completely removed
640
+ if (!features.adminPanel) {
641
+ return null;
642
+ }
643
+
644
+ // ❌ WRONG: Just hidden, still in bundle
645
+ <div className={features.adminPanel ? 'block' : 'hidden'}>
646
+ {/* Admin features still shipped */}
647
+ </div>
648
+ ```
649
+
650
+ **Environment variable security:**
651
+
652
+ - Keep `.env.local` in `.gitignore`
653
+ - Use `.env.production` for defaults (safe to commit)
654
+ - Set secrets via Cloudflare dashboard
655
+ - Never commit actual API keys
656
+
657
+ **API endpoint security:**
658
+
659
+ ```typescript
660
+ // Backend must also check permissions
661
+ // Don't rely on frontend feature flags alone
662
+ export const deleteUser = mutation({
663
+ handler: async (ctx, args) => {
664
+ // Check user role in database
665
+ const user = await getCurrentUser(ctx);
666
+ if (user.role !== 'platform_owner') {
667
+ throw new Error('Unauthorized');
668
+ }
669
+ // ... delete logic
670
+ },
671
+ });
672
+ ```
673
+
674
+ ---
675
+
676
+ ## Future Enhancements
677
+
678
+ ### White-Label Support
679
+
680
+ ```bash
681
+ # /web/.env.customer-acme
682
+ ORG_NAME=acme
683
+ ORG_WEBSITE=https://acme.com
684
+ ORG_FOLDER=acme
685
+ ONE_BACKEND=on
686
+ ENABLE_ADMIN_FEATURES=false
687
+ CUSTOM_BRANDING=true
688
+ ```
689
+
690
+ Deploy with:
691
+ ```bash
692
+ ./scripts/release.sh patch customer-acme
693
+ ```
694
+
695
+ ### Multi-Tenant Deployments
696
+
697
+ Each customer gets:
698
+ - Separate Cloudflare Pages project
699
+ - Own environment variables
700
+ - Custom domain
701
+ - Branded experience
702
+ - Independent deployment
703
+
704
+ ### Progressive Rollout
705
+
706
+ ```bash
707
+ # Deploy to staging first
708
+ ./scripts/release.sh patch staging
709
+
710
+ # Test thoroughly
711
+ # Then deploy to production
712
+ ./scripts/release.sh patch production
713
+ ```
714
+
715
+ ---
716
+
717
+ ## Troubleshooting
718
+
719
+ ### Issue: Production build includes development features
720
+
721
+ **Cause:** Wrong `.env` file used during build
722
+
723
+ **Solution:**
724
+ ```bash
725
+ # Verify environment during release
726
+ cd apps/one/web
727
+ cat .env.local | grep ENABLE_ADMIN
728
+ # Should show: false
729
+ ```
730
+
731
+ ### Issue: Features disabled in development
732
+
733
+ **Cause:** `.env.production` copied over `.env.local`
734
+
735
+ **Solution:**
736
+ ```bash
737
+ cd web
738
+ rm .env.local
739
+ cp .env.local.backup .env.local
740
+ # Or just set ENABLE_ADMIN_FEATURES=true
741
+ ```
742
+
743
+ ### Issue: Environment variables not updating in deployed site
744
+
745
+ **Cause:** Cloudflare Pages caches environment variables
746
+
747
+ **Solution:**
748
+ ```bash
749
+ # Force rebuild
750
+ wrangler pages deployment create --project-name=web web/dist
751
+
752
+ # Or update via dashboard:
753
+ # Cloudflare → Pages → web → Settings → Environment variables
754
+ ```
755
+
756
+ ---
757
+
758
+ ## Summary
759
+
760
+ **What You Get:**
761
+
762
+ 1. **Development:** Full ONE Platform with all features (`/web`)
763
+ 2. **Main Site:** Full platform + marketing (`apps/oneie/web → one.ie`)
764
+ 3. **Demo Site:** Starter template (`apps/one/web → demo.one.ie`)
765
+ 4. **Downloadable:** Same as demo via `npx oneie` (from `one-ie/one` repo)
766
+
767
+ **How It Works:**
768
+
769
+ - Single codebase (`/web`) with feature flags
770
+ - Different `.env` files per deployment target
771
+ - Release script syncs to multiple targets
772
+ - Deploy to separate Cloudflare projects (oneie → one.ie, one → demo.one.ie)
773
+ - Demo code also pushed to separate GitHub repo (one-ie/one) for CLI distribution
774
+
775
+ **Commands:**
776
+
777
+ ```bash
778
+ # Develop locally (full features)
779
+ cd web && bun run dev
780
+
781
+ # Release to main site (one.ie)
782
+ ./scripts/release.sh patch main
783
+
784
+ # Release to demo site (demo.one.ie + npx oneie)
785
+ ./scripts/release.sh patch demo
786
+
787
+ # Release both
788
+ ./scripts/release.sh patch main && ./scripts/release.sh patch demo
789
+
790
+ # Sync files only (no deployment)
791
+ ./scripts/release.sh sync
792
+ ```
793
+
794
+ **Repositories:**
795
+
796
+ - `one-ie/oneie` → Main site assembly (apps/oneie/ → one.ie)
797
+ - `one-ie/one` → Demo/starter template (apps/one/ + one/ → demo.one.ie + npx oneie)
798
+ - `one-ie/cli` → CLI package (npx oneie downloads from one-ie/one)
799
+
800
+ **Next Steps:**
801
+
802
+ 1. ✅ Read this document
803
+ 2. ⬜ Create environment files:
804
+ - `web/.env.main` (main site: one.ie)
805
+ - `web/.env.demo` (demo site: demo.one.ie)
806
+ 3. ⬜ Create `web/src/config/features.ts` with feature flags
807
+ 4. ⬜ Test both builds locally:
808
+ - `cp .env.main .env.local && bun run build`
809
+ - `cp .env.demo .env.local && bun run build`
810
+ 5. ⬜ Create GitHub repository: `one-ie/oneie`
811
+ 6. ⬜ Create Cloudflare Pages projects:
812
+ - `oneie` (for one.ie)
813
+ - `one` (for demo.one.ie)
814
+ 7. ⬜ Update `scripts/release.sh` with multi-target support
815
+ 8. ⬜ Deploy main site: `./scripts/release.sh patch main`
816
+ 9. ⬜ Deploy demo site: `./scripts/release.sh patch demo`
817
+ 10. ⬜ Test both deployments:
818
+ - https://one.ie (full platform)
819
+ - https://demo.one.ie (starter template)
820
+ 11. ⬜ Update CLI to download from `one-ie/one`
821
+ 12. ⬜ Test: `npx oneie` downloads correct starter template
822
+
823
+ ---
824
+
825
+ **Result:**
826
+
827
+ - **one.ie** → Full platform/marketing site (oneie project)
828
+ - **demo.one.ie** → Live demo (same as npx oneie download)
829
+ - **npx oneie** → Downloads starter template from one-ie/one
830
+ - Single codebase, clean separation, no duplication