@prompd/core 0.5.0-beta.13 → 0.5.0-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3384,6 +3384,9 @@ function normalizeSegments(p) {
3384
3384
  }
3385
3385
  return out.join("/");
3386
3386
  }
3387
+ function resolveInstallDir(root, type, name) {
3388
+ return joinPosix3(root, ".prompd", getInstallDirForType(type), name);
3389
+ }
3387
3390
  async function installPackage(opts) {
3388
3391
  const { ref, type, root, store, download } = opts;
3389
3392
  const parsed = parsePackageReference(ref);
@@ -3406,7 +3409,7 @@ async function installPackage(opts) {
3406
3409
  } catch {
3407
3410
  }
3408
3411
  }
3409
- const installedPath = joinPosix3(root, ".prompd", getInstallDirForType(type), name);
3412
+ const installedPath = resolveInstallDir(root, type, name);
3410
3413
  const baseSegments = normalizeSegments(installedPath);
3411
3414
  await store.removeDir?.(installedPath);
3412
3415
  const written = [];
@@ -3421,6 +3424,16 @@ async function installPackage(opts) {
3421
3424
  }
3422
3425
  return { name, version, scope: parsed.scope, installedPath, files: written };
3423
3426
  }
3427
+ async function uninstallPackage(opts) {
3428
+ const { ref, type, root, store } = opts;
3429
+ if (!store.removeDir) {
3430
+ throw new Error("Uninstall requires a PackageStore with removeDir.");
3431
+ }
3432
+ const parsed = parsePackageReference(ref);
3433
+ const installedPath = resolveInstallDir(root, type, parsed.name);
3434
+ await store.removeDir(installedPath);
3435
+ return { name: parsed.name, scope: parsed.scope, installedPath };
3436
+ }
3424
3437
 
3425
3438
  // src/lib/compiler/index.ts
3426
3439
  function createCoreStages() {
@@ -4880,6 +4893,7 @@ exports.resolvePackageFile = resolvePackageFile;
4880
4893
  exports.resolvePosix = resolvePosix;
4881
4894
  exports.serializeWorkflow = serializeWorkflow;
4882
4895
  exports.stripFilePath = stripFilePath;
4896
+ exports.uninstallPackage = uninstallPackage;
4883
4897
  exports.validateWorkflow = validateWorkflow;
4884
4898
  exports.validateWorkflowQuick = validateWorkflowQuick;
4885
4899
  //# sourceMappingURL=index.cjs.map