alpiecode 10.9.7__tar.gz → 10.9.8__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 (139) hide show
  1. {alpiecode-10.9.7 → alpiecode-10.9.8}/PKG-INFO +1 -1
  2. {alpiecode-10.9.7 → alpiecode-10.9.8}/pyproject.toml +1 -1
  3. {alpiecode-10.9.7 → alpiecode-10.9.8}/setup.py +5 -4
  4. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/alpiecode.egg-info/PKG-INFO +1 -1
  5. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/alpiecode.egg-info/SOURCES.txt +1 -0
  6. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/__init__.py +1 -1
  7. alpiecode-10.9.8/src/codeagent/__main__.py +9 -0
  8. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/onboarding.py +199 -73
  9. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_onboarding.py +71 -39
  10. {alpiecode-10.9.7 → alpiecode-10.9.8}/README.md +0 -0
  11. {alpiecode-10.9.7 → alpiecode-10.9.8}/setup.cfg +0 -0
  12. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/alpiecode/__init__.py +0 -0
  13. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/alpiecode.egg-info/dependency_links.txt +0 -0
  14. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/alpiecode.egg-info/entry_points.txt +0 -0
  15. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/alpiecode.egg-info/requires.txt +0 -0
  16. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/alpiecode.egg-info/top_level.txt +0 -0
  17. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/agent.py +0 -0
  18. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/assessment.py +0 -0
  19. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/backends/__init__.py +0 -0
  20. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/backends/base.py +0 -0
  21. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/backends/local_backend.py +0 -0
  22. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/backends/openai_backend.py +0 -0
  23. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/blueprints.py +0 -0
  24. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/cache.py +0 -0
  25. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/cli.py +0 -0
  26. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/client.py +0 -0
  27. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/compaction.py +0 -0
  28. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/config.py +0 -0
  29. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/context.py +0 -0
  30. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/diff_preview.py +0 -0
  31. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/discovery.py +0 -0
  32. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/doctor.py +0 -0
  33. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/dream_rsi.py +0 -0
  34. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/executor.py +0 -0
  35. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/git_ops.py +0 -0
  36. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/github.py +0 -0
  37. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/guardian.py +0 -0
  38. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/guardrails.py +0 -0
  39. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/ipython_ext.py +0 -0
  40. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/local_model.py +0 -0
  41. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/media.py +0 -0
  42. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/memory.py +0 -0
  43. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/metrics.py +0 -0
  44. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/orchestrator.py +0 -0
  45. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/paths.py +0 -0
  46. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/progress.py +0 -0
  47. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/project_template.py +0 -0
  48. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/prompt.py +0 -0
  49. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/rephraser.py +0 -0
  50. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/server.py +0 -0
  51. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/session.py +0 -0
  52. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/accessibility-audit/SKILL.md +0 -0
  53. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/accessibility-testing/SKILL.md +0 -0
  54. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/accessibility-ui-components/SKILL.md +0 -0
  55. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/agentic-workflows/SKILL.md +0 -0
  56. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/api-design/SKILL.md +0 -0
  57. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/architecture-design/SKILL.md +0 -0
  58. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/backend-engineering/SKILL.md +0 -0
  59. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/browser-automation/SKILL.md +0 -0
  60. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/cli-development/SKILL.md +0 -0
  61. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/cloud-infrastructure/SKILL.md +0 -0
  62. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/code-generation/SKILL.md +0 -0
  63. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/code-review/SKILL.md +0 -0
  64. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/codebase-onboarding/SKILL.md +0 -0
  65. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/cost-optimization/SKILL.md +0 -0
  66. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/data-analysis/SKILL.md +0 -0
  67. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/data-engineering/SKILL.md +0 -0
  68. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/database-engineering/SKILL.md +0 -0
  69. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/dependency-management/SKILL.md +0 -0
  70. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/dependency-security/SKILL.md +0 -0
  71. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/dependency-upgrades/SKILL.md +0 -0
  72. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/devops-ci-cd/SKILL.md +0 -0
  73. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/docker-containers/SKILL.md +0 -0
  74. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/documentation/SKILL.md +0 -0
  75. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/documentation-site/SKILL.md +0 -0
  76. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/e2e-testing/SKILL.md +0 -0
  77. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/error-handling-resilience/SKILL.md +0 -0
  78. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/feature-development/SKILL.md +0 -0
  79. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/frontend-engineering/SKILL.md +0 -0
  80. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/git-workflow/SKILL.md +0 -0
  81. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/incident-response/SKILL.md +0 -0
  82. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/legacy-code-modernization/SKILL.md +0 -0
  83. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/llm-application-engineering/SKILL.md +0 -0
  84. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/localization-i18n/SKILL.md +0 -0
  85. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/mcp-server-development/SKILL.md +0 -0
  86. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/migration-engineering/SKILL.md +0 -0
  87. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/mobile-development/SKILL.md +0 -0
  88. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/model-evaluation/SKILL.md +0 -0
  89. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/nodejs-services/SKILL.md +0 -0
  90. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/observability/SKILL.md +0 -0
  91. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/performance-optimization/SKILL.md +0 -0
  92. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/privacy-data-protection/SKILL.md +0 -0
  93. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/prompt-engineering/SKILL.md +0 -0
  94. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/python-engineering/SKILL.md +0 -0
  95. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/rag-retrieval/SKILL.md +0 -0
  96. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/react-engineering/SKILL.md +0 -0
  97. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/release-management/SKILL.md +0 -0
  98. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/requirements-analysis/SKILL.md +0 -0
  99. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/responsive-design/SKILL.md +0 -0
  100. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/safe-refactoring/SKILL.md +0 -0
  101. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/secure-coding/SKILL.md +0 -0
  102. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/systematic-debugging/SKILL.md +0 -0
  103. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/technical-planning/SKILL.md +0 -0
  104. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/technical-research/SKILL.md +0 -0
  105. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/technical-writing/SKILL.md +0 -0
  106. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/test-engineering/SKILL.md +0 -0
  107. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/tool-integration/SKILL.md +0 -0
  108. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/typescript-engineering/SKILL.md +0 -0
  109. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/visual-regression-testing/SKILL.md +0 -0
  110. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/web-performance/SKILL.md +0 -0
  111. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/web-security-testing/SKILL.md +0 -0
  112. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills/workflow-automation/SKILL.md +0 -0
  113. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/skills.py +0 -0
  114. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/slash.py +0 -0
  115. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/subagent.py +0 -0
  116. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/system1.py +0 -0
  117. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/tools.py +0 -0
  118. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/updater.py +0 -0
  119. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/verifier.py +0 -0
  120. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/vscode_installer.py +0 -0
  121. {alpiecode-10.9.7 → alpiecode-10.9.8}/src/codeagent/walkthrough.py +0 -0
  122. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_adaptive_resilience.py +0 -0
  123. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_cli_ui.py +0 -0
  124. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_context_and_trajectory.py +0 -0
  125. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_deloop_and_sessions.py +0 -0
  126. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_dream_rsi.py +0 -0
  127. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_gpu_detection.py +0 -0
  128. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_lifecycle_and_portfolio.py +0 -0
  129. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_local_model_download.py +0 -0
  130. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_non_thinking_and_local_stream.py +0 -0
  131. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_project_templates.py +0 -0
  132. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_skills_engine.py +0 -0
  133. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_slash_and_diff.py +0 -0
  134. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_subagents.py +0 -0
  135. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_task_assessment.py +0 -0
  136. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_truncation_resilience.py +0 -0
  137. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_verifier.py +0 -0
  138. {alpiecode-10.9.7 → alpiecode-10.9.8}/test/test_walkthrough.py +0 -0
  139. {alpiecode-10.9.7 → alpiecode-10.9.8}/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.7
