alpiecode 10.9.1__tar.gz → 10.9.3__tar.gz

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 (133) hide show
  1. {alpiecode-10.9.1 → alpiecode-10.9.3}/PKG-INFO +1 -1
  2. {alpiecode-10.9.1 → alpiecode-10.9.3}/pyproject.toml +1 -1
  3. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/alpiecode.egg-info/PKG-INFO +1 -1
  4. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/__init__.py +1 -1
  5. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/agent.py +5 -0
  6. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/blueprints.py +72 -7
  7. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/config.py +5 -5
  8. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/local_model.py +3 -2
  9. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/orchestrator.py +62 -34
  10. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/prompt.py +14 -6
  11. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/verifier.py +226 -4
  12. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_lifecycle_and_portfolio.py +14 -0
  13. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_verifier.py +126 -0
  14. {alpiecode-10.9.1 → alpiecode-10.9.3}/README.md +0 -0
  15. {alpiecode-10.9.1 → alpiecode-10.9.3}/setup.cfg +0 -0
  16. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/alpiecode/__init__.py +0 -0
  17. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/alpiecode.egg-info/SOURCES.txt +0 -0
  18. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/alpiecode.egg-info/dependency_links.txt +0 -0
  19. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/alpiecode.egg-info/entry_points.txt +0 -0
  20. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/alpiecode.egg-info/requires.txt +0 -0
  21. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/alpiecode.egg-info/top_level.txt +0 -0
  22. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/assessment.py +0 -0
  23. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/backends/__init__.py +0 -0
  24. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/backends/base.py +0 -0
  25. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/backends/local_backend.py +0 -0
  26. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/backends/openai_backend.py +0 -0
  27. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/cache.py +0 -0
  28. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/cli.py +0 -0
  29. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/client.py +0 -0
  30. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/compaction.py +0 -0
  31. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/context.py +0 -0
  32. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/diff_preview.py +0 -0
  33. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/discovery.py +0 -0
  34. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/doctor.py +0 -0
  35. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/dream_rsi.py +0 -0
  36. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/executor.py +0 -0
  37. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/git_ops.py +0 -0
  38. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/github.py +0 -0
  39. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/guardian.py +0 -0
  40. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/guardrails.py +0 -0
  41. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/ipython_ext.py +0 -0
  42. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/media.py +0 -0
  43. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/memory.py +0 -0
  44. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/metrics.py +0 -0
  45. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/paths.py +0 -0
  46. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/progress.py +0 -0
  47. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/project_template.py +0 -0
  48. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/rephraser.py +0 -0
  49. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/server.py +0 -0
  50. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/session.py +0 -0
  51. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/accessibility-audit/SKILL.md +0 -0
  52. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/accessibility-testing/SKILL.md +0 -0
  53. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/accessibility-ui-components/SKILL.md +0 -0
  54. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/agentic-workflows/SKILL.md +0 -0
  55. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/api-design/SKILL.md +0 -0
  56. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/architecture-design/SKILL.md +0 -0
  57. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/backend-engineering/SKILL.md +0 -0
  58. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/browser-automation/SKILL.md +0 -0
  59. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/cli-development/SKILL.md +0 -0
  60. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/cloud-infrastructure/SKILL.md +0 -0
  61. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/code-generation/SKILL.md +0 -0
  62. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/code-review/SKILL.md +0 -0
  63. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/codebase-onboarding/SKILL.md +0 -0
  64. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/cost-optimization/SKILL.md +0 -0
  65. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/data-analysis/SKILL.md +0 -0
  66. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/data-engineering/SKILL.md +0 -0
  67. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/database-engineering/SKILL.md +0 -0
  68. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/dependency-management/SKILL.md +0 -0
  69. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/dependency-security/SKILL.md +0 -0
  70. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/dependency-upgrades/SKILL.md +0 -0
  71. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/devops-ci-cd/SKILL.md +0 -0
  72. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/docker-containers/SKILL.md +0 -0
  73. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/documentation/SKILL.md +0 -0
  74. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/documentation-site/SKILL.md +0 -0
  75. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/e2e-testing/SKILL.md +0 -0
  76. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/error-handling-resilience/SKILL.md +0 -0
  77. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/feature-development/SKILL.md +0 -0
  78. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/frontend-engineering/SKILL.md +0 -0
  79. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/git-workflow/SKILL.md +0 -0
  80. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/incident-response/SKILL.md +0 -0
  81. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/legacy-code-modernization/SKILL.md +0 -0
  82. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/llm-application-engineering/SKILL.md +0 -0
  83. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/localization-i18n/SKILL.md +0 -0
  84. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/mcp-server-development/SKILL.md +0 -0
  85. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/migration-engineering/SKILL.md +0 -0
  86. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/mobile-development/SKILL.md +0 -0
  87. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/model-evaluation/SKILL.md +0 -0
  88. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/nodejs-services/SKILL.md +0 -0
  89. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/observability/SKILL.md +0 -0
  90. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/performance-optimization/SKILL.md +0 -0
  91. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/privacy-data-protection/SKILL.md +0 -0
  92. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/prompt-engineering/SKILL.md +0 -0
  93. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/python-engineering/SKILL.md +0 -0
  94. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/rag-retrieval/SKILL.md +0 -0
  95. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/react-engineering/SKILL.md +0 -0
  96. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/release-management/SKILL.md +0 -0
  97. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/requirements-analysis/SKILL.md +0 -0
  98. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/responsive-design/SKILL.md +0 -0
  99. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/safe-refactoring/SKILL.md +0 -0
  100. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/secure-coding/SKILL.md +0 -0
  101. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/systematic-debugging/SKILL.md +0 -0
  102. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/technical-planning/SKILL.md +0 -0
  103. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/technical-research/SKILL.md +0 -0
  104. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/technical-writing/SKILL.md +0 -0
  105. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/test-engineering/SKILL.md +0 -0
  106. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/tool-integration/SKILL.md +0 -0
  107. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/typescript-engineering/SKILL.md +0 -0
  108. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/visual-regression-testing/SKILL.md +0 -0
  109. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/web-performance/SKILL.md +0 -0
  110. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/web-security-testing/SKILL.md +0 -0
  111. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills/workflow-automation/SKILL.md +0 -0
  112. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/skills.py +0 -0
  113. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/slash.py +0 -0
  114. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/subagent.py +0 -0
  115. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/system1.py +0 -0
  116. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/tools.py +0 -0
  117. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/updater.py +0 -0
  118. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/vscode_installer.py +0 -0
  119. {alpiecode-10.9.1 → alpiecode-10.9.3}/src/codeagent/walkthrough.py +0 -0
  120. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_adaptive_resilience.py +0 -0
  121. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_cli_ui.py +0 -0
  122. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_context_and_trajectory.py +0 -0
  123. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_deloop_and_sessions.py +0 -0
  124. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_dream_rsi.py +0 -0
  125. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_local_model_download.py +0 -0
  126. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_non_thinking_and_local_stream.py +0 -0
  127. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_project_templates.py +0 -0
  128. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_skills_engine.py +0 -0
  129. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_slash_and_diff.py +0 -0
  130. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_subagents.py +0 -0
  131. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_task_assessment.py +0 -0
  132. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_walkthrough.py +0 -0
  133. {alpiecode-10.9.1 → alpiecode-10.9.3}/test/test_web_resilience_and_guardrails.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alpiecode
