Skip to content

Commit 0ea0181

Browse files
committed
fix: skip-write on no-op merge, bash subprocess, dynamic integration list
- _merge_vscode_settings() only writes when keys were actually added - update-context.sh uses exec subprocess like PS1 version - Unknown integration error lists available integrations dynamically
1 parent 02fd12b commit 0ea0181

3 files changed

Lines changed: 13 additions & 19 deletions

File tree

src/specify_cli/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,11 +1977,12 @@ def init(
19771977
# Auto-promote: --ai copilot → integration path with a nudge
19781978
use_integration = False
19791979
if integration:
1980-
from .integrations import get_integration
1980+
from .integrations import INTEGRATION_REGISTRY, get_integration
19811981
resolved_integration = get_integration(integration)
19821982
if not resolved_integration:
19831983
console.print(f"[red]Error:[/red] Unknown integration: '{integration}'")
1984-
console.print("[yellow]Available integrations:[/yellow] copilot")
1984+
available = ", ".join(sorted(INTEGRATION_REGISTRY))
1985+
console.print(f"[yellow]Available integrations:[/yellow] {available}")
19851986
raise typer.Exit(1)
19861987
use_integration = True
19871988
# Map integration key to the ai_assistant variable for downstream compatibility

src/specify_cli/integrations/copilot/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,19 @@ def _merge_vscode_settings(src: Path, dst: Path) -> None:
178178
)
179179
return
180180

181+
changed = False
181182
for key, value in new_settings.items():
182183
if key not in existing:
183184
existing[key] = value
185+
changed = True
184186
elif isinstance(existing[key], dict) and isinstance(value, dict):
185187
for sub_key, sub_value in value.items():
186188
if sub_key not in existing[key]:
187189
existing[key][sub_key] = sub_value
190+
changed = True
191+
192+
if not changed:
193+
return
188194

189195
dst.write_text(
190196
json.dumps(existing, indent=4) + "\n", encoding="utf-8"

src/specify_cli/integrations/copilot/scripts/update-context.sh

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,12 @@
1111
# refactored to support SPECKIT_SOURCE_ONLY (guard the main logic)
1212
# before sourcing will work.
1313
#
14-
# Sources common.sh and the shared update-agent-context functions,
15-
# then calls update_agent_file with the copilot target path.
14+
# Until then, this delegates to the shared script as a subprocess.
1615

1716
set -euo pipefail
1817

1918
REPO_ROOT="${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"
2019

21-
# Source shared utilities
22-
source "$REPO_ROOT/.specify/scripts/bash/common.sh"
23-
24-
# Source update-agent-context functions (parse_plan_data, update_agent_file, etc.)
25-
# SPECKIT_SOURCE_ONLY prevents the shared script from running its own main().
26-
export SPECKIT_SOURCE_ONLY=1
27-
source "$REPO_ROOT/.specify/scripts/bash/update-agent-context.sh"
28-
29-
# Gather feature paths and parse plan data
30-
_paths_output=$(get_feature_paths) || exit 1
31-
eval "$_paths_output"
32-
parse_plan_data "$IMPL_PLAN"
33-
34-
# Create or update the copilot instructions file
35-
update_agent_file "$REPO_ROOT/.github/copilot-instructions.md" "GitHub Copilot"
20+
# Invoke shared update-agent-context script as a separate process.
21+
# Sourcing is unsafe until that script guards its main logic.
22+
exec "$REPO_ROOT/.specify/scripts/bash/update-agent-context.sh" copilot

0 commit comments

Comments
 (0)