alpiecode 10.9.0__tar.gz → 10.9.2__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.0 → alpiecode-10.9.2}/PKG-INFO +1 -1
  2. {alpiecode-10.9.0 → alpiecode-10.9.2}/pyproject.toml +1 -1
  3. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/alpiecode.egg-info/PKG-INFO +1 -1
  4. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/__init__.py +1 -1
  5. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/blueprints.py +146 -30
  6. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/orchestrator.py +62 -34
  7. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/prompt.py +10 -2
  8. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/verifier.py +194 -0
  9. {alpiecode-10.9.0 → alpiecode-10.9.2}/test/test_lifecycle_and_portfolio.py +114 -0
  10. {alpiecode-10.9.0 → alpiecode-10.9.2}/test/test_verifier.py +93 -0
  11. {alpiecode-10.9.0 → alpiecode-10.9.2}/README.md +0 -0
  12. {alpiecode-10.9.0 → alpiecode-10.9.2}/setup.cfg +0 -0
  13. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/alpiecode/__init__.py +0 -0
  14. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/alpiecode.egg-info/SOURCES.txt +0 -0
  15. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/alpiecode.egg-info/dependency_links.txt +0 -0
  16. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/alpiecode.egg-info/entry_points.txt +0 -0
  17. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/alpiecode.egg-info/requires.txt +0 -0
  18. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/alpiecode.egg-info/top_level.txt +0 -0
  19. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/agent.py +0 -0
  20. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/assessment.py +0 -0
  21. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/backends/__init__.py +0 -0
  22. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/backends/base.py +0 -0
  23. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/backends/local_backend.py +0 -0
  24. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/backends/openai_backend.py +0 -0
  25. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/cache.py +0 -0
  26. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/cli.py +0 -0
  27. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/client.py +0 -0
  28. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/compaction.py +0 -0
  29. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/config.py +0 -0
  30. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/context.py +0 -0
  31. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/diff_preview.py +0 -0
  32. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/discovery.py +0 -0
  33. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/doctor.py +0 -0
  34. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/dream_rsi.py +0 -0
  35. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/executor.py +0 -0
  36. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/git_ops.py +0 -0
  37. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/github.py +0 -0
  38. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/guardian.py +0 -0
  39. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/guardrails.py +0 -0
  40. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/ipython_ext.py +0 -0
  41. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/local_model.py +0 -0
  42. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/media.py +0 -0
  43. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/memory.py +0 -0
  44. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/metrics.py +0 -0
  45. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/paths.py +0 -0
  46. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/progress.py +0 -0
  47. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/project_template.py +0 -0
  48. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/rephraser.py +0 -0
  49. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/server.py +0 -0
  50. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/session.py +0 -0
  51. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/accessibility-audit/SKILL.md +0 -0
  52. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/accessibility-testing/SKILL.md +0 -0
  53. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/accessibility-ui-components/SKILL.md +0 -0
  54. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/agentic-workflows/SKILL.md +0 -0
  55. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/api-design/SKILL.md +0 -0
  56. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/architecture-design/SKILL.md +0 -0
  57. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/backend-engineering/SKILL.md +0 -0
  58. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/browser-automation/SKILL.md +0 -0
  59. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/cli-development/SKILL.md +0 -0
  60. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/cloud-infrastructure/SKILL.md +0 -0
  61. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/code-generation/SKILL.md +0 -0
  62. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/code-review/SKILL.md +0 -0
  63. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/codebase-onboarding/SKILL.md +0 -0
  64. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/cost-optimization/SKILL.md +0 -0
  65. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/data-analysis/SKILL.md +0 -0
  66. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/data-engineering/SKILL.md +0 -0
  67. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/database-engineering/SKILL.md +0 -0
  68. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/dependency-management/SKILL.md +0 -0
  69. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/dependency-security/SKILL.md +0 -0
  70. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/dependency-upgrades/SKILL.md +0 -0
  71. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/devops-ci-cd/SKILL.md +0 -0
  72. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/docker-containers/SKILL.md +0 -0
  73. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/documentation/SKILL.md +0 -0
  74. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/documentation-site/SKILL.md +0 -0
  75. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/e2e-testing/SKILL.md +0 -0
  76. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/error-handling-resilience/SKILL.md +0 -0
  77. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/feature-development/SKILL.md +0 -0
  78. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/frontend-engineering/SKILL.md +0 -0
  79. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/git-workflow/SKILL.md +0 -0
  80. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/incident-response/SKILL.md +0 -0
  81. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/legacy-code-modernization/SKILL.md +0 -0
  82. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/llm-application-engineering/SKILL.md +0 -0
  83. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/localization-i18n/SKILL.md +0 -0
  84. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/mcp-server-development/SKILL.md +0 -0
  85. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/migration-engineering/SKILL.md +0 -0
  86. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/mobile-development/SKILL.md +0 -0
  87. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/model-evaluation/SKILL.md +0 -0
  88. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/nodejs-services/SKILL.md +0 -0
  89. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/observability/SKILL.md +0 -0
  90. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/performance-optimization/SKILL.md +0 -0
  91. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/privacy-data-protection/SKILL.md +0 -0
  92. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/prompt-engineering/SKILL.md +0 -0
  93. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/python-engineering/SKILL.md +0 -0
  94. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/rag-retrieval/SKILL.md +0 -0
  95. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/react-engineering/SKILL.md +0 -0
  96. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/release-management/SKILL.md +0 -0
  97. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/requirements-analysis/SKILL.md +0 -0
  98. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/responsive-design/SKILL.md +0 -0
  99. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/safe-refactoring/SKILL.md +0 -0
  100. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/secure-coding/SKILL.md +0 -0
  101. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/systematic-debugging/SKILL.md +0 -0
  102. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/technical-planning/SKILL.md +0 -0
  103. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/technical-research/SKILL.md +0 -0
  104. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/technical-writing/SKILL.md +0 -0
  105. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/test-engineering/SKILL.md +0 -0
  106. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/tool-integration/SKILL.md +0 -0
  107. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/typescript-engineering/SKILL.md +0 -0
  108. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/visual-regression-testing/SKILL.md +0 -0
  109. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/web-performance/SKILL.md +0 -0
  110. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/web-security-testing/SKILL.md +0 -0
  111. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills/workflow-automation/SKILL.md +0 -0
  112. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/skills.py +0 -0
  113. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/slash.py +0 -0
  114. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/subagent.py +0 -0
  115. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/system1.py +0 -0
  116. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/tools.py +0 -0
  117. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/updater.py +0 -0
  118. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/vscode_installer.py +0 -0
  119. {alpiecode-10.9.0 → alpiecode-10.9.2}/src/codeagent/walkthrough.py +0 -0
  120. {alpiecode-10.9.0 → alpiecode-10.9.2}/test/test_adaptive_resilience.py +0 -0
  121. {alpiecode-10.9.0 → alpiecode-10.9.2}/test/test_cli_ui.py +0 -0
  122. {alpiecode-10.9.0 → alpiecode-10.9.2}/test/test_context_and_trajectory.py +0 -0
  123. {alpiecode-10.9.0 → alpiecode-10.9.2}/test/test_deloop_and_sessions.py +0 -0
  124. {alpiecode-10.9.0 → alpiecode-10.9.2}/test/test_dream_rsi.py +0 -0
  125. {alpiecode-10.9.0 → alpiecode-10.9.2}/test/test_local_model_download.py +0 -0
  126. {alpiecode-10.9.0 → alpiecode-10.9.2}/test/test_non_thinking_and_local_stream.py +0 -0
  127. {alpiecode-10.9.0 → alpiecode-10.9.2}/test/test_project_templates.py +0 -0
  128. {alpiecode-10.9.0 → alpiecode-10.9.2}/test/test_skills_engine.py +0 -0
  129. {alpiecode-10.9.0 → alpiecode-10.9.2}/test/test_slash_and_diff.py +0 -0
  130. {alpiecode-10.9.0 → alpiecode-10.9.2}/test/test_subagents.py +0 -0
  131. {alpiecode-10.9.0 → alpiecode-10.9.2}/test/test_task_assessment.py +0 -0
  132. {alpiecode-10.9.0 → alpiecode-10.9.2}/test/test_walkthrough.py +0 -0
  133. {alpiecode-10.9.0 → alpiecode-10.9.2}/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.0
3
+ Version: 10.9.2
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.0"
7
+ version = "10.9.2"
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.0
3
+ Version: 10.9.2
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.0"
20
+ __version__ = "10.9.2"
21
21
 
22
22
  def run(task: str, workdir: str = ".", reasoning_level: str = "thinking", **kwargs):
23
23
  """Run an autonomous coding task programmatically."""
@@ -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,56 @@ 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) Sticky Navbar with event brand, dates, and `#theme-toggle`; "
458
+ "2) Hero banner with greeting, festive countdown timer, and 'View Invitation' button; "
459
+ "3) Interactive 3D Invitation Card (`<div class='card-3d' id='invitation-card'>`) with `.card-front` (ornate festive border, diya/lantern SVG, headline) and `.card-back` (schedule, venue, and 'RSVP Now' button `#open-rsvp-btn`); "
460
+ "4) Atmospheric celebration canvas (`<canvas id='fx-canvas'></canvas>`) for subtle sparkles/fireworks; "
461
+ "5) Event highlights & schedule cards; "
462
+ "6) 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'>`; "
463
+ "7) Floating toast container (`<div id='toast-container'></div>`) for RSVP confirmation; "
464
+ "8) Error boundary script. All interactive elements MUST have explicit IDs.",
465
+ "Turn 2 (`styles.css`): Modern CSS using custom properties in `:root` (--bg: #ffffff, --surface: #fffbeb, --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; } .card-3d { transform-style: preserve-3d; transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1); } .card-3d.flipped { transform: rotateY(180deg); } .card-front, .card-back { backface-visibility: hidden; } .card-back { transform: rotateY(180deg); }`. Modal overlay with backdrop-blur. Responsive Flexbox/Grid.",
466
+ "Turn 3 (`app.js`): Vanilla JS IIFE: "
467
+ "1) Theme toggle logic: initialize with `const saved = localStorage.getItem('theme') || 'light'; document.documentElement.setAttribute('data-theme', saved);` and wire `#theme-toggle` click listener; "
468
+ "2) Interactive 3D card flip: click on `#invitation-card` or 'Flip Card' button toggles `.flipped` class; "
469
+ "3) Modal open/close: `#open-rsvp-btn` opens `#modal-overlay`, `#close-btn` and clicking overlay closes it; "
470
+ "4) RSVP form submission: `#rsvp-form` validates inputs and displays animated toast in `#toast-container`; "
471
+ "5) Canvas FX: 60 FPS lightweight sparkle/firework particle loop on `#fx-canvas` with auto-resize; "
472
+ "CRITICAL DEFENSIVE DOM ACCESS: In app.js, ALWAYS check element existence before adding listeners: `const btn = document.getElementById('close-btn'); if (btn) { btn.addEventListener('click', ...); }` OR `?.addEventListener(...)`.",
473
+ "Visual Assets: 100% clean inline vector SVGs for diyas, lanterns, sparklers, and icons. ZERO broken 404 images.",
474
+ ],
475
+ prohibitions=[
476
+ "NEVER default initial page load to dark mode.",
477
+ "NEVER call .addEventListener directly without checking if the element exists.",
478
+ "NEVER leave empty body or empty `<div id='app'>` without static pre-rendered HTML.",
479
+ "NEVER load heavy external CDN libraries (React, Babel, Vue, Angular) via `<script>`.",
480
+ ],
481
+ )
482
+
483
+
429
484
  # ── Blueprint Router ───────────────────────────────────────────────────
