Skip to content

Commit f4ea768

Browse files
committed
fix: skip JSONC merge to preserve user settings, fix docstring
- _merge_vscode_settings() now returns early (skips merge) when existing settings.json can't be parsed (e.g. JSONC with comments), instead of overwriting with empty settings - Updated _install_shared_infra() docstring to match implementation (scripts + templates, speckit.manifest.json)
1 parent 28e85c4 commit f4ea768

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/specify_cli/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,9 +1204,9 @@ def _install_shared_infra(
12041204
) -> bool:
12051205
"""Install shared infrastructure files into *project_path*.
12061206
1207-
Copies ``.specify/scripts/``, ``.specify/templates/``, and
1208-
``.specify/memory/`` from the bundled core_pack or source checkout.
1209-
Tracks all installed files in ``_framework.manifest.json``.
1207+
Copies ``.specify/scripts/`` and ``.specify/templates/`` from the
1208+
bundled core_pack or source checkout. Tracks all installed files
1209+
in ``speckit.manifest.json``.
12101210
Returns ``True`` on success.
12111211
"""
12121212
from .integrations.manifest import IntegrationManifest

src/specify_cli/integrations/copilot/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,16 @@ def _merge_vscode_settings(src: Path, dst: Path) -> None:
141141
142142
Top-level keys from *src* are added only if missing in *dst*.
143143
For dict-valued keys, sub-keys are merged the same way.
144+
145+
If *dst* cannot be parsed (e.g. JSONC with comments), the merge
146+
is skipped to avoid overwriting user settings.
144147
"""
145148
try:
146149
existing = json.loads(dst.read_text(encoding="utf-8"))
147150
except (json.JSONDecodeError, OSError):
148-
existing = {}
151+
# Cannot parse existing file (likely JSONC with comments).
152+
# Skip merge to preserve the user's settings.
153+
return
149154

150155
new_settings = json.loads(src.read_text(encoding="utf-8"))
151156

0 commit comments

Comments
 (0)