Skip to content

Commit 38e03e2

Browse files
committed
Address review: chmod ordering, preserve markers, PS1 Python check, YAML key order
- Move ensure_executable_scripts after agent-context extension install so extension scripts get execute bits set - Use preserve_markers=True on reinit to keep user-customized markers - Add Python 3 version check in PowerShell fallback (matching bash behavior) - Add sort_keys=False to yaml.safe_dump for stable config output
1 parent f76c6f8 commit 38e03e2

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

extensions/agent-context/scripts/powershell/update-agent-context.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,12 @@ if ($null -eq $Options) {
7777
$pythonCmd = $null
7878
foreach ($candidate in @('python3', 'python')) {
7979
if (Get-Command $candidate -ErrorAction SilentlyContinue) {
80-
$pythonCmd = $candidate
81-
break
80+
# Verify it is Python 3
81+
$verOut = & $candidate --version 2>&1
82+
if ($verOut -match 'Python 3') {
83+
$pythonCmd = $candidate
84+
break
85+
}
8286
}
8387
}
8488

src/specify_cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ def _save_agent_context_config(
342342
"""Persist *config* to the agent-context extension config file."""
343343
path = project_root / _AGENT_CTX_EXT_CONFIG
344344
path.parent.mkdir(parents=True, exist_ok=True)
345-
path.write_text(yaml.safe_dump(config, default_flow_style=False), encoding="utf-8")
345+
path.write_text(yaml.safe_dump(config, default_flow_style=False, sort_keys=False), encoding="utf-8")
346346

347347

348348
def _update_agent_context_config_file(

src/specify_cli/commands/init.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,6 @@ def init(
537537
sanitized_wf = str(wf_err).replace('\n', ' ').strip()
538538
tracker.error("workflow", f"install failed: {sanitized_wf[:120]}")
539539

540-
ensure_executable_scripts(project_path, tracker=tracker)
541-
542540
init_opts = {
543541
"ai": selected_ai,
544542
"integration": resolved_integration.key,
@@ -583,9 +581,11 @@ def init(
583581
_update_agent_context_config_file(
584582
project_path,
585583
resolved_integration.context_file,
586-
preserve_markers=False,
584+
preserve_markers=True,
587585
)
588586

587+
ensure_executable_scripts(project_path, tracker=tracker)
588+
589589
if preset:
590590
try:
591591
from ..presets import PresetManager, PresetCatalog, PresetError

0 commit comments

Comments
 (0)