grepmax 0.26.16 → 0.26.18
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.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/commands/add.js +6 -0
- package/dist/lib/daemon/daemon.js +9 -0
- package/dist/lib/utils/blocked-roots.js +27 -1
- package/dist/lib/utils/project-registry.js +5 -0
- package/package.json +1 -1
- package/plugins/grepmax/.claude-plugin/plugin.json +1 -1
|
@@ -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.
|
|
13
|
+
"version": "0.26.18",
|
|
14
14
|
"author": {
|
|
15
15
|
"name": "Robert Owens",
|
|
16
16
|
"email": "robowens@me.com"
|
package/dist/commands/add.js
CHANGED
|
@@ -98,6 +98,12 @@ Examples:
|
|
|
98
98
|
process.exitCode = 1;
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
+
if ((0, blocked_roots_1.isGitWorktreeRoot)(projectRoot)) {
|
|
102
|
+
logBlockedAttempt("git_worktree", projectRoot);
|
|
103
|
+
console.error(`Refusing to add ${projectRoot}: ${blocked_roots_1.WORKTREE_REFUSAL}`);
|
|
104
|
+
process.exitCode = 1;
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
101
107
|
// Check if already registered
|
|
102
108
|
const existing = (0, project_registry_1.getProject)(projectRoot);
|
|
103
109
|
if (existing) {
|
|
@@ -59,6 +59,7 @@ const server_1 = require("../llm/server");
|
|
|
59
59
|
const meta_cache_1 = require("../store/meta-cache");
|
|
60
60
|
const store_lease_1 = require("../store/store-lease");
|
|
61
61
|
const vector_db_1 = require("../store/vector-db");
|
|
62
|
+
const blocked_roots_1 = require("../utils/blocked-roots");
|
|
62
63
|
const daemon_client_1 = require("../utils/daemon-client");
|
|
63
64
|
const daemon_launcher_1 = require("../utils/daemon-launcher");
|
|
64
65
|
const kernel_zone_1 = require("../utils/kernel-zone");
|
|
@@ -789,6 +790,10 @@ class Daemon {
|
|
|
789
790
|
return;
|
|
790
791
|
}
|
|
791
792
|
const project = (0, project_registry_1.getProject)(root);
|
|
793
|
+
if (!project && (0, blocked_roots_1.isGitWorktreeRoot)(root)) {
|
|
794
|
+
(0, ipc_handler_1.writeDone)(conn, { ok: false, error: blocked_roots_1.WORKTREE_REFUSAL });
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
792
797
|
if ((project === null || project === void 0 ? void 0 : project.status) === "indexed") {
|
|
793
798
|
if (!this.activeGeneration ||
|
|
794
799
|
(0, embedding_generation_1.compareEmbeddingGeneration)(project, this.activeGeneration)
|
|
@@ -854,6 +859,10 @@ class Daemon {
|
|
|
854
859
|
(0, ipc_handler_1.writeDone)(conn, { ok: false, error: "daemon resources not ready" });
|
|
855
860
|
return;
|
|
856
861
|
}
|
|
862
|
+
if (!(0, project_registry_1.getProject)(root) && (0, blocked_roots_1.isGitWorktreeRoot)(root)) {
|
|
863
|
+
(0, ipc_handler_1.writeDone)(conn, { ok: false, error: blocked_roots_1.WORKTREE_REFUSAL });
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
857
866
|
if (!(0, project_registry_1.getProject)(root)) {
|
|
858
867
|
(0, project_registry_1.registerProject)({
|
|
859
868
|
root,
|
|
@@ -33,9 +33,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.BLOCKED_ROOTS_DESCRIPTION = void 0;
|
|
36
|
+
exports.WORKTREE_REFUSAL = exports.BLOCKED_ROOTS_DESCRIPTION = void 0;
|
|
37
37
|
exports.getBlockedProjectRoots = getBlockedProjectRoots;
|
|
38
38
|
exports.isBlockedProjectRoot = isBlockedProjectRoot;
|
|
39
|
+
exports.isGitWorktreeRoot = isGitWorktreeRoot;
|
|
40
|
+
const fs = __importStar(require("node:fs"));
|
|
39
41
|
const os = __importStar(require("node:os"));
|
|
40
42
|
const path = __importStar(require("node:path"));
|
|
41
43
|
exports.BLOCKED_ROOTS_DESCRIPTION = "home, /, /Users, /tmp, /private, /var, /usr, /opt, /etc, /System, /Library, /Applications";
|
|
@@ -61,3 +63,27 @@ function getBlockedProjectRoots() {
|
|
|
61
63
|
function isBlockedProjectRoot(root) {
|
|
62
64
|
return getBlockedProjectRoots().has(path.resolve(root));
|
|
63
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* A linked git worktree has a `.git` FILE (not a directory) pointing back into
|
|
68
|
+
* the main repo's `.git/worktrees/<name>`. Indexing one duplicates the whole
|
|
69
|
+
* corpus of the repo it was cut from — three platform worktrees once put 680k
|
|
70
|
+
* duplicate chunks in the index and pinned seven embed workers at ~1GB each.
|
|
71
|
+
*/
|
|
72
|
+
function isGitWorktreeRoot(root) {
|
|
73
|
+
const gitPath = path.join(path.resolve(root), ".git");
|
|
74
|
+
let contents;
|
|
75
|
+
try {
|
|
76
|
+
if (!fs.statSync(gitPath).isFile())
|
|
77
|
+
return false;
|
|
78
|
+
contents = fs.readFileSync(gitPath, "utf8");
|
|
79
|
+
}
|
|
80
|
+
catch (_a) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
const match = /^gitdir:\s*(.+)$/m.exec(contents);
|
|
84
|
+
if (!(match === null || match === void 0 ? void 0 : match[1]))
|
|
85
|
+
return false;
|
|
86
|
+
const gitdir = match[1].trim().replace(/\\/g, "/");
|
|
87
|
+
return /(^|\/)\.git\/worktrees\//.test(gitdir);
|
|
88
|
+
}
|
|
89
|
+
exports.WORKTREE_REFUSAL = "gmax does not index git worktrees — they duplicate the repository they were cut from. Add the main repository root instead.";
|
|
@@ -63,6 +63,7 @@ const path = __importStar(require("node:path"));
|
|
|
63
63
|
const proper_lockfile_1 = __importDefault(require("proper-lockfile"));
|
|
64
64
|
const config_1 = require("../../config");
|
|
65
65
|
const embedding_generation_1 = require("../index/embedding-generation");
|
|
66
|
+
const blocked_roots_1 = require("./blocked-roots");
|
|
66
67
|
const REGISTRY_PATH = path.join(config_1.PATHS.globalRoot, "projects.json");
|
|
67
68
|
const REBUILD_JOURNAL_PATH = path.join(config_1.PATHS.globalRoot, "rebuild-journal.json");
|
|
68
69
|
class ProjectRegistryConflictError extends Error {
|
|
@@ -207,6 +208,10 @@ function registerProject(entry) {
|
|
|
207
208
|
}
|
|
208
209
|
withRegistryLock(() => {
|
|
209
210
|
const entries = loadRegistry();
|
|
211
|
+
if (!entries.some((e) => e.root === entry.root) &&
|
|
212
|
+
(0, blocked_roots_1.isGitWorktreeRoot)(entry.root)) {
|
|
213
|
+
throw new Error(`${blocked_roots_1.WORKTREE_REFUSAL} (${entry.root})`);
|
|
214
|
+
}
|
|
210
215
|
let canonicalRoot;
|
|
211
216
|
try {
|
|
212
217
|
canonicalRoot = fs.realpathSync(entry.root);
|
package/package.json
CHANGED