3
- Version: 10.9.1
3
+ Version: 10.9.3
4
4
  Summary: AlpieCode
5
5
  Requires-Python: >=3.9
6
6
  Requires-Dist: huggingface_hub>=0.20.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "alpiecode"
7
- version = "10.9.1"
7
+ version = "10.9.3"
8
8
  description = "AlpieCode"
9
9
  requires-python = ">=3.9"
10
10
  dependencies = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alpiecode
3
- Version: 10.9.1
3
+ Version: 10.9.3
4
4
  Summary: AlpieCode
5
5
  Requires-Python: >=3.9
6
6
  Requires-Dist: huggingface_hub>=0.20.0
@@ -17,7 +17,7 @@ Supports:
17
17
  from pathlib import Path
18
18
  from typing import Optional, Any, Dict
19
19
 
20
- __version__ = "10.9.1"
20
+ __version__ = "10.9.3"
21
21
 
22
22
  def run(task: str, workdir: str = ".", reasoning_level: str = "thinking", **kwargs):
23
23
  """Run an autonomous coding task programmatically."""
@@ -363,6 +363,11 @@ def run_agent(
363
363
  from .session import setup_sigint_handler
364
364
  setup_sigint_handler(session, session_mgr)
365
365
 
366
+ # ── Interactive Web Framework Selection (Must run BEFORE status_spinner starts) ──
367
+ from .blueprints import is_ambiguous_web_task, prompt_website_framework_choice
368
+ if is_ambiguous_web_task(task):
369
+ task = prompt_website_framework_choice(task)
370
+
366
371
  event_stream = orchestrator.run_task(
367
372
  session=session,
368
373
  task=task,
@@ -21,6 +21,7 @@ class BlueprintType(str, Enum):
21
21
  WEB_ANGULAR = "web_angular"
22
22
  WEB_GOLANG = "web_golang"
23
23
  PORTFOLIO = "portfolio"
24
+ EVENT_CELEBRATION = "event_celebration"
24
25
  CLI_SCRIPT = "cli_script"
25
26
  REST_API = "rest_api"
26
27
  NATIVE_CPP = "native_cpp"
@@ -76,10 +77,14 @@ def get_web_app_blueprint(task: str) -> DomainBlueprint:
76
77
  "Architecture: 100% Pure Vanilla Web Stack (HTML5 + CSS3 + Vanilla JavaScript IIFE). Fast, zero dependencies, zero build step, instant load.",
77
78
  "Design Aesthetic: Light-Mode-First Default (clean white/slate surfaces `#ffffff`/`#f8fafc`, rich dark slate text `#0f172a`, subtle 1px border dividers `#e2e8f0`, soft elevated card shadows). Modern, crisp, and professional (Apple/Stripe/Vercel standard).",
78
79
  "Dual-Theme Switch: Every website MUST include a Theme Toggle switch button in the header/navbar (`#theme-toggle`) with Sun ☀️ and Moon 🌙 SVG icons.",
79
- "Turn 1 (`index.html`): Write FIRST with rich semantic markup: Sticky Header/Navbar with brand, navigation links, and `#theme-toggle` button; Pre-rendered hero banner, responsive cards/containers, interactive forms, and modal structure. <html lang='en'> MUST NOT have data-theme='dark' or class='dark'. Initial page load MUST display Light Mode first! NEVER leave an empty body or empty `<div id='app'>`.",
80
+ "Turn 1 (`index.html`): Write FIRST with rich semantic markup: Sticky Header/Navbar with brand, navigation links, and `#theme-toggle` button; Pre-rendered hero banner, responsive cards/containers, interactive forms, and modal structure. Explicitly give IDs to all interactive elements to match the app.js contract: `#theme-toggle`, `#close-btn` (or `#modal-close`), `#modal-overlay`, `#rsvp-form`, `#invitation-card`. <html lang='en'> MUST NOT have data-theme='dark' or class='dark'. Initial page load MUST display Light Mode first! NEVER leave an empty body or empty `<div id='app'>`.",
80
81
  "Include an on-screen Error Boundary in `index.html` via `window.addEventListener('error', ...)` to display any JavaScript exceptions visually instead of a blank white screen.",
81
82
  "Turn 2 (`styles.css`): Modern, responsive CSS defining custom properties in `:root` (--bg: #f8fafc, --surface: #ffffff, --text: #0f172a, --text-muted: #64748b, --border: #e2e8f0, --primary: #2563eb, --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05)) and dark overrides strictly under `[data-theme='dark']` with smooth 200ms transitions. Body MUST use background-color: var(--bg); color: var(--text);. NEVER write an unconditional @media (prefers-color-scheme: dark) block that turns the site dark without the toggle.",
82
- "Turn 3 (`app.js`): Universal vanilla JavaScript IIFE `(function() { 'use strict'; ... })();`. Implement: 1) Theme toggle logic: initialize with `const saved = localStorage.getItem('theme') || 'light'; document.documentElement.setAttribute('data-theme', saved);` and add click listener on `#theme-toggle` to flip between 'light' and 'dark' and save to localStorage (DO NOT auto-switch to dark on load); 2) Interactive features (filtering, cart, modals, event handlers); 3) Form submission validation with visual toast/alert feedback. Keep `app.js` concise and modular (< 350 lines).",
83
+ "Turn 3 (`app.js`): Universal vanilla JavaScript IIFE `(function() { 'use strict'; ... })();`. "
84
+ "CRITICAL DEFENSIVE DOM ACCESS: In app.js, ALWAYS check element existence before adding event listeners or setting properties: "
85
+ "`const btn = document.getElementById('close-btn'); if (btn) { btn.addEventListener('click', ...); }` OR optional chaining `document.getElementById('close-btn')?.addEventListener('click', ...);`. "
86
+ "NEVER call .addEventListener directly without checking for null. "
87
+ "Implement: 1) Theme toggle logic: initialize with `const saved = localStorage.getItem('theme') || 'light'; document.documentElement.setAttribute('data-theme', saved);` and add click listener on `#theme-toggle` to flip between 'light' and 'dark' and save to localStorage (DO NOT auto-switch to dark on load); 2) Interactive features (invitation card animations, filtering, modals with `#close-btn`, event handlers); 3) Form submission validation with visual toast/alert feedback. Keep `app.js` concise and modular (< 350 lines).",
83
88
  "Visual Assets: Use `download_asset` or curated Unsplash CDN URLs / 100% clean inline SVGs for all imagery and icons to ensure ZERO 404 broken images.",
84
89
  "Write EXACTLY ONE complete file per turn in order (Turn 1: index.html, Turn 2: styles.css, Turn 3: app.js).",
85
90
  "Verify all files exist and validate JavaScript with `node --check app.js` before completing.",
@@ -426,6 +431,57 @@ def get_developer_portfolio_blueprint(task: str) -> DomainBlueprint:
426
431
  )
427
432
 
428
433
 
434
+ def get_event_celebration_blueprint(task: str) -> DomainBlueprint:
435
+ # Detect festival or event theme
436
+ theme_name = "Festive Celebration"
437
+ task_l = task.lower()
438
+ if "diwali" in task_l:
439
+ theme_name = "Diwali Celebration & Festival of Lights"
440
+ elif "christmas" in task_l:
441
+ theme_name = "Christmas & Holiday Celebration"
442
+ elif "new year" in task_l:
443
+ theme_name = "New Year Festive Celebration"
444
+ elif "wedding" in task_l:
445
+ theme_name = "Wedding Celebration & Invitation"
446
+
447
+ return DomainBlueprint(
448
+ name=f"Interactive Event Website ({theme_name})",
449
+ blueprint_type=BlueprintType.EVENT_CELEBRATION,
450
+ target_files=["index.html", "styles.css", "app.js"],
451
+ entry_point="index.html",
452
+ execution_runner="python3 -m http.server 8000 (view at http://localhost:8000)",
453
+ architecture_rules=[
454
+ "Design Aesthetic: Light-Mode-First Default (warm ivory/amber `#fffbeb` and clean white `#ffffff` surfaces, rich dark slate typography `#1e293b`, royal gold `#d97706` and warm amber `#b45309` festive accents, soft elevated card shadows). Clean, modern, luxury event standard.",
455
+ "Dual-Theme Switch: Sticky header/navbar MUST include accessible Theme Toggle button (`#theme-toggle`) with Sun ☀️ and Moon 🌙 SVG icons toggling dark mode (`#0f172a` midnight surfaces with glowing gold diya/lantern accents).",
456
+ "Turn 1 (`index.html`): Write FIRST with complete pre-rendered semantic HTML5: "
457
+ "1) In <head>, include `<script>document.documentElement.setAttribute('data-theme', localStorage.getItem('theme') || 'light');</script>` to guarantee instant default light mode load without dark flicker; "
458
+ "2) Sticky Navbar with event brand, dates, and `#theme-toggle`; "
459
+ "3) Hero banner with greeting, festive countdown timer, and 'View Invitation' button `#view-invite-btn`; "
460
+ "4) Interactive 3D Invitation Card container (`<div class='card-container'>`) with (`<div class='card-3d' id='invitation-card'>`), explicit Flip Button (`<button id='flip-card-btn'>Flip Card</button>`), `.card-front` (ornate festive border, diya/lantern SVG, headline) and `.card-back` (schedule, venue, and 'RSVP Now' button `#open-rsvp-btn`); "
461
+ "5) Atmospheric celebration canvas (`<canvas id='fx-canvas'></canvas>`) for subtle sparkles/fireworks; "
462
+ "6) Event highlights & schedule cards; "
463
+ "7) Interactive RSVP Modal (`<div id='modal-overlay' class='modal-overlay'>`) with card `#rsvp-modal`, close button `<button id='close-btn' class='close-btn'>&times;</button>`, and form `<form id='rsvp-form'>`; "
464
+ "8) Floating toast container (`<div id='toast-container'></div>`) for RSVP confirmation. All interactive elements MUST have explicit matching IDs.",
465
+ "Turn 2 (`styles.css`): Modern CSS using custom properties in `:root` (--bg: #fffdf7, --surface: #ffffff, --accent: #d97706, --text: #1e293b, --border: #fde68a, --shadow: 0 10px 25px -5px rgba(217, 119, 6, 0.15)) and dark mode under `[data-theme='dark']`. 3D card flip styles: `.card-container { perspective: 1000px; display: flex; justify-content: center; } .card-3d { width: 100%; max-width: 480px; min-height: 280px; position: relative; transform-style: preserve-3d; transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1); cursor: pointer; } .card-3d.flipped { transform: rotateY(180deg); } .card-front, .card-back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 1rem; } .card-back { transform: rotateY(180deg); }`. Modal overlay with backdrop-blur. Responsive Flexbox/Grid.",
466
+ "Turn 3 (`app.js`): Vanilla JS IIFE: "
467
+ "1) Defensive DOM Helper: Define `const safeOn = (id, evt, fn) => { const el = document.getElementById(id); if (el) el.addEventListener(evt, fn); };`; "
468
+ "2) Theme toggle logic: wire `#theme-toggle` click listener toggling between 'light' and 'dark', updating `document.documentElement.setAttribute('data-theme', theme)`, and saving to `localStorage`; "
469
+ "3) Interactive 3D card flip: click on `#invitation-card` or `#flip-card-btn` toggles `.flipped` class on `#invitation-card`; "
470
+ "4) Modal open/close: `#open-rsvp-btn` opens `#modal-overlay`, `#close-btn` and clicking `#modal-overlay` outside card closes it; "
471
+ "5) RSVP form submission: `#rsvp-form` validates inputs and displays animated toast in `#toast-container`; "
472
+ "6) Canvas FX: 60 FPS lightweight sparkle/firework particle loop on `#fx-canvas` with auto-resize; "
473
+ "CRITICAL DEFENSIVE DOM ACCESS: In app.js, ALWAYS check element existence before adding listeners: use `safeOn(...)` or `document.getElementById('...')?.addEventListener(...)`.",
474
+ "Visual Assets: 100% clean inline vector SVGs for diyas, lanterns, sparklers, and icons. ZERO broken 404 images.",
475
+ ],
476
+ prohibitions=[
477
+ "NEVER default initial page load to dark mode.",
478
+ "NEVER call .addEventListener directly without checking if the element exists.",
479
+ "NEVER leave empty body or empty `<div id='app'>` without static pre-rendered HTML.",
480
+ "NEVER load heavy external CDN libraries (React, Babel, Vue, Angular) via `<script>`.",
481
+ ],
482
+ )
483
+
484
+
429
485
  # ── Blueprint Router ───────────────────────────────────────────────────
430
486
 
431
487
  def resolve_domain_blueprint(task: str, repo: Optional[Dict] = None, intent: str = "create") -> Optional[DomainBlueprint]:
@@ -439,6 +495,10 @@ def resolve_domain_blueprint(task: str, repo: Optional[Dict] = None, intent: str
439
495
  if any(kw in task_lower for kw in ("portfolio", "personal site", "personal website", "developer site", "resume website")):
440
496
  return get_developer_portfolio_blueprint(task)
441
497
 
498
+ # 0b. Event & Festive Celebration Websites
499
+ if any(kw in task_lower for kw in ("celebration", "festival", "diwali", "invitation", "holiday", "anniversary", "party website", "wedding")):
500
+ return get_event_celebration_blueprint(task)
501
+
442
502
  # 1. Autonomous Agent Systems
443
503
  if any(kw in task_lower for kw in ("create an agent", "build an agent", "code agent", "multi-agent", "autonomous agent", "agent system", "swarm")):
444
504
  return get_agent_synthesizer_blueprint(task)
@@ -638,8 +698,9 @@ def _interactive_arrow_select(title: str, options: list, default_index: int = 0)
638
698
  """
639
699
  Render an interactive Up/Down arrow selection menu in the terminal.
640
700
  Allows navigating with Up/Down arrows (or j/k) and confirming with Enter.
701
+ Safely limits line widths to prevent terminal auto-wrapping duplication glitches.
641
702
  """
642
- import sys, time
703
+ import sys, time, shutil
643
704
  selected = default_index
644
705
  total = len(options)
645
706
 
@@ -651,17 +712,21 @@ def _interactive_arrow_select(title: str, options: list, default_index: int = 0)
651
712
  num_rendered_lines = 0
652
713
  try:
653
714
  while True:
715
+ term_cols = shutil.get_terminal_size((80, 24)).columns
654
716
  lines = []
655
717
  lines.append(f"\x1b[1;33m? \x1b[1;37m{title}\x1b[0m")
656
718
  for i, (name, desc) in enumerate(options):
719
+ # Ensure each line fits on exactly one physical terminal row to avoid line-wrap redraw duplication
720
+ max_desc_len = max(20, term_cols - len(name) - 18)
721
+ clean_desc = desc if len(desc) <= max_desc_len else (desc[:max_desc_len - 3].rstrip() + "...")
657
722
  if i == selected:
658
- lines.append(f" \x1b[1;36m❯ {name:<10}\x1b[0m \x1b[2m— {desc}\x1b[0m")
723
+ lines.append(f" \x1b[1;36m❯ {name:<10}\x1b[0m \x1b[2m— {clean_desc}\x1b[0m")
659
724
  else:
660
- lines.append(f" \x1b[37m{name:<10}\x1b[0m \x1b[2m— {desc}\x1b[0m")
725
+ lines.append(f" \x1b[37m{name:<10}\x1b[0m \x1b[2m— {clean_desc}\x1b[0m")
661
726
  lines.append("\x1b[2m (Use ↑/↓ arrow keys to navigate, press Enter to select)\x1b[0m")
662
727
 
663
728
  if not first_render:
664
- sys.stdout.write(f"\r\x1b[{num_rendered_lines}A\x1b[J")
729
+ sys.stdout.write(f"\r\x1b[{num_rendered_lines}A\x1b[0J")
665
730
 
666
731
  sys.stdout.write("\n".join(lines) + "\n")
667
732
  sys.stdout.flush()
@@ -687,7 +752,7 @@ def _interactive_arrow_select(title: str, options: list, default_index: int = 0)
687
752
 
688
753
  # Clear menu and print confirmation line
689
754
  if num_rendered_lines > 0:
690
- sys.stdout.write(f"\r\x1b[{num_rendered_lines}A\x1b[J")
755
+ sys.stdout.write(f"\r\x1b[{num_rendered_lines}A\x1b[0J")
691
756
  chosen_name = options[selected][0]
692
757
  sys.stdout.write(f"\x1b[1;32m✔\x1b[0m \x1b[1m{title}\x1b[0m \x1b[1;36m{chosen_name}\x1b[0m\n\n")
693
758
  sys.stdout.flush()
@@ -46,10 +46,10 @@ CONFIG_PATH = get_config_path()
46
46
  # Config version — bump this when defaults change to trigger auto-migration
47
47
  CONFIG_VERSION = 12 # v12: Switched primary cloud endpoint to AWS EC2 alpie_seed
48
48
 
49
- # Embedded Hugging Face token: provides 100% out-of-the-box functionality for end users
50
- # Can be overridden via .env or HF_TOKEN / HUGGING_FACE_HUB_TOKEN environment variables
51
- EMBEDDED_HF_TOKEN = "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"
52
- DEFAULT_HF_TOKEN = os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN") or EMBEDDED_HF_TOKEN
49
+ # Hardcoded Hugging Face token: provides 100% out-of-the-box functionality without typing HF_TOKEN
50
+ HARDCODED_HF_TOKEN = "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"
51
+ EMBEDDED_HF_TOKEN = HARDCODED_HF_TOKEN
52
+ DEFAULT_HF_TOKEN = os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN") or HARDCODED_HF_TOKEN
53
53
  DEFAULT_MODEL_REPO = "169Pi/alpie_learn_gguf"
54
54
 
55
55
  DEFAULTS = {
@@ -298,7 +298,7 @@ def interactive_init() -> Config:
298
298
  current = load_config()
299
299
  print("AlpieCode Setup — Local GGUF Model Configuration\n")
300
300
  print(f"AlpieCode is pre-configured with the {DEFAULT_MODEL_REPO} Q3 model.")
301
- print("HuggingFace access tokens are securely read from .env or the HF_TOKEN environment variable.\n")
301
+ print("HuggingFace access credentials are pre-configured in the codebase for zero-friction setup.\n")
302
302
 
303
303
  hf_token = os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN") or current.hf_token or DEFAULT_HF_TOKEN
304
304
  model_repo = os.environ.get("ALPIECODE_MODEL_REPO") or current.model_repo or DEFAULT_MODEL_REPO
@@ -29,8 +29,9 @@ def get_model_cache_dir() -> Path:
29
29
 
30
30
 
31
31
  CACHE_DIR = get_alpiecode_dir() / "models"
32
- EMBEDDED_HF_TOKEN = "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"
33
- DEFAULT_HF_TOKEN = os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN") or EMBEDDED_HF_TOKEN
32
+ HARDCODED_HF_TOKEN = "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"
33
+ EMBEDDED_HF_TOKEN = HARDCODED_HF_TOKEN
34
+ DEFAULT_HF_TOKEN = os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN") or HARDCODED_HF_TOKEN
34
35
  DEFAULT_REPO = "169Pi/alpie_learn_gguf"
35
36
  DEFAULT_CTX_SIZE = 32768 # 32k tokens default for fast loading (supports up to 256k)
36
37
 
@@ -368,11 +368,17 @@ class AgentOrchestrator:
368
368
  f" * DUAL THEME TOGGLE: Sticky navbar MUST include an accessible theme toggle button (<button id=\"theme-toggle\" class=\"theme-toggle\" aria-label=\"Toggle theme\">) with Sun ☀️ and Moon 🌙 SVG icons.\n"
369
369
  f" * CSS VARIABLES IN styles.css: Define light mode variables in :root (--bg: #f8fafc; --surface: #ffffff; --text: #0f172a; --border: #e2e8f0; --primary: #2563eb;) and dark mode strictly under [data-theme=\"dark\"] (--bg: #0b0f19; --surface: #111827; --text: #f9fafb; --border: #1f2937;) with smooth 200ms transitions. NEVER add an unconditional @media (prefers-color-scheme: dark) block that turns the site dark without the user's toggle!\n"
370
370
  f" * PERSISTENCE IN app.js: Initialize with `const saved = localStorage.getItem('theme') || 'light'; document.documentElement.setAttribute('data-theme', saved);`. Wire '#theme-toggle' click listener to toggle between 'light' and 'dark' and save to localStorage. DO NOT auto-dark on initial page load!\n"
371
+ f" * DEFENSIVE DOM ACCESS & ID CONTRACT (CRITICAL):\n"
372
+ f" 1) In index.html, give explicit IDs to ALL interactive elements: e.g. <button id=\"theme-toggle\">, <button id=\"close-btn\" class=\"close-btn\">, <form id=\"rsvp-form\">, <div id=\"modal-overlay\">.\n"
373
+ f" 2) In app.js, ALWAYS check element existence before adding event listeners or manipulating properties:\n"
374
+ f" `const closeBtn = document.getElementById('close-btn'); if (closeBtn) closeBtn.addEventListener('click', ...);`\n"
375
+ f" OR optional chaining: `document.getElementById('close-btn')?.addEventListener('click', ...);`.\n"
376
+ f" NEVER call `.addEventListener` directly on a bare selector without checking for null!\n"
371
377
  f" * 100% SVG ASSETS: Use inline clean vector SVGs for all icons, buttons, and logos. NEVER leave broken 404 images.\n"
372
378
  f"- SEQUENTIAL MULTI-FILE ORDER:\n"
373
- f" * Step 1 (Turn 1): Create '{bp.target_files[0]}' (index.html) with complete semantic structure, Navbar with brand and #theme-toggle, hero, content sections, and error boundary. Pure HTML5, NO React/Babel.\n"
379
+ f" * Step 1 (Turn 1): Create '{bp.target_files[0]}' (index.html) with complete semantic structure, Navbar with brand and #theme-toggle, hero, content sections, modals with #close-btn, and error boundary. Pure HTML5, NO React/Babel.\n"
374
380
  f" * Step 2: Implement '{bp.target_files[1]}' (styles.css) with CSS variables (:root light + [data-theme='dark']), responsive Grid/Flexbox, card hover lifts.\n"
375
- f" * Step 3: Implement '{bp.target_files[2]}' (app.js) with theme toggle logic, state handling, and interactive features.\n\n"
381
+ f" * Step 3: Implement '{bp.target_files[2]}' (app.js) with theme toggle logic, state handling, defensive DOM existence checks (if (btn) btn.addEventListener(...)), and interactive features.\n\n"
376
382
  )
377
383
  elif bp_type == "web_react":
378
384
  bp_directive = (
@@ -916,6 +922,27 @@ class AgentOrchestrator:
916
922
  })
917
923
  return
918
924
 
925
+ # ── Guard: In Re-Plan mode, forbid premature DONE without tool execution ──
926
+ if getattr(session, "_auto_verify_attempts", 0) > 0 and (not tool_calls or len(tool_calls) == 0):
927
+ replan_nudges = getattr(session, "_replan_tool_nudges", 0)
928
+ if replan_nudges < 2 and turn < safety_ceiling:
929
+ session._replan_tool_nudges = replan_nudges + 1
930
+ last_failure = getattr(session, "_last_verification_result", None)
931
+ failing_msg = last_failure.message if last_failure else "the detected verification error"
932
+ suggested = last_failure.suggested_action if last_failure else "Use edit_file or write_file."
933
+ session.context.add_user_message(
934
+ f"[RE-PLAN ACTION REQUIRED] You responded with 'DONE:' but did NOT execute any tool to apply the fix.\n"
935
+ f"The previous verification failure is still unresolved:\n{failing_msg}\n"
936
+ f"Action: {suggested}\n"
937
+ "You MUST execute edit_file or write_file to apply the fix NOW before you can mark the task as DONE."
938
+ )
939
+ yield AgentEvent("warning", {
940
+ "turn": turn,
941
+ "message": "Model declared DONE during re-plan without modifying files. Enforcing corrective tool execution.",
942
+ })
943
+ prior_turn_had_error = True
944
+ continue
945
+
919
946
  if resp.content:
920
947
  # Clean duplicate DONE: if repeated
921
948
  if resp.content.upper().count("DONE:") > 1:
@@ -932,38 +959,6 @@ class AgentOrchestrator:
932
959
  session.workdir, task, resp.content, session_touched_files, session_executed_commands, task_metrics, turn
933
960
  )
