Skip to content

Commit c949fe7

Browse files
committed
Clean up metadata on rollback, broaden init-options match in uninstall
- Remove integration.json in install/switch rollback paths so failed installs don't leave stale metadata - Match on both 'integration' and 'ai' keys when clearing init-options.json during uninstall to handle partially-written metadata
1 parent e7f14de commit c949fe7

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/specify_cli/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,6 +1676,7 @@ def integration_install(
16761676
except Exception as rollback_err:
16771677
# Suppress so the original setup error remains the primary failure
16781678
console.print(f"[yellow]Warning:[/yellow] Failed to roll back integration changes: {rollback_err}")
1679+
_remove_integration_json(project_root)
16791680
console.print(f"[red]Error:[/red] Failed to install integration: {e}")
16801681
raise typer.Exit(1)
16811682

@@ -1775,7 +1776,7 @@ def integration_uninstall(
17751776
_remove_integration_json(project_root)
17761777
# Clear integration-related keys from init-options.json
17771778
opts = load_init_options(project_root)
1778-
if opts.get("integration") == key:
1779+
if opts.get("integration") == key or opts.get("ai") == key:
17791780
opts.pop("integration", None)
17801781
opts.pop("ai", None)
17811782
opts.pop("ai_skills", None)
@@ -1797,7 +1798,7 @@ def integration_uninstall(
17971798

17981799
# Update init-options.json to clear the integration
17991800
opts = load_init_options(project_root)
1800-
if opts.get("integration") == key:
1801+
if opts.get("integration") == key or opts.get("ai") == key:
18011802
opts.pop("integration", None)
18021803
opts.pop("ai", None)
18031804
opts.pop("ai_skills", None)
@@ -1917,6 +1918,7 @@ def integration_switch(
19171918
except Exception as rollback_err:
19181919
# Suppress so the original setup error remains the primary failure
19191920
console.print(f"[yellow]Warning:[/yellow] Failed to roll back integration '{target}': {rollback_err}")
1921+
_remove_integration_json(project_root)
19201922
console.print(f"[red]Error:[/red] Failed to install integration '{target}': {e}")
19211923
raise typer.Exit(1)
19221924

0 commit comments

Comments
 (0)