3
+ Version: 10.9.8
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.7"
7
+ version = "10.9.8"
8
8
  description = "AlpieCode"
9
9
  requires-python = ">=3.9"
10
10
  dependencies = [
@@ -11,11 +11,12 @@ from setuptools.command.develop import develop
11
11
 
12
12
 
13
13
  def _run_post_install():
14
- # Only run onboarding if executed in an interactive terminal session
14
+ # Only run onboarding if executed in an interactive terminal session and not CI/upgrade
15
15
  try:
16
- if sys.stdin and getattr(sys.stdin, "isatty", lambda: False)() and \
17
- sys.stdout and getattr(sys.stdout, "isatty", lambda: False)():
18
- from codeagent.onboarding import prompt_local_model_onboarding
16
+ if any(os.environ.get(k) == "1" for k in ("CI", "CONTINUOUS_INTEGRATION", "ALPIECODE_NO_ONBOARDING")):
17
+ return
18
+ from codeagent.onboarding import prompt_local_model_onboarding, is_fresh_installation
19
+ if is_fresh_installation():
19
20
  prompt_local_model_onboarding()
20
21
  except Exception:
21
22
  pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alpiecode
3
- Version: 10.9.7
3
+ Version: 10.9.8
4
4
  Summary: AlpieCode
5
5
  Requires-Python: >=3.9
6
6
  Requires-Dist: huggingface_hub>=0.20.0
@@ -9,6 +9,7 @@ src/alpiecode.egg-info/entry_points.txt
9
9
  src/alpiecode.egg-info/requires.txt
10
10
  src/alpiecode.egg-info/top_level.txt
11
11
  src/codeagent/__init__.py
12
+ src/codeagent/__main__.py
12
13
  src/codeagent/agent.py
13
14
  src/codeagent/assessment.py
14
15
  src/codeagent/blueprints.py
@@ -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.7"
20
+ __version__ = "10.9.8"
21
21
 
22
22
  def run(task: str, workdir: str = ".", reasoning_level: str = "thinking", **kwargs):
23
23
  """Run an autonomous coding task programmatically."""
@@ -0,0 +1,9 @@
1
+ """
2
+ Entrypoint for `python -m codeagent`
3
+ """
4
+
5
+ import sys
6
+ from codeagent.cli import main
7
+
8
+ if __name__ == "__main__":
9
+ main()
@@ -3,7 +3,7 @@ Onboarding service for AlpieCode.
3
3
 
4
4
  Provides a cross-platform, glitch-free interactive terminal UI for fresh installations.
5
5
  Prompts new users to optionally download the local GGUF model for 100% offline usage.
6
- Bypassed on upgrades (when config or sessions already exist).
6
+ Bypassed on upgrades (pip install --upgrade) and when onboarding has already been completed.
7
7
  """
8
8
 
9
9
  import os
@@ -11,6 +11,7 @@ import sys
11
11
  import json
12
12
  import time
13
13
  import shutil
14
+ import hashlib
14
15
  import platform
15
16
  from pathlib import Path
16
17
  from typing import Optional, List, Tuple
@@ -29,76 +30,137 @@ def _get_marker_dir() -> Path:
29
30
 
30
31
 
31
32
  def _get_installation_marker_path() -> Path:
32
- """Return the path to the installation setup marker file."""
33
+ """Return the path to the legacy global installation marker file."""
33
34
  return _get_marker_dir() / ".installation_setup"
34
35
 
35
36
 
37
+ def _get_env_id() -> str:
38
+ """Return a unique, stable hash identifier for the current Python environment prefix."""
39
+ prefix = os.path.abspath(sys.prefix)
40
+ return hashlib.sha256(prefix.encode("utf-8")).hexdigest()[:16]
41
+
42
+
43
+ def _get_env_marker_path() -> Path:
44
+ """Return path to environment-local marker inside sys.prefix."""
45
+ return Path(sys.prefix) / ".alpiecode_install_state.json"
46
+
47
+
48
+ def _get_registry_path() -> Path:
49
+ """Return path to central environments registry (~/.alpiecode/environments.json)."""
50
+ return _get_marker_dir() / "environments.json"
51
+
52
+
36
53
  def is_fresh_installation() -> bool:
37
54
  """
38
- Detect whether this is a fresh installation or an existing user / upgrade.
39
- Returns True ONLY if no configuration, marker, models, or sessions exist.
55
+ Detect whether this is a fresh installation for the current environment or an upgrade / existing install.
56
+ Returns True for fresh installations in new environments or fresh user machines.
57
+ Returns False on upgrades (pip install --upgrade) or after onboarding has already completed.
40
58
  """
41
- # Respect explicit environment bypass (CI runners, headless containers, tests)
59
+ # 1. Respect explicit environment bypass (CI runners, headless containers, tests)
42
60
  if any(os.environ.get(k) == "1" for k in ("ALPIECODE_NO_ONBOARDING", "CI", "CONTINUOUS_INTEGRATION")):
43
61
  return False
44
62
 
45
- marker_path = _get_installation_marker_path()
46
- if marker_path.exists():
47
- return False
63
+ from . import __version__ as current_version
64
+ env_id = _get_env_id()
48
65
 
49
- # Check for existing global config (~/.alpiecode/config.json)
50
- try:
51
- home_cfg = Path.home() / ".alpiecode" / "config.json"
52
- if home_cfg.exists():
53
- return False
54
- except Exception:
55
- pass
66
+ # 2. Check environment-local marker (inside sys.prefix)
67
+ env_marker = _get_env_marker_path()
68
+ if env_marker.exists():
69
+ try:
70
+ data = json.loads(env_marker.read_text(encoding="utf-8"))
71
+ if data.get("onboarding_completed"):
72
+ # If an upgrade occurred in this environment, record the upgrade and bypass prompt
73
+ if data.get("version") != current_version:
74
+ data["version"] = current_version
75
+ data["upgraded_at"] = int(time.time())
76
+ try:
77
+ env_marker.write_text(json.dumps(data, indent=2), encoding="utf-8")
78
+ except Exception:
79
+ pass
80
+ return False
81
+ except Exception:
82
+ pass
56
83
 
57
- # Check for working directory config (.alpiecode/config.json)
58
- try:
59
- local_cfg = get_alpiecode_dir() / "config.json"
60
- if local_cfg.exists():
84
+ # 3. Check central environments registry (~/.alpiecode/environments.json)
85
+ reg_path = _get_registry_path()
86
+ if reg_path.exists():
87
+ try:
88
+ registry = json.loads(reg_path.read_text(encoding="utf-8"))
89
+ if env_id in registry:
90
+ record = registry[env_id]
91
+ if record.get("onboarding_completed"):
92
+ if record.get("version") != current_version:
93
+ record["version"] = current_version
94
+ record["upgraded_at"] = int(time.time())
95
+ try:
96
+ reg_path.write_text(json.dumps(registry, indent=2), encoding="utf-8")
97
+ except Exception:
98
+ pass
99
+ return False
100
+ except Exception:
101
+ pass
102
+
103
+ # 4. If running in global system Python (sys.prefix == sys.base_prefix), check global state
104
+ is_virtualenv = sys.prefix != getattr(sys, "base_prefix", sys.prefix)
105
+ if not is_virtualenv:
106
+ legacy_marker = _get_installation_marker_path()
107
+ if legacy_marker.exists():
61
108
  return False
62
- except Exception:
63
- pass
109
+ try:
110
+ home_cfg = Path.home() / ".alpiecode" / "config.json"
111
+ if home_cfg.exists():
112
+ return False
113
+ except Exception:
114
+ pass
115
+
116
+ # New environment or clean system: this is a fresh installation!
117
+ return True
118
+
64
119
 
65
- # Check if local models are already present on disk
120
+ def mark_onboarding_completed(download_local: bool = False) -> None:
121
+ """Record completion of onboarding so the prompt is never shown again in this environment."""
122
+ from . import __version__
123
+ env_id = _get_env_id()
124
+ data = {
125
+ "prefix": sys.prefix,
126
+ "env_id": env_id,
127
+ "version": __version__,
128
+ "timestamp": int(time.time()),
129
+ "onboarding_completed": True,
130
+ "local_model_requested": download_local,
131
+ }
132
+
133
+ # 1. Environment-local marker
66
134
  try:
67
- models_dir = Path.home() / ".alpiecode" / "models"
68
- if models_dir.exists() and list(models_dir.glob("*.gguf")):
69
- return False
135
+ env_marker = _get_env_marker_path()
136
+ env_marker.write_text(json.dumps(data, indent=2), encoding="utf-8")
70
137
  except Exception:
71
138
  pass
72
139
 
73
- # Check if prior sessions exist
140
+ # 2. Central registry (~/.alpiecode/environments.json)
74
141
  try:
75
- sess_dir = Path.home() / ".alpiecode" / "sessions"
76
- if sess_dir.exists() and list(sess_dir.glob("*.json")):
77
- return False
142
+ reg_dir = ensure_dir(_get_marker_dir())
143
+ reg_path = _get_registry_path()
144
+ registry = {}
145
+ if reg_path.exists():
146
+ try:
147
+ registry = json.loads(reg_path.read_text(encoding="utf-8"))
148
+ except Exception:
149
+ registry = {}
150
+ registry[env_id] = data
151
+ reg_path.write_text(json.dumps(registry, indent=2), encoding="utf-8")
78
152
  except Exception:
79
153
  pass
80
154
 
81
- return True
82
-
83
-
84
- def mark_onboarding_completed(download_local: bool = False) -> None:
85
- """Record completion of onboarding so the prompt is never shown again."""
86
- marker_dir = ensure_dir(_get_marker_dir())
87
- marker_path = marker_dir / ".installation_setup"
155
+ # 3. Global marker for backwards compatibility
88
156
  try:
89
- from . import __version__
90
- data = {
91
- "version": __version__,
92
- "timestamp": int(time.time()),
93
- "onboarding_completed": True,
94
- "local_model_requested": download_local,
95
- }
157
+ marker_path = _get_installation_marker_path()
96
158
  marker_path.write_text(json.dumps(data, indent=2), encoding="utf-8")
97
159
  except Exception:
98
160
  pass
99
161
 
100
162
 
101
- def _read_terminal_key() -> str:
163
+ def _read_terminal_key(in_file=None) -> str:
102
164
  """
103
165
  Read a single keypress or ANSI escape sequence from the terminal across Windows, Linux, macOS.
104
166
  Returns: 'up', 'down', 'enter', 'esc', or character string.
@@ -119,10 +181,20 @@ def _read_terminal_key() -> str:
119
181
  elif b2 == b"M":
120
182
  return "right"
121
183
  return ""
122
- elif b in (b"\r", b"\n", b" "):
123
- return "enter"
124
184
  elif b == b"\x1b":
185
+ # Check for Windows Terminal / ConPTY ANSI escape sequences (e.g. \x1b[A)
186
+ if msvcrt.kbhit():
187
+ b2 = msvcrt.getch()
188
+ if b2 in (b"[", b"O"):
189
+ if msvcrt.kbhit():
190
+ b3 = msvcrt.getch()
191
+ if b3 in (b"A", b"a"):
192
+ return "up"
193
+ elif b3 in (b"B", b"b"):
194
+ return "down"
125
195
  return "esc"
196
+ elif b in (b"\r", b"\n", b" "):
197
+ return "enter"
126
198
  elif b == b"\x03":
127
199
  raise KeyboardInterrupt
128
200
  return b.decode("utf-8", errors="ignore")
@@ -135,8 +207,16 @@ def _read_terminal_key() -> str:
135
207
  import termios
136
208
  import select
137
209
 
210
+ close_fd = False
138
211
  try:
139
- fd = sys.stdin.fileno()
212
+ if in_file is not None:
213
+ fd = in_file.fileno()
214
+ elif sys.stdin and getattr(sys.stdin, "isatty", lambda: False)():
215
+ fd = sys.stdin.fileno()
216
+ else:
217
+ tty_f = open("/dev/tty", "r+b", buffering=0)
218
+ fd = tty_f.fileno()
219
+ close_fd = True
140
220
  except Exception:
141
221
  return ""
142
222
 
@@ -190,9 +270,19 @@ def _read_terminal_key() -> str:
190
270
  termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
191
271
  except Exception:
192
272
  pass
273
+ if close_fd:
274
+ try:
275
+ os.close(fd)
276
+ except Exception:
277
+ pass
193
278
 
194
279
 
195
- def _interactive_yes_no_select(title: str, options: List[Tuple[str, str]], default_index: int = 0) -> int:
280
+ def _interactive_yes_no_select(
281
+ title: str,
282
+ options: List[Tuple[str, str]],
283
+ default_index: int = 0,
284
+ out_stream=None,
285
+ ) -> int:
196
286
  """
197
287
  Render an interactive Up/Down arrow selection menu in the terminal.
198
288
  Guarantees no multi-occurrence or line-wrapping glitches across all platforms.
@@ -200,18 +290,30 @@ def _interactive_yes_no_select(title: str, options: List[Tuple[str, str]], defau
200
290
  selected = default_index
201
291
  total = len(options)
202
292
 
203
- stdin_tty = getattr(sys.stdin, "isatty", lambda: False)()
204
- stdout_tty = getattr(sys.stdout, "isatty", lambda: False)()
293
+ # Determine output stream
294
+ out = out_stream or sys.stdout
295
+ if not getattr(out, "isatty", lambda: False)():
296
+ if platform.system() != "Windows":
297
+ try:
298
+ out = open("/dev/tty", "w", encoding="utf-8")
299
+ except Exception:
300
+ pass
301
+ else:
302
+ try:
303
+ out = open("CONOUT$", "w", encoding="utf-8")
304
+ except Exception:
305
+ pass
205
306
 
206
307
  # Check if mocked for testing
207
308
  from . import onboarding as _ob
208
309
  is_mocked = getattr(_ob._read_terminal_key, "__name__", "") != "_read_terminal_key"
209
310
  fileno_mocked = hasattr(sys.stdin, "fileno") and getattr(sys.stdin.fileno, "__name__", "") == "<lambda>"
311
+ out_tty = getattr(out, "isatty", lambda: False)()
210
312
 
211
- if (not stdin_tty or not stdout_tty) and not (is_mocked or fileno_mocked):
313
+ if not out_tty and not (is_mocked or fileno_mocked):
212
314
  chosen_name = options[default_index][0]
213
- sys.stdout.write(f"\x1b[1;32m✔\x1b[0m \x1b[1m{title}\x1b[0m \x1b[1;36m{chosen_name}\x1b[0m\n\n")
214
- sys.stdout.flush()
315
+ out.write(f"\x1b[1;32m✔\x1b[0m \x1b[1m{title}\x1b[0m \x1b[1;36m{chosen_name}\x1b[0m\n\n")
316
+ out.flush()
215
317
  return default_index
216
318
 
217
319
  # Setup terminal VT100 & UTF-8
@@ -222,8 +324,8 @@ def _interactive_yes_no_select(title: str, options: List[Tuple[str, str]], defau
222
324
 
223
325
  # Hide cursor safely
224
326
  try:
225
- sys.stdout.write("\x1b[?25l")
226
- sys.stdout.flush()
327
+ out.write("\x1b[?25l")
328
+ out.flush()
227
329
  except Exception:
228
330
  pass
229
331
 
@@ -234,23 +336,34 @@ def _interactive_yes_no_select(title: str, options: List[Tuple[str, str]], defau
234
336
  try:
235
337
  while True:
236
338
  term_cols = shutil.get_terminal_size((80, 24)).columns
339
+ safe_cols = max(40, term_cols - 2)
340
+
237
341
  lines = []
342
+ title_line = f"? {title}"
343
+ if len(title_line) > safe_cols:
344
+ title_line = title_line[:safe_cols - 3] + "..."
238
345
  lines.append(f"\x1b[1;33m? \x1b[1;37m{title}\x1b[0m")
346
+
239
347
  for i, (name, desc) in enumerate(options):
240
- max_desc_len = max(20, term_cols - len(name) - 18)
241
- clean_desc = desc if len(desc) <= max_desc_len else (desc[:max_desc_len - 3].rstrip() + "...")
348
+ prefix = f"❯ {name:<4}" if i == selected else f" {name:<4}"
349
+ max_desc = max(15, safe_cols - len(prefix) - 6)
350
+ clean_desc = desc if len(desc) <= max_desc else (desc[:max_desc - 3].rstrip() + "...")
242
351
  if i == selected:
243
- lines.append(f" \x1b[1;36m❯ {name:<6}\x1b[0m \x1b[2m— {clean_desc}\x1b[0m")
352
+ lines.append(f" \x1b[1;36m❯ {name:<4}\x1b[0m \x1b[2m— {clean_desc}\x1b[0m")
244
353
  else:
245
- lines.append(f" \x1b[37m{name:<6}\x1b[0m \x1b[2m— {clean_desc}\x1b[0m")
246
- lines.append("\x1b[2m (Use ↑/↓ arrow keys to navigate, press Enter to select)\x1b[0m")
354
+ lines.append(f" \x1b[37m{name:<4}\x1b[0m \x1b[2m— {clean_desc}\x1b[0m")
247
355
 
248
- # Redraw cleanly by moving cursor up and clearing downstream content
249
- if not first_render:
250
- sys.stdout.write(f"\r\x1b[{num_rendered_lines}A\x1b[0J")
356
+ hint = " (Use ↑/↓ arrows or 1/2 to navigate, press Enter to select)"
357
+ if len(hint) > safe_cols:
358
+ hint = hint[:safe_cols - 3] + "..."
359
+ lines.append(f"\x1b[2m{hint}\x1b[0m")
251
360
 
252
- sys.stdout.write("\n".join(lines) + "\n")
253
- sys.stdout.flush()
361
+ # Redraw cleanly: move cursor up and clear downstream content
362
+ if not first_render and num_rendered_lines > 0:
363
+ out.write(f"\r\x1b[{num_rendered_lines}A\x1b[0J")
364
+
365
+ out.write("\n".join(lines) + "\n")
366
+ out.flush()
254
367
  first_render = False
255
368
  num_rendered_lines = len(lines)
256
369
 
@@ -286,16 +399,16 @@ def _interactive_yes_no_select(title: str, options: List[Tuple[str, str]], defau
286
399
 
287
400
  # Clear menu and replace with a single, clean confirmation line
288
401
  if num_rendered_lines > 0:
289
- sys.stdout.write(f"\r\x1b[{num_rendered_lines}A\x1b[0J")
402
+ out.write(f"\r\x1b[{num_rendered_lines}A\x1b[0J")
290
403
  chosen_name = options[selected][0]
291
- sys.stdout.write(f"\x1b[1;32m✔\x1b[0m \x1b[1m{title}\x1b[0m \x1b[1;36m{chosen_name}\x1b[0m\n\n")
292
- sys.stdout.flush()
404
+ out.write(f"\x1b[1;32m✔\x1b[0m \x1b[1m{title}\x1b[0m \x1b[1;36m{chosen_name}\x1b[0m\n\n")
405
+ out.flush()
293
406
  return selected
294
407
  finally:
295
408
  # Restore cursor visibility
296
409
  try:
297
- sys.stdout.write("\x1b[?25h")
298
- sys.stdout.flush()
410
+ out.write("\x1b[?25h")
411
+ out.flush()
299
412
  except Exception:
300
413
  pass
301
414
 
@@ -316,9 +429,22 @@ def prompt_local_model_onboarding(force: bool = False) -> bool:
316
429
  is_mocked = getattr(_ob._read_terminal_key, "__name__", "") != "_read_terminal_key"
317
430
  fileno_mocked = hasattr(sys.stdin, "fileno") and getattr(sys.stdin.fileno, "__name__", "") == "<lambda>"
318
431
 
319
- # Non-interactive fallback: skip gracefully and mark complete
320
- if not (stdin_tty and stdout_tty) and not (is_mocked or fileno_mocked):
321
- mark_onboarding_completed(download_local=False)
432
+ has_controlling_terminal = False
433
+ if platform.system() == "Windows":
434
+ try:
435
+ import msvcrt
436
+ has_controlling_terminal = True
437
+ except Exception:
438
+ has_controlling_terminal = False
439
+ else:
440
+ try:
441
+ with open("/dev/tty", "r") as tty_chk:
442
+ has_controlling_terminal = tty_chk.isatty()
443
+ except Exception:
444
+ has_controlling_terminal = False
445
+
446
+ # Non-interactive bypass: if headless / piped, do not block and do NOT falsely record completion
447
+ if not (stdin_tty or has_controlling_terminal) and not (is_mocked or fileno_mocked):
322
448
  return False
323
449
 
324
450
  # Render header banner
@@ -11,18 +11,23 @@ from codeagent.onboarding import (
11
11
  _interactive_yes_no_select,
12
12
  prompt_local_model_onboarding,
13
13
  _get_installation_marker_path,
14
+ _get_env_marker_path,
15
+ _get_registry_path,
14
16
  )
15
17
 
16
18
 
17
19
  class TestOnboardingFreshInstallDetection:
18
- """Test detection of fresh install vs upgrade."""
20
+ """Test detection of fresh install vs upgrade across environments."""
19
21
 
20
22
  def test_fresh_install_true_when_clean_environment(self, tmp_path, monkeypatch):
21
23
  fake_home = tmp_path / "home"
22
24
  fake_alpie = fake_home / ".alpiecode"
23
25
  fake_alpie.mkdir(parents=True)
26
+ fake_env = tmp_path / "venv"
27
+ fake_env.mkdir(parents=True)
24
28
 
25
29
  monkeypatch.setattr(Path, "home", lambda: fake_home)
30
+ monkeypatch.setattr(sys, "prefix", str(fake_env))
26
31
  monkeypatch.setattr("codeagent.onboarding.get_alpiecode_dir", lambda: fake_alpie)
27
32
  monkeypatch.delenv("CI", raising=False)
28
33
  monkeypatch.delenv("CONTINUOUS_INTEGRATION", raising=False)
@@ -30,59 +35,92 @@ class TestOnboardingFreshInstallDetection:
30
35
 
31
36
  assert is_fresh_installation() is True
32
37
 
33
- def test_fresh_install_false_on_upgrade_when_config_exists(self, tmp_path, monkeypatch):
38
+ def test_fresh_install_true_in_new_venv_even_if_global_home_has_config(self, tmp_path, monkeypatch):
39
+ """A user creating a new virtual environment should be prompted even if ~/.alpiecode had old files."""
34
40
  fake_home = tmp_path / "home"
35
41
  fake_alpie = fake_home / ".alpiecode"
36
42
  fake_alpie.mkdir(parents=True)
37
43
  (fake_alpie / "config.json").write_text("{}", encoding="utf-8")
44
+ (fake_alpie / ".installation_setup").write_text("{}", encoding="utf-8")
45
+
46
+ fake_env = tmp_path / "new_venv"
47
+ fake_env.mkdir(parents=True)
38
48
 
39
49
  monkeypatch.setattr(Path, "home", lambda: fake_home)
50
+ monkeypatch.setattr(sys, "prefix", str(fake_env))
51
+ monkeypatch.setattr(sys, "base_prefix", str(tmp_path / "system_python"))
40
52
  monkeypatch.setattr("codeagent.onboarding.get_alpiecode_dir", lambda: fake_alpie)
53
+ monkeypatch.delenv("CI", raising=False)
54
+ monkeypatch.delenv("CONTINUOUS_INTEGRATION", raising=False)
55
+ monkeypatch.delenv("ALPIECODE_NO_ONBOARDING", raising=False)
41
56
 
42
- # Existing config means this is an existing user or upgrade
43
- assert is_fresh_installation() is False
57
+ # In this new venv, onboarding has not been done yet!
58
+ assert is_fresh_installation() is True
44
59
 
45
- def test_fresh_install_false_when_marker_exists(self, tmp_path, monkeypatch):
60
+ def test_fresh_install_false_when_onboarding_completed_in_env(self, tmp_path, monkeypatch):
46
61
  fake_home = tmp_path / "home"
47
62
  fake_alpie = fake_home / ".alpiecode"
48
63
  fake_alpie.mkdir(parents=True)
49
- (fake_alpie / ".installation_setup").write_text("{}", encoding="utf-8")
64
+ fake_env = tmp_path / "venv"
65
+ fake_env.mkdir(parents=True)
50
66
 
51
67
  monkeypatch.setattr(Path, "home", lambda: fake_home)
68
+ monkeypatch.setattr(sys, "prefix", str(fake_env))
52
69
  monkeypatch.setattr("codeagent.onboarding.get_alpiecode_dir", lambda: fake_alpie)
70
+ monkeypatch.delenv("CI", raising=False)
53
71
 
72
+ mark_onboarding_completed(download_local=False)
54
73
  assert is_fresh_installation() is False
55
74
 
56
- def test_fresh_install_false_when_models_present(self, tmp_path, monkeypatch):
75
+ def test_upgrade_in_same_environment_does_not_prompt(self, tmp_path, monkeypatch):
76
+ """Simulate `pip install --upgrade` in an existing environment."""
57
77
  fake_home = tmp_path / "home"
58
- fake_models = fake_home / ".alpiecode" / "models"
59
- fake_models.mkdir(parents=True)
60
- (fake_models / "model.gguf").write_text("model_bytes", encoding="utf-8")
78
+ fake_alpie = fake_home / ".alpiecode"
79
+ fake_alpie.mkdir(parents=True)
80
+ fake_env = tmp_path / "venv"
81
+ fake_env.mkdir(parents=True)
61
82
 
62
83
  monkeypatch.setattr(Path, "home", lambda: fake_home)
63
- monkeypatch.setattr("codeagent.onboarding.get_alpiecode_dir", lambda: fake_home / ".alpiecode")
84
+ monkeypatch.setattr(sys, "prefix", str(fake_env))
85
+ monkeypatch.setattr("codeagent.onboarding.get_alpiecode_dir", lambda: fake_alpie)
86
+ monkeypatch.delenv("CI", raising=False)
87
+
88
+ # Mark onboarding as previously completed on an older version
89
+ marker_file = fake_env / ".alpiecode_install_state.json"
90
+ marker_file.write_text(json.dumps({
91
+ "version": "10.0.0",
92
+ "onboarding_completed": True,
93
+ "local_model_requested": False,
94
+ }), encoding="utf-8")
64
95
 
96
+ # An upgrade to current version (10.9.x) must NOT prompt
65
97
  assert is_fresh_installation() is False
66
98
 
67
- def test_fresh_install_bypassed_by_ci_environment(self, tmp_path, monkeypatch):
99
+ # It should also automatically update the recorded version in the marker
100
+ updated = json.loads(marker_file.read_text(encoding="utf-8"))
101
+ assert updated.get("upgraded_at") is not None
102
+
103
+ def test_fresh_install_false_on_global_upgrade_when_config_exists(self, tmp_path, monkeypatch):
68
104
  fake_home = tmp_path / "home"
105
+ fake_alpie = fake_home / ".alpiecode"
106
+ fake_alpie.mkdir(parents=True)
107
+ (fake_alpie / "config.json").write_text("{}", encoding="utf-8")
108
+
109
+ # Global python environment (sys.prefix == sys.base_prefix)
110
+ sys_py = str(tmp_path / "system_python")
111
+ monkeypatch.setattr(sys, "prefix", sys_py)
112
+ monkeypatch.setattr(sys, "base_prefix", sys_py)
69
113
  monkeypatch.setattr(Path, "home", lambda: fake_home)
70
- monkeypatch.setenv("CI", "1")
114
+ monkeypatch.setattr("codeagent.onboarding.get_alpiecode_dir", lambda: fake_alpie)
71
115
 
72
116
  assert is_fresh_installation() is False
73
117
 
74
- def test_mark_onboarding_completed_creates_marker(self, tmp_path, monkeypatch):
118
+ def test_fresh_install_bypassed_by_ci_environment(self, tmp_path, monkeypatch):
75
119
  fake_home = tmp_path / "home"
76
- fake_alpie = fake_home / ".alpiecode"
77
120
  monkeypatch.setattr(Path, "home", lambda: fake_home)
78
- monkeypatch.setattr("codeagent.onboarding.get_alpiecode_dir", lambda: fake_alpie)
121
+ monkeypatch.setenv("CI", "1")
79
122
 
80
- mark_onboarding_completed(download_local=False)
81
- marker = fake_alpie / ".installation_setup"
82
- assert marker.exists()
83
- data = json.loads(marker.read_text(encoding="utf-8"))
84
- assert data["onboarding_completed"] is True
85
- assert data["local_model_requested"] is False
123
+ assert is_fresh_installation() is False
86
124
 
87
125
 
88
126
  class TestInteractiveSelectionUI:
@@ -158,7 +196,10 @@ class TestPromptLocalModelOnboardingWorkflow:
158
196
  def test_onboarding_no_displays_init_note(self, tmp_path, monkeypatch, capsys):
159
197
  fake_home = tmp_path / "home"
160
198
  fake_alpie = fake_home / ".alpiecode"
199
+ fake_env = tmp_path / "venv"
200
+ fake_env.mkdir(parents=True)
161
201
  monkeypatch.setattr(Path, "home", lambda: fake_home)
202
+ monkeypatch.setattr(sys, "prefix", str(fake_env))
162
203
  monkeypatch.setattr("codeagent.onboarding.get_alpiecode_dir", lambda: fake_alpie)
163
204
  monkeypatch.delenv("CI", raising=False)
164
205
 
@@ -174,16 +215,20 @@ class TestPromptLocalModelOnboardingWorkflow:
174
215
  captured = capsys.readouterr().out
175
216
  assert "You can download local alpiecode later by using alpiecode init" in captured
176
217
 
177
- # Marker should be created
178
- marker = fake_alpie / ".installation_setup"
218
+ # Environment marker should be created
219
+ marker = fake_env / ".alpiecode_install_state.json"
179
220
  assert marker.exists()
180
221
  data = json.loads(marker.read_text(encoding="utf-8"))
181
222
  assert data["local_model_requested"] is False
223
+ assert data["onboarding_completed"] is True
182
224
 
183
225
  def test_onboarding_yes_calls_interactive_init(self, tmp_path, monkeypatch, capsys):
184
226
  fake_home = tmp_path / "home"
185
227
  fake_alpie = fake_home / ".alpiecode"
228
+ fake_env = tmp_path / "venv"
229
+ fake_env.mkdir(parents=True)
186
230
  monkeypatch.setattr(Path, "home", lambda: fake_home)
231
+ monkeypatch.setattr(sys, "prefix", str(fake_env))
187
232
  monkeypatch.setattr("codeagent.onboarding.get_alpiecode_dir", lambda: fake_alpie)
188
233
  monkeypatch.delenv("CI", raising=False)
189
234
 
@@ -198,21 +243,8 @@ class TestPromptLocalModelOnboardingWorkflow:
198
243
  assert res is True
199
244
  assert len(init_called) == 1
200
245
 
201
- marker = fake_alpie / ".installation_setup"
246
+ marker = fake_env / ".alpiecode_install_state.json"
202
247
  assert marker.exists()
203
248
  data = json.loads(marker.read_text(encoding="utf-8"))
204
249
  assert data["local_model_requested"] is True
205
-
206
- def test_onboarding_non_interactive_does_not_block(self, tmp_path, monkeypatch):
207
- fake_home = tmp_path / "home"
208
- fake_alpie = fake_home / ".alpiecode"
209
- monkeypatch.setattr(Path, "home", lambda: fake_home)
210
- monkeypatch.setattr("codeagent.onboarding.get_alpiecode_dir", lambda: fake_alpie)
211
-
212
- monkeypatch.setattr("codeagent.onboarding.is_fresh_installation", lambda: True)
213
- monkeypatch.setattr("sys.stdin.isatty", lambda: False)
214
- monkeypatch.setattr("sys.stdout.isatty", lambda: False)
215
-
216
- res = prompt_local_model_onboarding(force=True)
217
- assert res is False
218
- assert (fake_alpie / ".installation_setup").exists()
250
+ assert data["onboarding_completed"] is True
File without changes
File without changes