grepmax 0.26.34 → 0.26.35

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.
@@ -10,7 +10,7 @@
10
10
  "name": "grepmax",
11
11
  "source": "./plugins/grepmax",
12
12
  "description": "Semantic code search for Claude Code. Automatically indexes your project and provides intelligent search capabilities.",
13
- "version": "0.26.34",
13
+ "version": "0.26.35",
14
14
  "author": {
15
15
  "name": "Robert Owens",
16
16
  "email": "robowens@me.com"
package/dist/bin.js CHANGED
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.commandTarget = commandTarget;
38
+ exports.registeredForm = registeredForm;
38
39
  // Entry point. Picks the gmax home before anything reads config.ts: a command
39
40
  // aimed at a project under a secondary store's prefix (src/lib/utils/stores.ts)
40
41
  // runs against that store, in-process, so the drive it lives on can always
@@ -87,6 +88,46 @@ function selectHome() {
87
88
  process.env.GMAX_NO_AUTOSTART = "1";
88
89
  process.env.GMAX_SECONDARY_STORE = "1";
89
90
  seedConfig(match.store.home);
91
+ alignCwdWithRegistry(match.store.home);
92
+ }
93
+ // Node reports the physical working directory, so a shell standing in
94
+ // ~/Development/packages/x (a symlink onto the drive) looks like
95
+ // /Volumes/External/dev/packages/x, while the store registered the path it was
96
+ // given. When the physical cwd sits inside a registered root's realpath,
97
+ // report the cwd in the registered form so project lookup finds it.
98
+ function registeredForm(cwd, roots, real = realpathOr) {
99
+ for (const root of roots) {
100
+ const rootReal = real(root);
101
+ const rel = path.relative(rootReal, cwd);
102
+ if (rel === "" || (rel && !rel.startsWith("..") && !path.isAbsolute(rel))) {
103
+ return rel ? path.join(root, rel) : root;
104
+ }
105
+ }
106
+ return null;
107
+ }
108
+ function realpathOr(p) {
109
+ try {
110
+ return fs.realpathSync(p);
111
+ }
112
+ catch (_a) {
113
+ return path.resolve(p);
114
+ }
115
+ }
116
+ function alignCwdWithRegistry(home) {
117
+ let roots;
118
+ try {
119
+ const parsed = JSON.parse(fs.readFileSync(path.join(home, "projects.json"), "utf-8"));
120
+ roots = parsed
121
+ .map((p) => p.root)
122
+ .filter((r) => typeof r === "string");
123
+ }
124
+ catch (_a) {
125
+ return;
126
+ }
127
+ const physical = process.cwd();
128
+ const logical = registeredForm(physical, roots);
129
+ if (logical && logical !== physical)
130
+ process.cwd = () => logical;
90
131
  }
91
132
  // A new store embeds with the same model as the primary one.
92
133
  function seedConfig(home) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepmax",
3
- "version": "0.26.34",
3
+ "version": "0.26.35",
4
4
  "author": "Robert Owens <78518764+reowens@users.noreply.github.com>",
5
5
  "homepage": "https://github.com/reowens/grepmax",
6
6
  "bugs": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepmax",
3
- "version": "0.26.34",
3
+ "version": "0.26.35",
4
4
  "description": "Semantic code search for Claude Code. Automatically indexes your project and provides intelligent search capabilities.",
5
5
  "author": {
6
6
  "name": "Robert Owens",