()
| 83 | } |
| 84 | |
| 85 | async removePluginEntry(): Promise<PluginEntryResult> { |
| 86 | const settingsPath = getPiUserExtensionsPath(); |
| 87 | try { |
| 88 | const settings = readPiSettings(); |
| 89 | if (!settings || !Array.isArray(settings.packages)) { |
| 90 | return { |
| 91 | ok: true, |
| 92 | action: "already_present", |
| 93 | message: `No packages array in ${settingsPath}.`, |
| 94 | configPath: settingsPath, |
| 95 | }; |
| 96 | } |
| 97 | const before = settings.packages.length; |
| 98 | settings.packages = settings.packages.filter( |
| 99 | (entry: unknown) => !matchesPiPackage(entry), |
| 100 | ); |
| 101 | if (settings.packages.length === before) { |
| 102 | return { |
| 103 | ok: true, |
| 104 | action: "already_present", |
| 105 | message: `Plugin entry not present in ${settingsPath}.`, |
| 106 | configPath: settingsPath, |
| 107 | }; |
| 108 | } |
| 109 | writePiSettings(settings); |
| 110 | return { |
| 111 | ok: true, |
| 112 | action: "updated", |
| 113 | message: `Removed ${PLUGIN_NAME} from ${settingsPath}.`, |
| 114 | configPath: settingsPath, |
| 115 | }; |
| 116 | } catch (err) { |
| 117 | return { |
| 118 | ok: false, |
| 119 | action: "error", |
| 120 | message: `Failed to update ${settingsPath}: ${(err as Error).message}`, |
| 121 | configPath: settingsPath, |
| 122 | }; |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | getInstallHint(): string { |
| 127 | return "Install Pi: https://pi.coding/install (npm: @earendil-works/pi-coding-agent)"; |
nothing calls this directly
no test coverage detected