pi-permission-system-lean 42.0.0 → 42.1.0

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.ts +21 -4
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -29,7 +29,7 @@ Same command as upstream: `/permission-system` (configure logging and yolo mode,
29
29
 
30
30
  ## Versions
31
31
 
32
- - Lean wrapper: `42.0.0`
32
+ - Lean wrapper: `42.0.0-lean.1` (`-lean.1`: wrapper-only fix, upstream still `42.0.0`)
33
33
  - Upstream dependency is pinned to `@gotgenes/pi-permission-system@42.0.0`.
34
34
 
35
35
  ## Development
package/index.ts CHANGED
@@ -7,12 +7,29 @@
7
7
  // hiding, allow/ask/deny gates, subagent forwarding, service publication) run
8
8
  // the original upstream code untouched.
9
9
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
10
+ import { existsSync } from "node:fs";
11
+ import path from "node:path";
12
+ import { fileURLToPath, pathToFileURL } from "node:url";
13
+
10
14
  // The upstream package's exports map only exposes "." (the cross-extension
11
15
  // service surface), so the extension entry point is unreachable by package
12
- // subpath. Reach it by file path instead: every lean package installs its own
13
- // dependencies in its own node_modules (no workspaces), which keeps this
14
- // relative import stable.
15
- import upstreamActivate from "./node_modules/@gotgenes/pi-permission-system/src/index.ts";
16
+ // subpath and must be reached by file path. Which file path depends on the
17
+ // installer layout: pi installs extensions flat (upstream sits alongside as a
18
+ // sibling), while a local `npm install` nests it under ./node_modules.
19
+ // Prefer the sibling; fall back to the nested copy.
20
+ export function resolveUpstreamEntry(fromDir: string): string {
21
+ const candidates = [
22
+ path.join(fromDir, "../@gotgenes/pi-permission-system/src/index.ts"),
23
+ path.join(fromDir, "node_modules/@gotgenes/pi-permission-system/src/index.ts"),
24
+ ];
25
+ return candidates.find((p) => existsSync(p)) ?? candidates[0];
26
+ }
27
+
28
+ type UpstreamActivate = (pi: ExtensionAPI) => void;
29
+
30
+ const { default: upstreamActivate } = (await import(
31
+ pathToFileURL(resolveUpstreamEntry(path.dirname(fileURLToPath(import.meta.url)))).href
32
+ )) as unknown as { default: UpstreamActivate };
16
33
 
17
34
  const UPSTREAM_VERSION = "42.0.0";
18
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-permission-system-lean",
3
- "version": "42.0.0",
3
+ "version": "42.1.0",
4
4
  "description": "Lean wrapper of @gotgenes/pi-permission-system: same permission-system command with trimmed startup description.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "check": "npm run typecheck && npm test"
23
23
  },
24
24
  "dependencies": {
25
- "@gotgenes/pi-permission-system": "42.0.0"
25
+ "@gotgenes/pi-permission-system": "42.1.0"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@earendil-works/pi-coding-agent": "*",