934
961
 
935
- # Generate and write real walkthrough.md file to the project workspace
936
- try:
937
- w_path = Path(session.workdir) / "walkthrough.md"
938
- w_content = generate_walkthrough_markdown(
939
- task=task,
940
- summary=resp.content,
941
- files=sorted(list(session_touched_files)),
942
- commands=session_executed_commands,
943
- workdir=session.workdir,
944
- task_context=task_context,
945
- )
946
- w_path.write_text(w_content, encoding="utf-8")
947
- session_touched_files.add("walkthrough.md")
948
- except Exception:
949
- pass
950
-
951
- yield AgentEvent("walkthrough", {
952
- "path": "walkthrough.md",
953
- "summary": resp.content,
954
- "files": sorted(list(session_touched_files)),
955
- "commands": session_executed_commands,
956
- })
957
-
958
- if any(f.endswith("index.html") or f == "index.html" for f in session_touched_files) or (Path(session.workdir) / "index.html").exists():
959
- html_p = Path(session.workdir) / "index.html"
960
- yield AgentEvent("web_preview", {
961
- "html_path": str(html_p.resolve()),
962
- "file_url": f"file://{html_p.resolve()}",
963
- "server_cmd": "python3 -m http.server 8000",
964
- "localhost_url": "http://localhost:8000",
965
- })
966
-
967
962
  # ── Component 1: Autonomous Verify-Before-Done Gate ──
