alpiecode 10.8.9__tar.gz → 10.9.1__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.8.9 → alpiecode-10.9.1}/PKG-INFO +1 -1
  2. {alpiecode-10.8.9 → alpiecode-10.9.1}/pyproject.toml +1 -1
  3. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/alpiecode.egg-info/PKG-INFO +1 -1
  4. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/__init__.py +1 -1
  5. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/blueprints.py +182 -38
  6. {alpiecode-10.8.9 → alpiecode-10.9.1}/test/test_lifecycle_and_portfolio.py +123 -0
  7. {alpiecode-10.8.9 → alpiecode-10.9.1}/README.md +0 -0
  8. {alpiecode-10.8.9 → alpiecode-10.9.1}/setup.cfg +0 -0
  9. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/alpiecode/__init__.py +0 -0
  10. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/alpiecode.egg-info/SOURCES.txt +0 -0
  11. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/alpiecode.egg-info/dependency_links.txt +0 -0
  12. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/alpiecode.egg-info/entry_points.txt +0 -0
  13. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/alpiecode.egg-info/requires.txt +0 -0
  14. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/alpiecode.egg-info/top_level.txt +0 -0
  15. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/agent.py +0 -0
  16. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/assessment.py +0 -0
  17. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/backends/__init__.py +0 -0
  18. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/backends/base.py +0 -0
  19. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/backends/local_backend.py +0 -0
  20. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/backends/openai_backend.py +0 -0
  21. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/cache.py +0 -0
  22. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/cli.py +0 -0
  23. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/client.py +0 -0
  24. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/compaction.py +0 -0
  25. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/config.py +0 -0
  26. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/context.py +0 -0
  27. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/diff_preview.py +0 -0
  28. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/discovery.py +0 -0
  29. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/doctor.py +0 -0
  30. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/dream_rsi.py +0 -0
  31. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/executor.py +0 -0
  32. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/git_ops.py +0 -0
  33. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/github.py +0 -0
  34. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/guardian.py +0 -0
  35. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/guardrails.py +0 -0
  36. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/ipython_ext.py +0 -0
  37. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/local_model.py +0 -0
  38. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/media.py +0 -0
  39. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/memory.py +0 -0
  40. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/metrics.py +0 -0
  41. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/orchestrator.py +0 -0
  42. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/paths.py +0 -0
  43. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/progress.py +0 -0
  44. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/project_template.py +0 -0
  45. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/prompt.py +0 -0
  46. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/rephraser.py +0 -0
  47. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/server.py +0 -0
  48. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/session.py +0 -0
  49. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/accessibility-audit/SKILL.md +0 -0
  50. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/accessibility-testing/SKILL.md +0 -0
  51. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/accessibility-ui-components/SKILL.md +0 -0
  52. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/agentic-workflows/SKILL.md +0 -0
  53. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/api-design/SKILL.md +0 -0
  54. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/architecture-design/SKILL.md +0 -0
  55. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/backend-engineering/SKILL.md +0 -0
  56. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/browser-automation/SKILL.md +0 -0
  57. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/cli-development/SKILL.md +0 -0
  58. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/cloud-infrastructure/SKILL.md +0 -0
  59. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/code-generation/SKILL.md +0 -0
  60. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/code-review/SKILL.md +0 -0
  61. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/codebase-onboarding/SKILL.md +0 -0
  62. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/cost-optimization/SKILL.md +0 -0
  63. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/data-analysis/SKILL.md +0 -0
  64. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/data-engineering/SKILL.md +0 -0
  65. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/database-engineering/SKILL.md +0 -0
  66. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/dependency-management/SKILL.md +0 -0
  67. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/dependency-security/SKILL.md +0 -0
  68. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/dependency-upgrades/SKILL.md +0 -0
  69. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/devops-ci-cd/SKILL.md +0 -0
  70. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/docker-containers/SKILL.md +0 -0
  71. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/documentation/SKILL.md +0 -0
  72. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/documentation-site/SKILL.md +0 -0
  73. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/e2e-testing/SKILL.md +0 -0
  74. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/error-handling-resilience/SKILL.md +0 -0
  75. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/feature-development/SKILL.md +0 -0
  76. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/frontend-engineering/SKILL.md +0 -0
  77. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/git-workflow/SKILL.md +0 -0
  78. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/incident-response/SKILL.md +0 -0
  79. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/legacy-code-modernization/SKILL.md +0 -0
  80. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/llm-application-engineering/SKILL.md +0 -0
  81. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/localization-i18n/SKILL.md +0 -0
  82. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/mcp-server-development/SKILL.md +0 -0
  83. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/migration-engineering/SKILL.md +0 -0
  84. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/mobile-development/SKILL.md +0 -0
  85. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/model-evaluation/SKILL.md +0 -0
  86. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/nodejs-services/SKILL.md +0 -0
  87. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/observability/SKILL.md +0 -0
  88. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/performance-optimization/SKILL.md +0 -0
  89. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/privacy-data-protection/SKILL.md +0 -0
  90. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/prompt-engineering/SKILL.md +0 -0
  91. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/python-engineering/SKILL.md +0 -0
  92. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/rag-retrieval/SKILL.md +0 -0
  93. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/react-engineering/SKILL.md +0 -0
  94. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/release-management/SKILL.md +0 -0
  95. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/requirements-analysis/SKILL.md +0 -0
  96. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/responsive-design/SKILL.md +0 -0
  97. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/safe-refactoring/SKILL.md +0 -0
  98. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/secure-coding/SKILL.md +0 -0
  99. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/systematic-debugging/SKILL.md +0 -0
  100. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/technical-planning/SKILL.md +0 -0
  101. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/technical-research/SKILL.md +0 -0
  102. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/technical-writing/SKILL.md +0 -0
  103. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/test-engineering/SKILL.md +0 -0
  104. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/tool-integration/SKILL.md +0 -0
  105. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/typescript-engineering/SKILL.md +0 -0
  106. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/visual-regression-testing/SKILL.md +0 -0
  107. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/web-performance/SKILL.md +0 -0
  108. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/web-security-testing/SKILL.md +0 -0
  109. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills/workflow-automation/SKILL.md +0 -0
  110. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/skills.py +0 -0
  111. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/slash.py +0 -0
  112. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/subagent.py +0 -0
  113. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/system1.py +0 -0
  114. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/tools.py +0 -0
  115. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/updater.py +0 -0
  116. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/verifier.py +0 -0
  117. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/vscode_installer.py +0 -0
  118. {alpiecode-10.8.9 → alpiecode-10.9.1}/src/codeagent/walkthrough.py +0 -0
  119. {alpiecode-10.8.9 → alpiecode-10.9.1}/test/test_adaptive_resilience.py +0 -0
  120. {alpiecode-10.8.9 → alpiecode-10.9.1}/test/test_cli_ui.py +0 -0
  121. {alpiecode-10.8.9 → alpiecode-10.9.1}/test/test_context_and_trajectory.py +0 -0
  122. {alpiecode-10.8.9 → alpiecode-10.9.1}/test/test_deloop_and_sessions.py +0 -0
  123. {alpiecode-10.8.9 → alpiecode-10.9.1}/test/test_dream_rsi.py +0 -0
  124. {alpiecode-10.8.9 → alpiecode-10.9.1}/test/test_local_model_download.py +0 -0
  125. {alpiecode-10.8.9 → alpiecode-10.9.1}/test/test_non_thinking_and_local_stream.py +0 -0
  126. {alpiecode-10.8.9 → alpiecode-10.9.1}/test/test_project_templates.py +0 -0
  127. {alpiecode-10.8.9 → alpiecode-10.9.1}/test/test_skills_engine.py +0 -0
  128. {alpiecode-10.8.9 → alpiecode-10.9.1}/test/test_slash_and_diff.py +0 -0
  129. {alpiecode-10.8.9 → alpiecode-10.9.1}/test/test_subagents.py +0 -0
  130. {alpiecode-10.8.9 → alpiecode-10.9.1}/test/test_task_assessment.py +0 -0
  131. {alpiecode-10.8.9 → alpiecode-10.9.1}/test/test_verifier.py +0 -0
  132. {alpiecode-10.8.9 → alpiecode-10.9.1}/test/test_walkthrough.py +0 -0
  133. {alpiecode-10.8.9 → alpiecode-10.9.1}/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.8.9
