ruvector 0.1.48 → 0.1.49

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 (2) hide show
  1. package/bin/cli.js +26 -6
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -2095,19 +2095,39 @@ program
2095
2095
  // Self-Learning Intelligence Hooks
2096
2096
  // ============================================
2097
2097
 
2098
- const INTEL_PATH = path.join(require('os').homedir(), '.ruvector', 'intelligence.json');
2099
-
2100
2098
  class Intelligence {
2101
2099
  constructor() {
2100
+ this.intelPath = this.getIntelPath();
2102
2101
  this.data = this.load();
2103
2102
  this.alpha = 0.1;
2104
2103
  this.lastEditedFile = null;
2105
2104
  }
2106
2105
 
2106
+ // Prefer project-local storage, fall back to home directory
2107
+ getIntelPath() {
2108
+ const projectPath = path.join(process.cwd(), '.ruvector', 'intelligence.json');
2109
+ const homePath = path.join(require('os').homedir(), '.ruvector', 'intelligence.json');
2110
+
2111
+ // If project .ruvector exists, use it
2112
+ if (fs.existsSync(path.dirname(projectPath))) {
2113
+ return projectPath;
2114
+ }
2115
+ // If project .claude exists (hooks initialized), prefer project-local
2116
+ if (fs.existsSync(path.join(process.cwd(), '.claude'))) {
2117
+ return projectPath;
2118
+ }
2119
+ // If home .ruvector exists with data, use it
2120
+ if (fs.existsSync(homePath)) {
2121
+ return homePath;
2122
+ }
2123
+ // Default to project-local for new setups
2124
+ return projectPath;
2125
+ }
2126
+
2107
2127
  load() {
2108
2128
  try {
2109
- if (fs.existsSync(INTEL_PATH)) {
2110
- return JSON.parse(fs.readFileSync(INTEL_PATH, 'utf-8'));
2129
+ if (fs.existsSync(this.intelPath)) {
2130
+ return JSON.parse(fs.readFileSync(this.intelPath, 'utf-8'));
2111
2131
  }
2112
2132
  } catch {}
2113
2133
  return {
@@ -2123,9 +2143,9 @@ class Intelligence {
2123
2143
  }
2124
2144
 
2125
2145
  save() {
2126
- const dir = path.dirname(INTEL_PATH);
2146
+ const dir = path.dirname(this.intelPath);
2127
2147
  if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
2128
- fs.writeFileSync(INTEL_PATH, JSON.stringify(this.data, null, 2));
2148
+ fs.writeFileSync(this.intelPath, JSON.stringify(this.data, null, 2));
2129
2149
  }
2130
2150
 
2131
2151
  now() { return Math.floor(Date.now() / 1000); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ruvector",
3
- "version": "0.1.48",
3
+ "version": "0.1.49",
4
4
  "description": "High-performance vector database for Node.js with automatic native/WASM fallback",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",