pi-landstrip 0.5.0 → 0.5.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.
Files changed (2) hide show
  1. package/index.ts +16 -8
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -606,12 +606,15 @@ function promptDomainBlock(ctx: ExtensionContext, domain: string): Promise<Permi
606
606
  );
607
607
  }
608
608
 
609
- function promptReadBlock(ctx: ExtensionContext, filePath: string): Promise<PermissionChoice> {
610
- return showPermissionPrompt(
611
- ctx,
612
- `Read blocked: "${filePath}" is not in allowRead`,
613
- PERMISSION_OPTIONS,
614
- );
609
+ function promptReadBlock(
610
+ ctx: ExtensionContext,
611
+ filePath: string,
612
+ reason?: string,
613
+ ): Promise<PermissionChoice> {
614
+ const title = reason
615
+ ? `Read blocked: "${filePath}" is in denyRead (${reason})`
616
+ : `Read blocked: "${filePath}" is not in allowRead`;
617
+ return showPermissionPrompt(ctx, title, PERMISSION_OPTIONS);
615
618
  }
616
619
 
617
620
  function promptWriteBlock(ctx: ExtensionContext, filePath: string): Promise<PermissionChoice> {
@@ -1039,6 +1042,7 @@ export function createLandstripIntegration(
1039
1042
  const blockedPath = extractBlockedPath(stderrAcc, cwd);
1040
1043
  if (blockedPath && ctx.hasUI) {
1041
1044
  const config = loadConfig(cwd);
1045
+ const isDeniedByDenyRead = matchesPattern(blockedPath, config.filesystem.denyRead);
1042
1046
  const isReadAllowed = matchesPattern(blockedPath, getEffectiveAllowRead(cwd));
1043
1047
  const isWriteAllowed = !shouldPromptForWrite(
1044
1048
  blockedPath,
@@ -1046,8 +1050,12 @@ export function createLandstripIntegration(
1046
1050
  matchesPattern,
1047
1051
  );
1048
1052
 
1049
- if (!isReadAllowed) {
1050
- const choice = await promptReadBlock(ctx, blockedPath);
1053
+ if (isDeniedByDenyRead || !isReadAllowed) {
1054
+ const choice = await promptReadBlock(
1055
+ ctx,
1056
+ blockedPath,
1057
+ isDeniedByDenyRead ? 'denyRead overrides allowRead' : undefined,
1058
+ );
1051
1059
  if (choice !== 'abort') await applyReadChoice(choice, blockedPath, cwd);
1052
1060
  } else if (!isWriteAllowed) {
1053
1061
  const choice = await promptWriteBlock(ctx, blockedPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-landstrip",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Landlock-based sandboxing for pi with interactive permission prompts",
5
5
  "keywords": [
6
6
  "landstrip",