430
485
 
431
486
  def resolve_domain_blueprint(task: str, repo: Optional[Dict] = None, intent: str = "create") -> Optional[DomainBlueprint]:
@@ -439,6 +494,10 @@ def resolve_domain_blueprint(task: str, repo: Optional[Dict] = None, intent: str
439
494
  if any(kw in task_lower for kw in ("portfolio", "personal site", "personal website", "developer site", "resume website")):
440
495
  return get_developer_portfolio_blueprint(task)
441
496
 
497
+ # 0b. Event & Festive Celebration Websites
498
+ if any(kw in task_lower for kw in ("celebration", "festival", "diwali", "invitation", "holiday", "anniversary", "party website", "wedding")):
499
+ return get_event_celebration_blueprint(task)
500
+
442
501
  # 1. Autonomous Agent Systems
443
502
  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
503
  return get_agent_synthesizer_blueprint(task)
@@ -537,7 +596,7 @@ def is_ambiguous_web_task(task: str) -> bool:
537
596
 
538
597
 
539
598
  def _read_terminal_key() -> str:
540
- """Read a single keypress or escape sequence from terminal in raw mode."""
599
+ """Read a single keypress or escape sequence from terminal directly without TextIOWrapper buffering."""
541
600
  import sys
542
601
  if sys.platform == "win32":
543
602
  try:
@@ -545,43 +604,93 @@ def _read_terminal_key() -> str:
545
604
  ch = msvcrt.getch()
546
605
  if ch in (b"\x00", b"\xe0"):
547
606
  ch2 = msvcrt.getch()
548
- if ch2 == b"H":
607
+ if ch2 in (b"H", b"w", b"K"):
549
608
  return "up"
550
- if ch2 == b"P":
609
+ elif ch2 in (b"P", b"s", b"M"):
551
610
  return "down"
552
611
  return ""
612
+ if ch == b"\x1b":
613
+ import time
614
+ time.sleep(0.02)
615
+ if msvcrt.kbhit():
616
+ ch2 = msvcrt.getch()
617
+ if ch2 in (b"[", b"O") and msvcrt.kbhit():
618
+ ch3 = msvcrt.getch()
619
+ if ch3 in (b"A", b"a"):
620
+ return "up"
621
+ elif ch3 in (b"B", b"b"):
622
+ return "down"
623
+ return "esc"
553
624
  if ch in (b"\r", b"\n"):
554
625
  return "enter"
626
+ if ch == b" ":
627
+ return "enter"
555
628
  if ch == b"\x03":
556
629
  raise KeyboardInterrupt
557
630
  return ch.decode("utf-8", errors="ignore")
558
631
  except Exception:
559
632
  return ""
560
633
  else:
561
- import tty, termios, select
562
- fd = sys.stdin.fileno()
563
- old_settings = termios.tcgetattr(fd)
634
+ import tty, termios, os, select
635
+ try:
636
+ fd = sys.stdin.fileno()
637
+ except Exception:
638
+ return ""
639
+
640
+ old_settings = None
641
+ has_termios = False
564
642
  try:
643
+ old_settings = termios.tcgetattr(fd)
565
644
  tty.setraw(fd)
566
- ch = sys.stdin.read(1)
567
- if ch == "\x1b":
568
- r, _, _ = select.select([sys.stdin], [], [], 0.05)
569
- if r:
570
- ch2 = sys.stdin.read(1)
571
- if ch2 in ("[", "O"):
572
- ch3 = sys.stdin.read(1)
573
- if ch3 == "A":
574
- return "up"
575
- elif ch3 == "B":
576
- return "down"
645
+ has_termios = True
646
+ except Exception:
647
+ has_termios = False
648
+
649
+ try:
650
+ # Read first byte directly from OS file descriptor bypassing TextIOWrapper buffer
651
+ b = os.read(fd, 1)
652
+ if not b:
653
+ return ""
654
+ if b == b"\x1b":
655
+ r, _, _ = select.select([fd], [], [], 0.05)
656
+ if not r:
657
+ return "esc"
658
+ b2 = os.read(fd, 1)
659
+ if b2 in (b"[", b"O"):
660
+ b3 = os.read(fd, 1)
661
+ if b3 in (b"A", b"a"):
662
+ return "up"
663
+ elif b3 in (b"B", b"b"):
664
+ return "down"
665
+ elif b3 in (b"1", b"2", b"3", b"4", b"5", b"6"):
666
+ # Handle extended sequences like \x1b[1;5A or \x1b[2~
667
+ while True:
668
+ r_extra, _, _ = select.select([fd], [], [], 0.01)
669
+ if not r_extra:
670
+ break
671
+ extra = os.read(fd, 1)
672
+ if extra in (b"A", b"a"):
673
+ return "up"
674
+ elif extra in (b"B", b"b"):
675
+ return "down"
676
+ if extra in (b"~", b"A", b"B", b"C", b"D"):
677
+ break
678
+ return ""
679
+ return ""
577
680
  return "esc"
578
- elif ch in ("\r", "\n"):
681
+ elif b in (b"\r", b"\n"):
579
682
  return "enter"
580
- elif ch == "\x03":
683
+ elif b == b" ":
684
+ return "enter"
685
+ elif b == b"\x03":
581
686
  raise KeyboardInterrupt
582
- return ch
687
+ return b.decode("utf-8", errors="ignore")
583
688
  finally:
584
- termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
689
+ if has_termios and old_settings is not None:
690
+ try:
691
+ termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
692
+ except Exception:
693
+ pass
585
694
 
586
695
 
587
696
  def _interactive_arrow_select(title: str, options: list, default_index: int = 0) -> int:
@@ -589,7 +698,7 @@ def _interactive_arrow_select(title: str, options: list, default_index: int = 0)
589
698
  Render an interactive Up/Down arrow selection menu in the terminal.
590
699
  Allows navigating with Up/Down arrows (or j/k) and confirming with Enter.
591
700
  """
592
- import sys
701
+ import sys, time
593
702
  selected = default_index
594
703
  total = len(options)
595
704
 
@@ -598,28 +707,34 @@ def _interactive_arrow_select(title: str, options: list, default_index: int = 0)
598
707
  sys.stdout.flush()
599
708
 
600
709
  first_render = True
710
+ num_rendered_lines = 0
601
711
  try:
602
712
  while True:
603
713
  lines = []
604
714
  lines.append(f"\x1b[1;33m? \x1b[1;37m{title}\x1b[0m")
605
715
  for i, (name, desc) in enumerate(options):
606
716
  if i == selected:
607
- lines.append(f" \x1b[1;36m❯ {name}\x1b[0m \x1b[2m— {desc}\x1b[0m")
717
+ lines.append(f" \x1b[1;36m❯ {name:<10}\x1b[0m \x1b[2m— {desc}\x1b[0m")
608
718
  else:
609
- lines.append(f" \x1b[37m{name}\x1b[0m \x1b[2m— {desc}\x1b[0m")
719
+ lines.append(f" \x1b[37m{name:<10}\x1b[0m \x1b[2m— {desc}\x1b[0m")
610
720
  lines.append("\x1b[2m (Use ↑/↓ arrow keys to navigate, press Enter to select)\x1b[0m")
611
721
 
612
722
  if not first_render:
613
- sys.stdout.write(f"\r\x1b[{len(lines)}A\x1b[J")
723
+ sys.stdout.write(f"\r\x1b[{num_rendered_lines}A\x1b[J")
614
724
 
615
725
  sys.stdout.write("\n".join(lines) + "\n")
616
726
  sys.stdout.flush()
617
727
  first_render = False
728
+ num_rendered_lines = len(lines)
618
729
 
619
730
  key = _read_terminal_key()
620
- if key in ("up", "k"):
731
+ if not key:
732
+ time.sleep(0.01)
733
+ continue
734
+
735
+ if key in ("up", "k", "w"):
621
736
  selected = (selected - 1) % total
622
- elif key in ("down", "j"):
737
+ elif key in ("down", "j", "s"):
623
738
  selected = (selected + 1) % total
624
739
  elif key in ("enter", " "):
625
740
  break
@@ -630,7 +745,8 @@ def _interactive_arrow_select(title: str, options: list, default_index: int = 0)
630
745
  break
631
746
 
632
747
  # Clear menu and print confirmation line
633
- sys.stdout.write(f"\r\x1b[{len(options) + 2}A\x1b[J")
748
+ if num_rendered_lines > 0:
749
+ sys.stdout.write(f"\r\x1b[{num_rendered_lines}A\x1b[J")
634
750
  chosen_name = options[selected][0]
635
751
  sys.stdout.write(f"\x1b[1;32m✔\x1b[0m \x1b[1m{title}\x1b[0m \x1b[1;36m{chosen_name}\x1b[0m\n\n")
636
752
  sys.stdout.flush()
@@ -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",
@@ -241,6 +241,10 @@ When creating or modifying multi-file projects (e.g. websites, full-stack apps,
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
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!
244
+ * Defensive DOM Access & Contract (MANDATORY): In `app.js`, ALWAYS verify element existence before attaching listeners or mutating properties:
245
+ `const closeBtn = document.getElementById('close-btn'); if (closeBtn) closeBtn.addEventListener('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**:
@@ -382,6 +386,10 @@ For multi-file projects, build in dependency order, emitting ONE complete file p
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
388
  * 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!
389
+ * Defensive DOM Access & Contract (MANDATORY): In `app.js`, ALWAYS verify element existence before attaching listeners or mutating properties:
390
+ `const closeBtn = document.getElementById('close-btn'); if (closeBtn) closeBtn.addEventListener('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: