grepmax 0.1.0 → 0.2.1

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 (61) hide show
  1. package/LICENSE +1 -1
  2. package/NOTICE +2 -2
  3. package/README.md +72 -72
  4. package/dist/commands/claude-code.js +6 -6
  5. package/dist/commands/codex.js +17 -17
  6. package/dist/commands/doctor.js +6 -5
  7. package/dist/commands/droid.js +22 -22
  8. package/dist/commands/index.js +1 -1
  9. package/dist/commands/list.js +82 -19
  10. package/dist/commands/mcp.js +177 -158
  11. package/dist/commands/opencode.js +26 -26
  12. package/dist/commands/search.js +23 -13
  13. package/dist/commands/serve.js +30 -30
  14. package/dist/commands/setup.js +51 -40
  15. package/dist/commands/skeleton.js +19 -13
  16. package/dist/commands/symbols.js +40 -2
  17. package/dist/commands/verify.js +1 -1
  18. package/dist/commands/watch.js +206 -0
  19. package/dist/config.js +37 -7
  20. package/dist/eval.js +14 -14
  21. package/dist/index.js +11 -7
  22. package/dist/lib/core/languages.js +28 -0
  23. package/dist/lib/index/chunker.js +6 -3
  24. package/dist/lib/index/grammar-loader.js +2 -2
  25. package/dist/lib/index/ignore-patterns.js +1 -1
  26. package/dist/lib/index/index-config.js +50 -10
  27. package/dist/lib/index/sync-helpers.js +1 -1
  28. package/dist/lib/index/syncer.js +67 -45
  29. package/dist/lib/index/walker.js +3 -3
  30. package/dist/lib/index/watcher.js +4 -4
  31. package/dist/lib/output/formatter.js +1 -1
  32. package/dist/lib/search/searcher.js +9 -9
  33. package/dist/lib/setup/model-loader.js +3 -3
  34. package/dist/lib/setup/setup-helpers.js +2 -4
  35. package/dist/lib/skeleton/body-fields.js +20 -0
  36. package/dist/lib/skeleton/retriever.js +1 -1
  37. package/dist/lib/skeleton/skeletonizer.js +8 -2
  38. package/dist/lib/skeleton/summary-formatter.js +1 -4
  39. package/dist/lib/store/meta-cache.js +28 -3
  40. package/dist/lib/store/vector-db.js +17 -9
  41. package/dist/lib/utils/formatter.js +3 -3
  42. package/dist/lib/utils/lock.js +1 -1
  43. package/dist/lib/utils/project-registry.js +83 -0
  44. package/dist/lib/utils/project-root.js +32 -57
  45. package/dist/lib/utils/watcher-registry.js +100 -0
  46. package/dist/lib/workers/colbert-math.js +2 -2
  47. package/dist/lib/workers/download-worker.js +2 -2
  48. package/dist/lib/workers/embeddings/colbert.js +2 -2
  49. package/dist/lib/workers/embeddings/granite.js +4 -4
  50. package/dist/lib/workers/embeddings/mlx-client.js +1 -1
  51. package/dist/lib/workers/orchestrator.js +8 -8
  52. package/dist/lib/workers/pool.js +1 -1
  53. package/dist/lib/workers/worker.js +4 -1
  54. package/package.json +20 -21
  55. package/plugins/{osgrep → grepmax}/.claude-plugin/plugin.json +4 -4
  56. package/plugins/grepmax/hooks/start.js +63 -0
  57. package/plugins/grepmax/hooks/stop.js +3 -0
  58. package/plugins/{osgrep/skills/osgrep → grepmax/skills/gmax}/SKILL.md +11 -11
  59. package/plugins/osgrep/hooks/start.js +0 -90
  60. package/plugins/osgrep/hooks/stop.js +0 -3
  61. /package/plugins/{osgrep → grepmax}/hooks.json +0 -0
@@ -44,14 +44,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.list = void 0;
46
46
  const fs = __importStar(require("node:fs"));
47
+ const os = __importStar(require("node:os"));
47
48
  const path = __importStar(require("node:path"));
48
49
  const commander_1 = require("commander");
50
+ const index_config_1 = require("../lib/index/index-config");
49
51
  const exit_1 = require("../lib/utils/exit");
52
+ const project_registry_1 = require("../lib/utils/project-registry");
50
53
  const project_root_1 = require("../lib/utils/project-root");
51
54
  const style = {
52
55
  bold: (s) => `\x1b[1m${s}\x1b[22m`,
53
56
  dim: (s) => `\x1b[2m${s}\x1b[22m`,
54
57
  green: (s) => `\x1b[32m${s}\x1b[39m`,
58
+ yellow: (s) => `\x1b[33m${s}\x1b[39m`,
59
+ red: (s) => `\x1b[31m${s}\x1b[39m`,
55
60
  };
56
61
  function formatSize(bytes) {
57
62
  if (bytes < 1024)
@@ -95,26 +100,84 @@ function getDirectorySize(dirPath) {
95
100
  catch (_a) { }
96
101
  return totalSize;
97
102
  }
103
+ function shortenPath(p) {
104
+ const home = os.homedir();
105
+ if (p.startsWith(home))
106
+ return `~${p.slice(home.length)}`;
107
+ return p;
108
+ }
109
+ function pad(s, len) {
110
+ return s.length >= len ? s : s + " ".repeat(len - s.length);
111
+ }
98
112
  exports.list = new commander_1.Command("list")
99
- .description("Show the current project's .osgrep contents")
100
- .action(() => __awaiter(void 0, void 0, void 0, function* () {
101
- var _a;
102
- const projectRoot = (_a = (0, project_root_1.findProjectRoot)(process.cwd())) !== null && _a !== void 0 ? _a : process.cwd();
103
- const paths = (0, project_root_1.ensureProjectPaths)(projectRoot);
104
- const entries = [
105
- { label: "LanceDB", dir: paths.lancedbDir },
106
- { label: "Cache", dir: paths.cacheDir },
107
- ];
108
- console.log(`\n${style.bold("Project")}: ${style.green(projectRoot)}`);
109
- console.log(`${style.dim("Data directory")}: ${paths.osgrepDir}\n`);
110
- for (const entry of entries) {
111
- if (!fs.existsSync(entry.dir)) {
112
- console.log(`${entry.label}: ${style.dim("not created yet")}`);
113
- continue;
114
- }
115
- const stats = fs.statSync(entry.dir);
116
- const size = getDirectorySize(entry.dir);
117
- console.log(`${entry.label}: ${style.green(formatSize(size))} ${style.dim(`(updated ${formatDate(stats.mtime)})`)}`);
113
+ .description("Show indexed projects")
114
+ .option("--all", "Show all known projects across the system")
115
+ .action((options) => __awaiter(void 0, void 0, void 0, function* () {
116
+ if (options.all) {
117
+ yield showAllProjects();
118
+ }
119
+ else {
120
+ yield showCurrentProject();
118
121
  }
119
122
  yield (0, exit_1.gracefulExit)();
120
123
  }));
124
+ function showCurrentProject() {
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ var _a, _b, _c, _d;
127
+ const projectRoot = (_a = (0, project_root_1.findProjectRoot)(process.cwd())) !== null && _a !== void 0 ? _a : process.cwd();
128
+ const paths = (0, project_root_1.ensureProjectPaths)(projectRoot);
129
+ const entries = [
130
+ { label: "LanceDB", dir: paths.lancedbDir },
131
+ { label: "Cache", dir: paths.cacheDir },
132
+ ];
133
+ console.log(`\n${style.bold("Project")}: ${style.green(projectRoot)}`);
134
+ console.log(`${style.dim("Data directory")}: ${paths.dataDir}\n`);
135
+ const config = (0, index_config_1.readIndexConfig)(paths.configPath);
136
+ if (config) {
137
+ console.log(`${style.dim("Model")}: ${(_b = config.modelTier) !== null && _b !== void 0 ? _b : "small"} (${(_c = config.vectorDim) !== null && _c !== void 0 ? _c : 384}d)`);
138
+ console.log(`${style.dim("Mode")}: ${(_d = config.embedMode) !== null && _d !== void 0 ? _d : "cpu"}`);
139
+ if (config.indexedAt) {
140
+ console.log(`${style.dim("Indexed")}: ${formatDate(new Date(config.indexedAt))}`);
141
+ }
142
+ console.log();
143
+ }
144
+ for (const entry of entries) {
145
+ if (!fs.existsSync(entry.dir)) {
146
+ console.log(`${entry.label}: ${style.dim("not created yet")}`);
147
+ continue;
148
+ }
149
+ const stats = fs.statSync(entry.dir);
150
+ const size = getDirectorySize(entry.dir);
151
+ console.log(`${entry.label}: ${style.green(formatSize(size))} ${style.dim(`(updated ${formatDate(stats.mtime)})`)}`);
152
+ }
153
+ });
154
+ }
155
+ function showAllProjects() {
156
+ return __awaiter(this, void 0, void 0, function* () {
157
+ const projects = (0, project_registry_1.listProjects)();
158
+ const globalConfig = (0, index_config_1.readGlobalConfig)();
159
+ if (projects.length === 0) {
160
+ console.log("\nNo projects registered yet. Index a project to see it here.");
161
+ return;
162
+ }
163
+ console.log();
164
+ // Column widths
165
+ const nameWidth = Math.max(8, ...projects.map((p) => p.name.length));
166
+ const pathWidth = Math.max(12, ...projects.map((p) => shortenPath(p.root).length));
167
+ // Header
168
+ console.log(`${style.bold(pad("Project", nameWidth))} ${style.bold(pad("Path", pathWidth))} ${style.bold("Dims")} ${style.bold("Status")}`);
169
+ for (const project of projects) {
170
+ const dimMatch = project.vectorDim === globalConfig.vectorDim;
171
+ const dimsStr = `${project.vectorDim}d`;
172
+ const status = dimMatch
173
+ ? style.green("ok")
174
+ : style.yellow("reindex needed");
175
+ console.log(`${pad(project.name, nameWidth)} ${style.dim(pad(shortenPath(project.root), pathWidth))} ${pad(dimsStr, 4)} ${status}`);
176
+ }
177
+ console.log(`\n${style.dim("Global config")}: ${globalConfig.modelTier} (${globalConfig.vectorDim}d), ${globalConfig.embedMode}`);
178
+ const needsReindex = projects.filter((p) => p.vectorDim !== globalConfig.vectorDim);
179
+ if (needsReindex.length > 0) {
180
+ console.log(style.yellow(`\n${needsReindex.length} project(s) need reindexing. Search will auto-reindex on first use.`));
181
+ }
182
+ });
183
+ }