3
+ Version: 10.9.1
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.8.9"
7
+ version = "10.9.1"
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.8.9
3
+ Version: 10.9.1
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.8.9"
20
+ __version__ = "10.9.1"
21
21
 
22
22
  def run(task: str, workdir: str = ".", reasoning_level: str = "thinking", **kwargs):
23
23
  """Run an autonomous coding task programmatically."""
@@ -536,9 +536,171 @@ def is_ambiguous_web_task(task: str) -> bool:
536
536
  return True
537
537
 
538
538
 
539
+ def _read_terminal_key() -> str:
540
+ """Read a single keypress or escape sequence from terminal directly without TextIOWrapper buffering."""
541
+ import sys
542
+ if sys.platform == "win32":
543
+ try:
544
+ import msvcrt
545
+ ch = msvcrt.getch()
546
+ if ch in (b"\x00", b"\xe0"):
547
+ ch2 = msvcrt.getch()
548
+ if ch2 in (b"H", b"w", b"K"):
549
+ return "up"
550
+ elif ch2 in (b"P", b"s", b"M"):
551
+ return "down"
552
+ return ""
553
+ if ch == b"\x1b":
554
+ import time
555
+ time.sleep(0.02)
556
+ if msvcrt.kbhit():
557
+ ch2 = msvcrt.getch()
558
+ if ch2 in (b"[", b"O") and msvcrt.kbhit():
559
+ ch3 = msvcrt.getch()
560
+ if ch3 in (b"A", b"a"):
561
+ return "up"
562
+ elif ch3 in (b"B", b"b"):
563
+ return "down"
564
+ return "esc"
565
+ if ch in (b"\r", b"\n"):
566
+ return "enter"
567
+ if ch == b" ":
568
+ return "enter"
569
+ if ch == b"\x03":
570
+ raise KeyboardInterrupt
571
+ return ch.decode("utf-8", errors="ignore")
572
+ except Exception:
573
+ return ""
574
+ else:
575
+ import tty, termios, os, select
576
+ try:
577
+ fd = sys.stdin.fileno()
578
+ except Exception:
579
+ return ""
580
+
581
+ old_settings = None
582
+ has_termios = False
583
+ try:
584
+ old_settings = termios.tcgetattr(fd)
585
+ tty.setraw(fd)
586
+ has_termios = True
587
+ except Exception:
588
+ has_termios = False
589
+
590
+ try:
591
+ # Read first byte directly from OS file descriptor bypassing TextIOWrapper buffer
592
+ b = os.read(fd, 1)
593
+ if not b:
594
+ return ""
595
+ if b == b"\x1b":
596
+ r, _, _ = select.select([fd], [], [], 0.05)
597
+ if not r:
598
+ return "esc"
599
+ b2 = os.read(fd, 1)
600
+ if b2 in (b"[", b"O"):
601
+ b3 = os.read(fd, 1)
602
+ if b3 in (b"A", b"a"):
603
+ return "up"
604
+ elif b3 in (b"B", b"b"):
605
+ return "down"
606
+ elif b3 in (b"1", b"2", b"3", b"4", b"5", b"6"):
607
+ # Handle extended sequences like \x1b[1;5A or \x1b[2~
608
+ while True:
609
+ r_extra, _, _ = select.select([fd], [], [], 0.01)
610
+ if not r_extra:
611
+ break
612
+ extra = os.read(fd, 1)
613
+ if extra in (b"A", b"a"):
614
+ return "up"
615
+ elif extra in (b"B", b"b"):
616
+ return "down"
617
+ if extra in (b"~", b"A", b"B", b"C", b"D"):
618
+ break
619
+ return ""
620
+ return ""
621
+ return "esc"
622
+ elif b in (b"\r", b"\n"):
623
+ return "enter"
624
+ elif b == b" ":
625
+ return "enter"
626
+ elif b == b"\x03":
627
+ raise KeyboardInterrupt
628
+ return b.decode("utf-8", errors="ignore")
629
+ finally:
630
+ if has_termios and old_settings is not None:
631
+ try:
632
+ termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
633
+ except Exception:
634
+ pass
635
+
636
+
637
+ def _interactive_arrow_select(title: str, options: list, default_index: int = 0) -> int:
638
+ """
639
+ Render an interactive Up/Down arrow selection menu in the terminal.
640
+ Allows navigating with Up/Down arrows (or j/k) and confirming with Enter.
641
+ """
642
+ import sys, time
643
+ selected = default_index
644
+ total = len(options)
645
+
646
+ # Hide cursor
647
+ sys.stdout.write("\x1b[?25l")
648
+ sys.stdout.flush()
649
+
650
+ first_render = True
651
+ num_rendered_lines = 0
652
+ try:
653
+ while True:
654
+ lines = []
655
+ lines.append(f"\x1b[1;33m? \x1b[1;37m{title}\x1b[0m")
656
+ for i, (name, desc) in enumerate(options):
657
+ if i == selected:
658
+ lines.append(f" \x1b[1;36m❯ {name:<10}\x1b[0m \x1b[2m— {desc}\x1b[0m")
659
+ else:
660
+ lines.append(f" \x1b[37m{name:<10}\x1b[0m \x1b[2m— {desc}\x1b[0m")
661
+ lines.append("\x1b[2m (Use ↑/↓ arrow keys to navigate, press Enter to select)\x1b[0m")
662
+
663
+ if not first_render:
664
+ sys.stdout.write(f"\r\x1b[{num_rendered_lines}A\x1b[J")
665
+
666
+ sys.stdout.write("\n".join(lines) + "\n")
667
+ sys.stdout.flush()
668
+ first_render = False
669
+ num_rendered_lines = len(lines)
670
+
671
+ key = _read_terminal_key()
672
+ if not key:
673
+ time.sleep(0.01)
674
+ continue
675
+
676
+ if key in ("up", "k", "w"):
677
+ selected = (selected - 1) % total
678
+ elif key in ("down", "j", "s"):
679
+ selected = (selected + 1) % total
680
+ elif key in ("enter", " "):
681
+ break
682
+ elif key.isdigit() and 1 <= int(key) <= total:
683
+ selected = int(key) - 1
684
+ break
685
+ elif key == "esc":
686
+ break
687
+
688
+ # Clear menu and print confirmation line
689
+ if num_rendered_lines > 0:
690
+ sys.stdout.write(f"\r\x1b[{num_rendered_lines}A\x1b[J")
691
+ chosen_name = options[selected][0]
692
+ sys.stdout.write(f"\x1b[1;32m✔\x1b[0m \x1b[1m{title}\x1b[0m \x1b[1;36m{chosen_name}\x1b[0m\n\n")
693
+ sys.stdout.flush()
694
+ return selected
695
+
696
+ finally:
697
+ sys.stdout.write("\x1b[?25h")
698
+ sys.stdout.flush()
699
+
700
+
539
701
  def prompt_website_framework_choice(task: str) -> str:
540
702
  """
541
- Prompt user via interactive terminal to choose their preferred tech stack:
703
+ Prompt user via interactive terminal using Up/Down arrow keys and Enter to select:
542
704
  1. Vanilla (Pure HTML5/CSS3/Vanilla JS)
543
705
  2. React.js
544
706
  3. Vue.js
@@ -550,49 +712,31 @@ def prompt_website_framework_choice(task: str) -> str:
550
712
  if not sys.stdin or not hasattr(sys.stdin, "isatty") or not sys.stdin.isatty():
551
713
  return f"{task} using Vanilla HTML5/CSS3/JavaScript"
552
714
 
715
+ framework_options = [
716
+ ("Vanilla", "Pure HTML5 + Modern CSS3 + Vanilla JS (Zero dependencies, instant browser load)"),
717
+ ("React.js", "Modern React component architecture with hooks & modular state"),
718
+ ("Vue.js", "Vue 3 Single Page Application with reactive Composition API"),
719
+ ("Angular", "Enterprise TypeScript framework with modular standalone components"),
720
+ ("Golang", "Go net/http server with HTML templates & REST API endpoints"),
721
+ ]
722
+
553
723
  try:
554
- from rich.console import Console
555
- from rich.panel import Panel
556
- from rich.table import Table
557
- console = Console()
558
- console.print()
559
-
560
- table = Table(show_header=False, box=None, padding=(0, 2))
561
- table.add_column("Key", style="bold cyan")
562
- table.add_column("Framework", style="bold white")
563
- table.add_column("Description", style="dim")
564
- table.add_row("1", "Vanilla", "Pure HTML5 + Modern CSS3 + Vanilla JS (Zero dependencies, instant browser load)")
565
- table.add_row("2", "React.js", "Modern React component architecture with hooks & modular state")
566
- table.add_row("3", "Vue.js", "Vue 3 Single Page Application with reactive Composition API")
567
- table.add_row("4", "Angular", "Enterprise TypeScript framework with modular standalone components")
568
- table.add_row("5", "Golang", "Go net/http server with HTML templates & REST API endpoints")
569
-
570
- console.print(Panel(
571
- table,
572
- title="[bold yellow]🌐 Select Website Tech Stack[/bold yellow]",
573
- subtitle="[dim]Choose 1-5 or framework name (default: 1 - Vanilla)[/dim]",
574
- border_style="cyan",
575
- ))
576
- choice = console.input("[bold green]Choose framework (1-5) ❯[/bold green] ").strip().lower()
724
+ idx = _interactive_arrow_select(
725
+ title="Which tech stack would you like to build your website with?",
726
+ options=framework_options,
727
+ default_index=0,
728
+ )
577
729
  except Exception:
578
- print("\n🌐 Select Website Tech Stack:")
579
- print(" 1. Vanilla (Pure HTML5 + Modern CSS3 + Vanilla JS)")
580
- print(" 2. React.js")
581
- print(" 3. Vue.js")
582
- print(" 4. Angular")
583
- print(" 5. Golang")
584
- try:
585
- choice = input("Choose framework (1-5) [1]: ").strip().lower()
586
- except Exception:
587
- choice = "1"
730
+ # Fallback to Vanilla if raw mode or termios fails
731
+ return f"{task} using Vanilla HTML5/CSS3/JavaScript"
588
732
 
589
- if choice in ("2", "react", "reactjs", "react.js"):
733
+ if idx == 1:
590
734
  return f"{task} using React.js"
591
- elif choice in ("3", "vue", "vuejs", "vue.js"):
735
+ elif idx == 2:
592
736
  return f"{task} using Vue.js"
593
- elif choice in ("4", "angular", "angularjs"):
737
+ elif idx == 3:
594
738
  return f"{task} using Angular"
595
- elif choice in ("5", "golang", "go"):
739
+ elif idx == 4:
596
740
  return f"{task} using Golang"
597
741
  else:
598
742
  return f"{task} using Vanilla HTML5/CSS3/JavaScript"
@@ -274,3 +274,126 @@ class TestDomainBlueprintsAndTheming:
274
274
  assert "main.go" in bp_go_web.target_files
275
275
  assert "templates/index.html" in bp_go_web.target_files
276
276
  assert "net/http" in bp_go_web.render_contract()
277
+
278
+ def test_interactive_arrow_selection_navigation(self, monkeypatch):
279
+ from codeagent.blueprints import _interactive_arrow_select
280
+
281
+ options = [
282
+ ("Vanilla", "HTML/CSS/JS"),
283
+ ("React.js", "React hooks"),
284
+ ("Vue.js", "Vue 3"),
285
+ ("Angular", "TypeScript"),
286
+ ("Golang", "Go net/http"),
287
+ ]
288
+
289
+ # Case 1: Press 'down' then 'enter' -> Selects index 1 (React.js)
290
+ key_seq = iter(["down", "enter"])
291
+ monkeypatch.setattr("codeagent.blueprints._read_terminal_key", lambda: next(key_seq))
292
+ idx = _interactive_arrow_select("Choose framework", options, default_index=0)
293
+ assert idx == 1
294
+
295
+ # Case 2: Press 'up' then 'enter' -> Wraps around to index 4 (Golang)
296
+ key_seq2 = iter(["up", "enter"])
297
+ monkeypatch.setattr("codeagent.blueprints._read_terminal_key", lambda: next(key_seq2))
298
+ idx2 = _interactive_arrow_select("Choose framework", options, default_index=0)
299
+ assert idx2 == 4
300
+
301
+ # Case 3: Press 'j' (vim down) then 'enter' -> Selects index 1 (React.js)
302
+ key_seq3 = iter(["j", "enter"])
303
+ monkeypatch.setattr("codeagent.blueprints._read_terminal_key", lambda: next(key_seq3))
304
+ idx3 = _interactive_arrow_select("Choose framework", options, default_index=0)
305
+ assert idx3 == 1
306
+
307
+ # Case 4: Press number key '3' -> Instantly selects index 2 (Vue.js)
308
+ key_seq4 = iter(["3"])
309
+ monkeypatch.setattr("codeagent.blueprints._read_terminal_key", lambda: next(key_seq4))
310
+ idx4 = _interactive_arrow_select("Choose framework", options, default_index=0)
311
+ assert idx4 == 2
312
+
313
+ def test_read_terminal_key_ansi_escape_parsing(self, monkeypatch):
314
+ import os
315
+ from codeagent.blueprints import _read_terminal_key
316
+
317
+ # Test ANSI sequences using real OS pipe descriptors
318
+ test_cases = [
319
+ (b"\x1b[A", "up"),
320
+ (b"\x1b[B", "down"),
321
+ (b"\x1bOA", "up"),
322
+ (b"\x1bOB", "down"),
323
+ (b"\r", "enter"),
324
+ (b"\n", "enter"),
325
+ (b" ", "enter"),
326
+ (b"k", "k"),
327
+ (b"j", "j"),
328
+ (b"2", "2"),
329
+ ]
330
+
331
+ for byte_seq, expected_key in test_cases:
332
+ r_fd, w_fd = os.pipe()
333
+ try:
334
+ os.write(w_fd, byte_seq)
335
+ # Mock sys.stdin.fileno() to return r_fd
336
+ monkeypatch.setattr("sys.stdin.fileno", lambda fd=r_fd: fd)
337
+ key = _read_terminal_key()
338
+ assert key == expected_key, f"Expected {expected_key} for {byte_seq}, got {key}"
339
+ finally:
340
+ os.close(r_fd)
341
+ os.close(w_fd)
342
+
343
+ def test_read_terminal_key_rapid_sequence(self, monkeypatch):
344
+ import os
345
+ from codeagent.blueprints import _read_terminal_key
346
+
347
+ r_fd, w_fd = os.pipe()
348
+ try:
349
+ # Write a stream of keys into the pipe all at once
350
+ os.write(w_fd, b"\x1b[B\x1b[B\x1b[A\r")
351
+ monkeypatch.setattr("sys.stdin.fileno", lambda fd=r_fd: fd)
352
+
353
+ k1 = _read_terminal_key()
354
+ k2 = _read_terminal_key()
355
+ k3 = _read_terminal_key()
356
+ k4 = _read_terminal_key()
357
+
358
+ assert k1 == "down"
359
+ assert k2 == "down"
360
+ assert k3 == "up"
361
+ assert k4 == "enter"
362
+ finally:
363
+ os.close(r_fd)
364
+ os.close(w_fd)
365
+
366
+ def test_interactive_arrow_select_real_pipe_stream(self, monkeypatch):
367
+ import os
368
+ from codeagent.blueprints import _interactive_arrow_select
369
+
370
+ options = [
371
+ ("Vanilla", "HTML/CSS/JS"),
372
+ ("React.js", "React hooks"),
373
+ ("Vue.js", "Vue 3"),
374
+ ("Angular", "TypeScript"),
375
+ ("Golang", "Go net/http"),
376
+ ]
377
+
378
+ r_fd, w_fd = os.pipe()
379
+ try:
380
+ # Send Down twice then Enter via pipe stream
381
+ os.write(w_fd, b"\x1b[B\x1b[B\r")
382
+ monkeypatch.setattr("sys.stdin.fileno", lambda fd=r_fd: fd)
383
+ idx = _interactive_arrow_select("Choose framework", options, default_index=0)
384
+ # 0 -> 1 -> 2 (Vue.js)
385
+ assert idx == 2
386
+ finally:
387
+ os.close(r_fd)
388
+ os.close(w_fd)
389
+
390
+ # Test Up arrow wraparound via real pipe: 0 -> 4 (Golang)
391
+ r_fd2, w_fd2 = os.pipe()
392
+ try:
393
+ os.write(w_fd2, b"\x1b[A\r")
394
+ monkeypatch.setattr("sys.stdin.fileno", lambda fd=r_fd2: fd)
395
+ idx2 = _interactive_arrow_select("Choose framework", options, default_index=0)
396
+ assert idx2 == 4
397
+ finally:
398
+ os.close(r_fd2)
399
+ os.close(w_fd2)
File without changes
File without changes