YujunZhou/tellonce / codex
tellonce
VerifiedUse to view, explain, correct, delete or reorganize the user's saved preferences, or to record one by hand when automatic recording is off; learning and rule injection otherwise run automatically through Codex hooks.
tellonce_codex/uninstall.py
View on GitHubfrom __future__ import annotations
import shutil
from dataclasses import dataclass
from pathlib import Path
from .paths import find_registration
@dataclass(frozen=True)
class UninstallResult:
removed_integration: bool
purged_state: bool = False
state_root: Path | None = None
def uninstall(project_root: Path, keep_data: bool = True) -> UninstallResult:
"""Remove the install marker; optionally wipe the entire state tree.
CX-6 fix: previously `keep_data=False` was a documented no-op
(`pass` with a TODO comment). That made the API lie. Now the flag
actually deletes the state directory when False, and a refusal
guard prevents accidental top-level wipes.
"""
root = project_root.resolve()
disabled_marker = root / ".codex" / "tellonce.disabled"
disabled_marker.parent.mkdir(parents=True, exist_ok=True)
disabled_marker.write_text("disabled\n", encoding="utf-8")
registration = find_registration(root)
if registration is None:
return UninstallResult(
removed_integration=True,
purged_state=False,
state_root=None,
)
state_root = registration.state_root
marker = state_root / "managed_runtime.txt"
if marker.exists():
marker.unlink()
purged = False
if not keep_data:
# Refuse to rmtree obviously-dangerous paths.
resolved = state_root.resolve()
if resolved == Path("/") or len(resolved.parts) <= 2:
raise ValueError(f"refusing to purge suspicious state_root: {resolved}")
if state_root.is_dir():
shutil.rmtree(state_root)
purged = True
return UninstallResult(
removed_integration=True,
purged_state=purged,
state_root=state_root,
)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |