@prompd/core 0.5.1 → 0.5.3
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 +18 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +18 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -716,6 +716,8 @@ interface InstallPackageOptions {
|
|
|
716
716
|
tools?: string[];
|
|
717
717
|
/** Host hook performing the per-tool deploy. Required when `tools` is set. */
|
|
718
718
|
deployTool?: ToolDeployHook;
|
|
719
|
+
/** Dot-dir the install tree lives under: <root>/<installDir>/<typeDir>/... Default '.prompd' (the CLI layout). A host with its own state dir (e.g. '.corenel') passes it here. */
|
|
720
|
+
installDir?: string;
|
|
719
721
|
}
|
|
720
722
|
interface InstalledPackage {
|
|
721
723
|
/** Full scoped name (manifest-authoritative when present), e.g. "@prompd/core". */
|
|
@@ -748,6 +750,8 @@ interface UninstallPackageOptions {
|
|
|
748
750
|
store: PackageStore;
|
|
749
751
|
/** Global uninstall — skips the workspace prompd.json dependency removal. */
|
|
750
752
|
global?: boolean;
|
|
753
|
+
/** Dot-dir the install tree lives under: <root>/<installDir>/<typeDir>/... Default '.prompd' (the CLI layout). A host with its own state dir (e.g. '.corenel') passes it here. */
|
|
754
|
+
installDir?: string;
|
|
751
755
|
}
|
|
752
756
|
interface UninstalledPackage {
|
|
753
757
|
name: string;
|
|
@@ -756,7 +760,7 @@ interface UninstalledPackage {
|
|
|
756
760
|
removed: string[];
|
|
757
761
|
}
|
|
758
762
|
/**
|
|
759
|
-
* Uninstall by name, matching the CLI: scan EVERY type dir under <root
|
|
763
|
+
* Uninstall by name, matching the CLI: scan EVERY type dir under <root>/<installDir>/ and
|
|
760
764
|
* remove the package's dir (all versions); for node-templates, find the .pdpkg whose
|
|
761
765
|
* manifest name matches and remove it. Drops the prompd.json dependency. Idempotent.
|
|
762
766
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -716,6 +716,8 @@ interface InstallPackageOptions {
|
|
|
716
716
|
tools?: string[];
|
|
717
717
|
/** Host hook performing the per-tool deploy. Required when `tools` is set. */
|
|
718
718
|
deployTool?: ToolDeployHook;
|
|
719
|
+
/** Dot-dir the install tree lives under: <root>/<installDir>/<typeDir>/... Default '.prompd' (the CLI layout). A host with its own state dir (e.g. '.corenel') passes it here. */
|
|
720
|
+
installDir?: string;
|
|
719
721
|
}
|
|
720
722
|
interface InstalledPackage {
|
|
721
723
|
/** Full scoped name (manifest-authoritative when present), e.g. "@prompd/core". */
|
|
@@ -748,6 +750,8 @@ interface UninstallPackageOptions {
|
|
|
748
750
|
store: PackageStore;
|
|
749
751
|
/** Global uninstall — skips the workspace prompd.json dependency removal. */
|
|
750
752
|
global?: boolean;
|
|
753
|
+
/** Dot-dir the install tree lives under: <root>/<installDir>/<typeDir>/... Default '.prompd' (the CLI layout). A host with its own state dir (e.g. '.corenel') passes it here. */
|
|
754
|
+
installDir?: string;
|
|
751
755
|
}
|
|
752
756
|
interface UninstalledPackage {
|
|
753
757
|
name: string;
|
|
@@ -756,7 +760,7 @@ interface UninstalledPackage {
|
|
|
756
760
|
removed: string[];
|
|
757
761
|
}
|
|
758
762
|
/**
|
|
759
|
-
* Uninstall by name, matching the CLI: scan EVERY type dir under <root
|
|
763
|
+
* Uninstall by name, matching the CLI: scan EVERY type dir under <root>/<installDir>/ and
|
|
760
764
|
* remove the package's dir (all versions); for node-templates, find the .pdpkg whose
|
|
761
765
|
* manifest name matches and remove it. Drops the prompd.json dependency. Idempotent.
|
|
762
766
|
*/
|
package/dist/index.js
CHANGED
|
@@ -3368,11 +3368,19 @@ var MAX_PACKAGE_SIZE = 50 * 1024 * 1024;
|
|
|
3368
3368
|
function slugify(name) {
|
|
3369
3369
|
return name.toLowerCase().replace(/[@/]+/g, "-").replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
3370
3370
|
}
|
|
3371
|
-
|
|
3372
|
-
|
|
3371
|
+
var DEFAULT_INSTALL_DIR = ".prompd";
|
|
3372
|
+
function checkInstallDir(dir) {
|
|
3373
|
+
const d = dir ?? DEFAULT_INSTALL_DIR;
|
|
3374
|
+
if (!/^\.[A-Za-z0-9][A-Za-z0-9._-]*$/.test(d)) {
|
|
3375
|
+
throw new Error(`Invalid installDir "${d}": expected a single dot-directory name like ".prompd".`);
|
|
3376
|
+
}
|
|
3377
|
+
return d;
|
|
3378
|
+
}
|
|
3379
|
+
function resolvePackageDir(root, installDir, type, name) {
|
|
3380
|
+
return joinPosix(root, installDir, getInstallDirForType(type), name);
|
|
3373
3381
|
}
|
|
3374
|
-
function resolveInstallDir(root, type, name, version) {
|
|
3375
|
-
return joinPosix(resolvePackageDir(root, type, name), version);
|
|
3382
|
+
function resolveInstallDir(root, installDir, type, name, version) {
|
|
3383
|
+
return joinPosix(resolvePackageDir(root, installDir, type, name), version);
|
|
3376
3384
|
}
|
|
3377
3385
|
async function addWorkspaceDependency(store, root, name, version) {
|
|
3378
3386
|
if (!store.readFile) return;
|
|
@@ -3414,6 +3422,7 @@ async function installPackage(opts) {
|
|
|
3414
3422
|
}
|
|
3415
3423
|
async function installInternal(opts, visited) {
|
|
3416
3424
|
const { ref, root, store, download, global, tools, deployTool } = opts;
|
|
3425
|
+
const installDir = checkInstallDir(opts.installDir);
|
|
3417
3426
|
const parsed = parsePackageReference(ref);
|
|
3418
3427
|
const bytes = await download(parsed.name, parsed.version);
|
|
3419
3428
|
if (bytes.length > MAX_PACKAGE_SIZE) {
|
|
@@ -3440,11 +3449,11 @@ async function installInternal(opts, visited) {
|
|
|
3440
3449
|
if (!store.writeBytes) {
|
|
3441
3450
|
throw new Error("Installing a node-template requires a PackageStore with writeBytes (binary). This host does not support it.");
|
|
3442
3451
|
}
|
|
3443
|
-
const dir = joinPosix(root,
|
|
3452
|
+
const dir = joinPosix(root, installDir, getInstallDirForType("node-template"));
|
|
3444
3453
|
installedPath = joinPosix(dir, `${slugify(name)}-${version}.pdpkg`);
|
|
3445
3454
|
await store.writeBytes(installedPath, bytes);
|
|
3446
3455
|
} else {
|
|
3447
|
-
installedPath = resolveInstallDir(root, type, name, version);
|
|
3456
|
+
installedPath = resolveInstallDir(root, installDir, type, name, version);
|
|
3448
3457
|
const base = normalizePosix(installedPath);
|
|
3449
3458
|
await store.removeDir?.(installedPath);
|
|
3450
3459
|
for (const [rel, content] of files) {
|
|
@@ -3467,13 +3476,14 @@ async function installInternal(opts, visited) {
|
|
|
3467
3476
|
}
|
|
3468
3477
|
async function uninstallPackage(opts) {
|
|
3469
3478
|
const { root, store, global } = opts;
|
|
3479
|
+
const installDir = checkInstallDir(opts.installDir);
|
|
3470
3480
|
if (!store.removeDir) throw new Error("Uninstall requires a PackageStore with removeDir.");
|
|
3471
3481
|
const parsed = parsePackageReference(opts.ref);
|
|
3472
3482
|
const name = parsed.name;
|
|
3473
3483
|
const removed = [];
|
|
3474
3484
|
for (const type of ["package", "workflow", "skill", "node-template"]) {
|
|
3475
3485
|
if (type === "node-template") {
|
|
3476
|
-
const dir = joinPosix(root,
|
|
3486
|
+
const dir = joinPosix(root, installDir, getInstallDirForType("node-template"));
|
|
3477
3487
|
if (!store.readdir || !store.removeFile || !store.readBytes) continue;
|
|
3478
3488
|
try {
|
|
3479
3489
|
for (const entry of await store.readdir(dir)) {
|
|
@@ -3491,7 +3501,7 @@ async function uninstallPackage(opts) {
|
|
|
3491
3501
|
} catch {
|
|
3492
3502
|
}
|
|
3493
3503
|
} else {
|
|
3494
|
-
const dir = resolvePackageDir(root, type, name);
|
|
3504
|
+
const dir = resolvePackageDir(root, installDir, type, name);
|
|
3495
3505
|
await store.removeDir(dir);
|
|
3496
3506
|
removed.push(dir);
|
|
3497
3507
|
}
|