@intellectronica/ruler 0.1.3 → 0.1.4

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.
@@ -59,7 +59,24 @@ async function updateGitignore(projectRoot, paths) {
59
59
  }
60
60
  // Convert paths to relative POSIX format
61
61
  const relativePaths = paths.map((p) => {
62
- const relative = path.isAbsolute(p) ? path.relative(projectRoot, p) : p;
62
+ let relative;
63
+ if (path.isAbsolute(p)) {
64
+ relative = path.relative(projectRoot, p);
65
+ }
66
+ else {
67
+ // Handle relative paths that might include the project root prefix
68
+ const normalizedProjectRoot = path.normalize(projectRoot);
69
+ const normalizedPath = path.normalize(p);
70
+ // Get the basename of the project root to match against path prefixes
71
+ const projectBasename = path.basename(normalizedProjectRoot);
72
+ // If the path starts with the project basename, remove it
73
+ if (normalizedPath.startsWith(projectBasename + path.sep)) {
74
+ relative = normalizedPath.substring(projectBasename.length + 1);
75
+ }
76
+ else {
77
+ relative = normalizedPath;
78
+ }
79
+ }
63
80
  return relative.replace(/\\/g, '/'); // Convert to POSIX format
64
81
  });
65
82
  // Get all existing paths from .gitignore (excluding Ruler block)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intellectronica/ruler",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Ruler — apply the same rules to all coding agents",
5
5
  "main": "dist/lib.js",
6
6
  "scripts": {