@tritard/waterbrother 0.16.1 → 0.16.2

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/package.json +1 -1
  2. package/src/security.js +9 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tritard/waterbrother",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "description": "Waterbrother: bring-your-own-model coding CLI with local tools, sessions, operator modes, and approval controls",
5
5
  "type": "module",
6
6
  "bin": {
package/src/security.js CHANGED
@@ -60,9 +60,16 @@ function checkFilePath(filePath, cwd) {
60
60
  }
61
61
  }
62
62
 
63
- // Home directory protection
63
+ // Home directory protection — only block writes to home dir root itself
64
+ // Allow writes to subdirectories (Desktop/my-project, Documents/app, etc.)
64
65
  if (HOME_DIR && cwdNorm === HOME_DIR) {
65
- reasons.push({ rule: "home-dir-write", message: "Writing files in home directory — use a project directory instead" });
66
+ const targetNorm = normalized.startsWith("/") || /^[a-zA-Z]:/.test(normalized)
67
+ ? normalized
68
+ : `${cwdNorm}/${normalized}`;
69
+ const isInSubdir = targetNorm.startsWith(HOME_DIR + "/") && targetNorm.split("/").length > HOME_DIR.split("/").length + 1;
70
+ if (!isInSubdir) {
71
+ reasons.push({ rule: "home-dir-write", message: "Writing files in home directory — use a project directory instead" });
72
+ }
66
73
  }
67
74
 
68
75
  // Self-modification