grepmax 0.12.3 → 0.12.5
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/dist/commands/status.js
CHANGED
|
@@ -45,13 +45,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
45
45
|
exports.status = void 0;
|
|
46
46
|
const os = __importStar(require("node:os"));
|
|
47
47
|
const commander_1 = require("commander");
|
|
48
|
+
const config_1 = require("../config");
|
|
48
49
|
const index_config_1 = require("../lib/index/index-config");
|
|
50
|
+
const filter_builder_1 = require("../lib/utils/filter-builder");
|
|
49
51
|
const exit_1 = require("../lib/utils/exit");
|
|
50
52
|
const lock_1 = require("../lib/utils/lock");
|
|
51
53
|
const project_registry_1 = require("../lib/utils/project-registry");
|
|
52
54
|
const project_root_1 = require("../lib/utils/project-root");
|
|
53
55
|
const watcher_store_1 = require("../lib/utils/watcher-store");
|
|
54
|
-
const config_1 = require("../config");
|
|
55
56
|
const style = {
|
|
56
57
|
bold: (s) => `\x1b[1m${s}\x1b[22m`,
|
|
57
58
|
dim: (s) => `\x1b[2m${s}\x1b[22m`,
|
|
@@ -97,7 +98,7 @@ Examples:
|
|
|
97
98
|
gmax status Show status of all indexed projects
|
|
98
99
|
`)
|
|
99
100
|
.action((opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
100
|
-
var _a, _b;
|
|
101
|
+
var _a, _b, _c, _d;
|
|
101
102
|
const globalConfig = (0, index_config_1.readGlobalConfig)();
|
|
102
103
|
const projects = (0, project_registry_1.listProjects)();
|
|
103
104
|
(0, watcher_store_1.listWatchers)(); // cleans stale entries as side effect
|
|
@@ -107,6 +108,24 @@ Examples:
|
|
|
107
108
|
// Header
|
|
108
109
|
console.log(`\n${style.bold("gmax")} · ${globalConfig.modelTier} (${globalConfig.vectorDim}d, ${globalConfig.embedMode})${indexing ? style.yellow(" · indexing...") : ""}`);
|
|
109
110
|
}
|
|
111
|
+
// Query live chunk counts from LanceDB
|
|
112
|
+
const chunkCounts = new Map();
|
|
113
|
+
try {
|
|
114
|
+
const { VectorDB } = yield Promise.resolve().then(() => __importStar(require("../lib/store/vector-db")));
|
|
115
|
+
const db = new VectorDB(config_1.PATHS.lancedbDir);
|
|
116
|
+
const table = yield db.ensureTable();
|
|
117
|
+
for (const project of projects) {
|
|
118
|
+
const prefix = project.root.endsWith("/") ? project.root : `${project.root}/`;
|
|
119
|
+
const rows = yield table
|
|
120
|
+
.query()
|
|
121
|
+
.select(["id"])
|
|
122
|
+
.where(`path LIKE '${(0, filter_builder_1.escapeSqlString)(prefix)}%'`)
|
|
123
|
+
.toArray();
|
|
124
|
+
chunkCounts.set(project.root, rows.length);
|
|
125
|
+
}
|
|
126
|
+
yield db.close();
|
|
127
|
+
}
|
|
128
|
+
catch (_e) { }
|
|
110
129
|
if (projects.length === 0) {
|
|
111
130
|
if (opts.agent) {
|
|
112
131
|
console.log("(none)");
|
|
@@ -133,7 +152,8 @@ Examples:
|
|
|
133
152
|
else
|
|
134
153
|
st = "idle";
|
|
135
154
|
const isCurrent = project.root === currentRoot;
|
|
136
|
-
|
|
155
|
+
const count = (_b = chunkCounts.get(project.root)) !== null && _b !== void 0 ? _b : project.chunkCount;
|
|
156
|
+
console.log(`${project.name}\t${formatChunks(count)}\t${formatAge(project.lastIndexed)}\t${st}${isCurrent ? "\tcurrent" : ""}`);
|
|
137
157
|
}
|
|
138
158
|
yield (0, exit_1.gracefulExit)();
|
|
139
159
|
return;
|
|
@@ -146,7 +166,7 @@ Examples:
|
|
|
146
166
|
const watcher = (0, watcher_store_1.getWatcherForProject)(project.root);
|
|
147
167
|
// Status column
|
|
148
168
|
let statusStr;
|
|
149
|
-
const projectStatus = (
|
|
169
|
+
const projectStatus = (_c = project.status) !== null && _c !== void 0 ? _c : "indexed";
|
|
150
170
|
if (projectStatus === "pending") {
|
|
151
171
|
statusStr = style.yellow("pending");
|
|
152
172
|
}
|
|
@@ -163,7 +183,8 @@ Examples:
|
|
|
163
183
|
statusStr = style.dim("idle");
|
|
164
184
|
}
|
|
165
185
|
// Chunks column
|
|
166
|
-
const
|
|
186
|
+
const count = (_d = chunkCounts.get(project.root)) !== null && _d !== void 0 ? _d : project.chunkCount;
|
|
187
|
+
const chunks = `${formatChunks(count)} chunks`;
|
|
167
188
|
// Age column
|
|
168
189
|
const age = formatAge(project.lastIndexed);
|
|
169
190
|
// Current marker
|
|
@@ -295,7 +295,7 @@ class VectorDB {
|
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
297
|
optimize() {
|
|
298
|
-
return __awaiter(this, arguments, void 0, function* (retries =
|
|
298
|
+
return __awaiter(this, arguments, void 0, function* (retries = 5, retentionMs = 0) {
|
|
299
299
|
const table = yield this.ensureTable();
|
|
300
300
|
const cutoff = new Date(Date.now() - retentionMs);
|
|
301
301
|
for (let attempt = 1; attempt <= retries; attempt++) {
|
package/package.json
CHANGED