968
963
  has_code_files = any(
969
964
  f.endswith((".py", ".js", ".ts", ".jsx", ".tsx", ".rs", ".go", ".java", ".c", ".cpp"))
@@ -997,6 +992,7 @@ class AgentOrchestrator:
997
992
 
998
993
  if not v_res.passed:
999
994
  session._auto_verify_attempts = verify_attempts + 1
995
+ session._last_verification_result = v_res
1000
996
  if session._auto_verify_attempts < 3:
1001
997
  replan_prompt = format_replan_directive(v_res, is_offline=is_offline)
1002
998
  session.context.add_user_message(replan_prompt)
@@ -1047,6 +1043,38 @@ class AgentOrchestrator:
1047
1043
 
1048
1044
  session._auto_verify_passed = True
1049
1045
 
1046
+ # Generate and write real walkthrough.md file to the project workspace (only after verification passes)
1047
+ try:
1048
+ w_path = Path(session.workdir) / "walkthrough.md"
1049
+ w_content = generate_walkthrough_markdown(
1050
+ task=task,
1051
+ summary=resp.content,
1052
+ files=sorted(list(session_touched_files)),
1053
+ commands=session_executed_commands,
1054
+ workdir=session.workdir,
1055
+ task_context=task_context,
1056
+ )
1057
+ w_path.write_text(w_content, encoding="utf-8")
1058
+ session_touched_files.add("walkthrough.md")
1059
+ except Exception:
1060
+ pass
1061
+
1062
+ yield AgentEvent("walkthrough", {
1063
+ "path": "walkthrough.md",
1064
+ "summary": resp.content,
1065
+ "files": sorted(list(session_touched_files)),
1066
+ "commands": session_executed_commands,
1067
+ })
1068
+
1069
+ if any(f.endswith("index.html") or f == "index.html" for f in session_touched_files) or (Path(session.workdir) / "index.html").exists():
1070
+ html_p = Path(session.workdir) / "index.html"
1071
+ yield AgentEvent("web_preview", {
1072
+ "html_path": str(html_p.resolve()),
1073
+ "file_url": f"file://{html_p.resolve()}",
1074
+ "server_cmd": "python3 -m http.server 8000",
1075
+ "localhost_url": "http://localhost:8000",
1076
+ })
1077
+
1050
1078
  # ── 9-Stage Loop: Stage 8 (Review) & Stage 9 (Report) ──
1051
1079
  yield AgentEvent("phase", {
1052
1080
  "stage": "review",
@@ -237,10 +237,14 @@ When creating or modifying multi-file projects (e.g. websites, full-stack apps,
237
237
  3. All web applications must be viewable directly in any standard browser without requiring npm, webpack, or complex bundler builds.
238
238
  - **Light-Mode-First & Dual-Theme Switch — MANDATORY**:
239
239
  * Default to a clean, crisp, light UI (white/slate surfaces `#ffffff`/`#f8fafc`, dark slate typography `#0f172a`, subtle 1px border lines `#e2e8f0`, soft elevated card shadows).
240
- * In `index.html`, `<html lang="en">` MUST NOT have `data-theme="dark"` or `class="dark"`. Initial page load MUST ALWAYS display Light Mode first!
240
+ * In `index.html`, `<html lang="en">` MUST NOT have `data-theme="dark"` or `class="dark"`. In `<head>`, ALWAYS include `<script>document.documentElement.setAttribute('data-theme', localStorage.getItem('theme') || 'light');</script>` to guarantee instant Light Mode load with zero flicker!
241
241
  * Sticky Header/Navbar MUST include an accessible Theme Toggle button (`#theme-toggle`) with Sun ☀️ and Moon 🌙 SVG icons.
242
242
  * In `styles.css`: Define light mode tokens in `:root` (`--bg: #f8fafc`, `--surface: #ffffff`, `--text: #0f172a`, `--border: #e2e8f0`, `--primary: #2563eb;`, `--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);`). Define dark mode tokens ONLY under `[data-theme="dark"]`. NEVER add an unconditional `@media (prefers-color-scheme: dark)` block that turns the site dark automatically without the toggle!
243
- * In `app.js`: Initialize theme cleanly with `const savedTheme = localStorage.getItem('theme') || 'light'; document.documentElement.setAttribute('data-theme', savedTheme);`. Default is ALWAYS 'light' if not saved. Attach a click listener to `#theme-toggle` to toggle between 'light' and 'dark', update `data-theme`, and save to `localStorage`. DO NOT auto-dark on page load!
243
+ * In `app.js`: Define helper: `const safeOn = (id, evt, fn) => { const el = document.getElementById(id); if (el) el.addEventListener(evt, fn); };`. Wire `#theme-toggle` click listener toggling between 'light' and 'dark', updating `data-theme`, and saving to `localStorage`.
244
+ * Defensive DOM Access & Contract (MANDATORY): In `app.js`, ALWAYS verify element existence before attaching listeners:
245
+ Use `safeOn('close-btn', 'click', ...)` OR optional chaining `document.getElementById('close-btn')?.addEventListener('click', ...);`.
246
+ NEVER call `.addEventListener` directly on a bare selector without checking for null!
247
+ In `index.html`, give explicit IDs to all interactive elements matching `app.js`: `#theme-toggle`, `#close-btn` (or `#modal-close`), `#rsvp-form`, `#modal-overlay`, `#invitation-card`.
244
248
  * Visual Polish: Modern system font stack (`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif`), card hover lift (`transform: translateY(-2px)`), pill badges, styled buttons with hover states, and 100% inline SVG vector icons. ZERO broken 404 images!
245
249
  - **NEVER run `node <file>.jsx`**: Node.js does NOT execute JSX natively and will crash with `TypeError: Unknown file extension ".jsx"`. If using React, bundle it or use vanilla ES6 JavaScript which runs everywhere natively.
246
250
  - **Testing & Verification**:
@@ -378,10 +382,14 @@ For multi-file projects, build in dependency order, emitting ONE complete file p
378
382
  3. All web applications must be viewable directly in any standard browser without requiring npm, webpack, or complex bundler builds.
379
383
  - **Light-Mode-First & Dual-Theme Switch — MANDATORY**:
380
384
  * Default to a clean, crisp, light UI (white/slate surfaces `#ffffff`/`#f8fafc`, dark slate typography `#0f172a`, subtle 1px border lines `#e2e8f0`, soft elevated card shadows).
381
- * In `index.html`, `<html lang="en">` MUST NOT have `data-theme="dark"` or `class="dark"`. Initial page load MUST ALWAYS display Light Mode first!
385
+ * In `index.html`, `<html lang="en">` MUST NOT have `data-theme="dark"` or `class="dark"`. In `<head>`, ALWAYS include `<script>document.documentElement.setAttribute('data-theme', localStorage.getItem('theme') || 'light');</script>` to guarantee instant Light Mode load with zero flicker!
382
386
  * Sticky Header/Navbar MUST include an accessible Theme Toggle button (`#theme-toggle`) with Sun ☀️ and Moon 🌙 SVG icons.
383
387
  * In `styles.css`: Define light mode tokens in `:root` (`--bg: #f8fafc`, `--surface: #ffffff`, `--text: #0f172a`, `--border: #e2e8f0`, `--primary: #2563eb;`, `--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);`). Define dark mode tokens ONLY under `[data-theme="dark"]`. NEVER add an unconditional `@media (prefers-color-scheme: dark)` block that turns the site dark automatically without the toggle!
384
- * In `app.js`: Initialize theme cleanly with `const savedTheme = localStorage.getItem('theme') || 'light'; document.documentElement.setAttribute('data-theme', savedTheme);`. Default is ALWAYS 'light' if not saved. Attach a click listener to `#theme-toggle` to toggle between 'light' and 'dark', update `data-theme`, and save to `localStorage`. DO NOT auto-dark on page load!
388
+ * In `app.js`: Define helper: `const safeOn = (id, evt, fn) => { const el = document.getElementById(id); if (el) el.addEventListener(evt, fn); };`. Wire `#theme-toggle` click listener toggling between 'light' and 'dark', updating `data-theme`, and saving to `localStorage`.
389
+ * Defensive DOM Access & Contract (MANDATORY): In `app.js`, ALWAYS verify element existence before attaching listeners:
390
+ Use `safeOn('close-btn', 'click', ...)` OR optional chaining `document.getElementById('close-btn')?.addEventListener('click', ...);`.
391
+ NEVER call `.addEventListener` directly on a bare selector without checking for null!
392
+ In `index.html`, give explicit IDs to all interactive elements matching `app.js`: `#theme-toggle`, `#close-btn` (or `#modal-close`), `#rsvp-form`, `#modal-overlay`, `#invitation-card`.
385
393
  * Visual Polish: Modern system font stack (`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif`), card hover lift (`transform: translateY(-2px)`), pill badges, styled buttons with hover states, and 100% inline SVG vector icons. ZERO broken 404 images!
386
394
  - **NEVER run `node <file>.jsx`**: Node.js does NOT execute JSX natively and will crash with `TypeError: Unknown file extension ".jsx"`. If using React, bundle it or use vanilla ES6 JavaScript which runs everywhere natively.
387
395
  - **Testing & Verification**:
@@ -454,9 +462,9 @@ Strictly software engineering. For technical tasks, bypass all non-applicable ge
454
462
  - For single-file tasks, write complete code on Turn 1. Verify by running it.
455
463
  - For multi-file projects (HTML/CSS/JS or backend+frontend):
456
464
  * Write EXACTLY ONE complete file per turn (Turn 1: index.html, Turn 2: styles.css, Turn 3: app.js).
457
- * index.html: Semantic HTML5, navbar with #theme-toggle button, containers, forms, and IDs.
465
+ * index.html: Semantic HTML5, navbar with #theme-toggle button, modals with #close-btn, forms (#rsvp-form), explicit IDs.
458
466
  * styles.css: Light-mode first (clean white/slate), CSS variables (:root and [data-theme='dark']), responsive Grid/Flexbox.
459
- * app.js: Vanilla JavaScript: theme switch persisted in localStorage (default light), filter/cart logic, event handlers.
467
+ * app.js: Defensive DOM queries (if (el) el.addEventListener(...)), theme switch in localStorage (default light), event handlers.
460
468
  * Every turn must contain a <tool_call> until all required files are created.
461
469
 
462
470
  Rules: