pi-pkg-guard 0.1.0 → 0.1.1

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.
@@ -33,11 +33,27 @@ interface PiSettings {
33
33
  // =============================================================================
34
34
 
35
35
  function isPiSettings(value: unknown): value is PiSettings {
36
- return typeof value === "object" && value !== null;
36
+ if (typeof value !== "object" || value === null) return false;
37
+ if (Array.isArray(value)) return false;
38
+ const candidate = value as Record<string, unknown>;
39
+
40
+ if (candidate.packages !== undefined) {
41
+ if (!Array.isArray(candidate.packages)) return false;
42
+ if (!candidate.packages.every((p) => typeof p === "string")) return false;
43
+ }
44
+
45
+ if (candidate.extensions !== undefined) {
46
+ if (!Array.isArray(candidate.extensions)) return false;
47
+ if (!candidate.extensions.every((e) => typeof e === "string")) return false;
48
+ }
49
+
50
+ return true;
37
51
  }
38
52
 
39
53
  function isBashToolInput(input: unknown): input is { command?: string } {
40
- return typeof input === "object" && input !== null;
54
+ if (typeof input !== "object" || input === null) return false;
55
+ if (Array.isArray(input)) return false;
56
+ return true;
41
57
  }
42
58
 
43
59
  // =============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-pkg-guard",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A lightweight pi extension that guards against the 'orphaned package' trap where packages are installed via npm but not registered in pi's settings.json",
5
5
  "type": "module",
6
6
  "license": "MIT",