ruvector 0.1.74 → 0.1.75
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/bin/cli.js +85 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -12
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -2752,6 +2752,7 @@ hooksCmd.command('init')
|
|
|
2752
2752
|
.description('Initialize hooks in current project')
|
|
2753
2753
|
.option('--force', 'Force overwrite existing settings')
|
|
2754
2754
|
.option('--minimal', 'Only basic hooks (no env, permissions, or advanced hooks)')
|
|
2755
|
+
.option('--fast', 'Use fast local wrapper (20x faster, bypasses npx overhead)')
|
|
2755
2756
|
.option('--no-claude-md', 'Skip CLAUDE.md creation')
|
|
2756
2757
|
.option('--no-permissions', 'Skip permissions configuration')
|
|
2757
2758
|
.option('--no-env', 'Skip environment variables')
|
|
@@ -2763,6 +2764,7 @@ hooksCmd.command('init')
|
|
|
2763
2764
|
.action(async (opts) => {
|
|
2764
2765
|
const settingsPath = path.join(process.cwd(), '.claude', 'settings.json');
|
|
2765
2766
|
const settingsDir = path.dirname(settingsPath);
|
|
2767
|
+
const isWindows = process.platform === 'win32';
|
|
2766
2768
|
if (!fs.existsSync(settingsDir)) fs.mkdirSync(settingsDir, { recursive: true });
|
|
2767
2769
|
let settings = {};
|
|
2768
2770
|
if (fs.existsSync(settingsPath) && !opts.force) {
|
|
@@ -2836,8 +2838,6 @@ hooksCmd.command('init')
|
|
|
2836
2838
|
// StatusLine configuration (unless --minimal or --no-statusline)
|
|
2837
2839
|
if (!opts.minimal && opts.statusline !== false) {
|
|
2838
2840
|
if (!settings.statusLine) {
|
|
2839
|
-
const isWindows = process.platform === 'win32';
|
|
2840
|
-
|
|
2841
2841
|
if (isWindows) {
|
|
2842
2842
|
// Windows: PowerShell statusline
|
|
2843
2843
|
const statuslineScript = path.join(settingsDir, 'statusline-command.ps1');
|
|
@@ -2920,19 +2920,82 @@ fi
|
|
|
2920
2920
|
}
|
|
2921
2921
|
}
|
|
2922
2922
|
|
|
2923
|
-
//
|
|
2923
|
+
// Fast wrapper creation (--fast option) - 20x faster than npx
|
|
2924
|
+
let hookCmd = 'npx ruvector@latest';
|
|
2925
|
+
let fastTimeouts = { simple: 2000, complex: 2000, session: 5000 };
|
|
2926
|
+
if (opts.fast && !isWindows) {
|
|
2927
|
+
const fastWrapperPath = path.join(settingsDir, 'ruvector-fast.sh');
|
|
2928
|
+
const fastWrapperContent = `#!/bin/bash
|
|
2929
|
+
# Fast RuVector hooks wrapper - avoids npx overhead (20x faster)
|
|
2930
|
+
# Usage: .claude/ruvector-fast.sh hooks <command> [args...]
|
|
2931
|
+
|
|
2932
|
+
# Find ruvector CLI - check local first, then global
|
|
2933
|
+
RUVECTOR_CLI=""
|
|
2934
|
+
|
|
2935
|
+
# Check local npm package (for development)
|
|
2936
|
+
if [ -f "$PWD/npm/packages/ruvector/bin/cli.js" ]; then
|
|
2937
|
+
RUVECTOR_CLI="$PWD/npm/packages/ruvector/bin/cli.js"
|
|
2938
|
+
# Check node_modules
|
|
2939
|
+
elif [ -f "$PWD/node_modules/ruvector/bin/cli.js" ]; then
|
|
2940
|
+
RUVECTOR_CLI="$PWD/node_modules/ruvector/bin/cli.js"
|
|
2941
|
+
# Check global npm installation
|
|
2942
|
+
elif [ -f "$PWD/node_modules/.bin/ruvector" ]; then
|
|
2943
|
+
exec "$PWD/node_modules/.bin/ruvector" "$@"
|
|
2944
|
+
elif command -v ruvector &> /dev/null; then
|
|
2945
|
+
exec ruvector "$@"
|
|
2946
|
+
# Fallback to npx (slow but works)
|
|
2947
|
+
else
|
|
2948
|
+
exec npx ruvector@latest "$@"
|
|
2949
|
+
fi
|
|
2950
|
+
|
|
2951
|
+
# Execute with node directly (fast path)
|
|
2952
|
+
exec node "$RUVECTOR_CLI" "$@"
|
|
2953
|
+
`;
|
|
2954
|
+
fs.writeFileSync(fastWrapperPath, fastWrapperContent);
|
|
2955
|
+
fs.chmodSync(fastWrapperPath, '755');
|
|
2956
|
+
hookCmd = '.claude/ruvector-fast.sh';
|
|
2957
|
+
fastTimeouts = { simple: 300, complex: 500, session: 1000 };
|
|
2958
|
+
// Add permission for fast wrapper
|
|
2959
|
+
if (settings.permissions && settings.permissions.allow) {
|
|
2960
|
+
if (!settings.permissions.allow.includes('Bash(.claude/ruvector-fast.sh:*)')) {
|
|
2961
|
+
settings.permissions.allow.push('Bash(.claude/ruvector-fast.sh:*)');
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
console.log(chalk.blue(' ✓ Fast wrapper created (.claude/ruvector-fast.sh) - 20x faster hooks'));
|
|
2965
|
+
}
|
|
2966
|
+
|
|
2967
|
+
// Core hooks (always included) - with timeouts and error suppression
|
|
2924
2968
|
settings.hooks = settings.hooks || {};
|
|
2925
2969
|
settings.hooks.PreToolUse = [
|
|
2926
|
-
{
|
|
2927
|
-
|
|
2970
|
+
{
|
|
2971
|
+
matcher: 'Edit|Write|MultiEdit',
|
|
2972
|
+
hooks: [
|
|
2973
|
+
{ type: 'command', timeout: fastTimeouts.complex, command: `${hookCmd} hooks pre-edit "$TOOL_INPUT_file_path" 2>/dev/null || true` },
|
|
2974
|
+
{ type: 'command', timeout: fastTimeouts.complex, command: `${hookCmd} hooks coedit-suggest --file "$TOOL_INPUT_file_path" 2>/dev/null || true` }
|
|
2975
|
+
]
|
|
2976
|
+
},
|
|
2977
|
+
{ matcher: 'Bash', hooks: [{ type: 'command', timeout: fastTimeouts.complex, command: `${hookCmd} hooks pre-command "$TOOL_INPUT_command" 2>/dev/null || true` }] },
|
|
2978
|
+
{ matcher: 'Read', hooks: [{ type: 'command', timeout: fastTimeouts.simple, command: `${hookCmd} hooks remember "Reading: $TOOL_INPUT_file_path" -t file_access 2>/dev/null || true` }] },
|
|
2979
|
+
{ matcher: 'Glob|Grep', hooks: [{ type: 'command', timeout: fastTimeouts.simple, command: `${hookCmd} hooks remember "Search: $TOOL_INPUT_pattern" -t search_pattern 2>/dev/null || true` }] },
|
|
2980
|
+
{ matcher: 'Task', hooks: [{ type: 'command', timeout: fastTimeouts.simple, command: `${hookCmd} hooks remember "Agent: $TOOL_INPUT_subagent_type" -t agent_spawn 2>/dev/null || true` }] }
|
|
2928
2981
|
];
|
|
2929
2982
|
settings.hooks.PostToolUse = [
|
|
2930
|
-
{ matcher: 'Edit|Write|MultiEdit', hooks: [{ type: 'command', command:
|
|
2931
|
-
{ matcher: 'Bash', hooks: [{ type: 'command', command:
|
|
2983
|
+
{ matcher: 'Edit|Write|MultiEdit', hooks: [{ type: 'command', timeout: fastTimeouts.complex, command: `${hookCmd} hooks post-edit "$TOOL_INPUT_file_path" 2>/dev/null || true` }] },
|
|
2984
|
+
{ matcher: 'Bash', hooks: [{ type: 'command', timeout: fastTimeouts.complex, command: `${hookCmd} hooks post-command "$TOOL_INPUT_command" 2>/dev/null || true` }] }
|
|
2932
2985
|
];
|
|
2933
|
-
settings.hooks.SessionStart = [{
|
|
2934
|
-
|
|
2935
|
-
|
|
2986
|
+
settings.hooks.SessionStart = [{
|
|
2987
|
+
hooks: [
|
|
2988
|
+
{ type: 'command', timeout: fastTimeouts.session, command: `${hookCmd} hooks session-start 2>/dev/null || true` },
|
|
2989
|
+
{ type: 'command', timeout: fastTimeouts.complex, command: `${hookCmd} hooks trajectory-begin -c "claude-session" -a "claude" 2>/dev/null || true` }
|
|
2990
|
+
]
|
|
2991
|
+
}];
|
|
2992
|
+
settings.hooks.Stop = [{
|
|
2993
|
+
hooks: [
|
|
2994
|
+
{ type: 'command', timeout: fastTimeouts.complex, command: `${hookCmd} hooks trajectory-end --success --quality 0.8 2>/dev/null || true` },
|
|
2995
|
+
{ type: 'command', timeout: fastTimeouts.complex, command: `${hookCmd} hooks session-end 2>/dev/null || true` }
|
|
2996
|
+
]
|
|
2997
|
+
}];
|
|
2998
|
+
console.log(chalk.blue(` ✓ Core hooks (PreToolUse, PostToolUse, SessionStart, Stop) ${opts.fast ? 'with fast wrapper' : 'with error handling'}`));
|
|
2936
2999
|
|
|
2937
3000
|
// Advanced hooks (unless --minimal)
|
|
2938
3001
|
if (!opts.minimal) {
|
|
@@ -2940,8 +3003,8 @@ fi
|
|
|
2940
3003
|
settings.hooks.UserPromptSubmit = [{
|
|
2941
3004
|
hooks: [{
|
|
2942
3005
|
type: 'command',
|
|
2943
|
-
timeout:
|
|
2944
|
-
command:
|
|
3006
|
+
timeout: fastTimeouts.complex,
|
|
3007
|
+
command: `${hookCmd} hooks suggest-context 2>/dev/null || true`
|
|
2945
3008
|
}]
|
|
2946
3009
|
}];
|
|
2947
3010
|
|
|
@@ -2949,18 +3012,17 @@ fi
|
|
|
2949
3012
|
settings.hooks.PreCompact = [
|
|
2950
3013
|
{
|
|
2951
3014
|
matcher: 'auto',
|
|
2952
|
-
hooks: [
|
|
2953
|
-
type: 'command',
|
|
2954
|
-
timeout:
|
|
2955
|
-
|
|
2956
|
-
}]
|
|
3015
|
+
hooks: [
|
|
3016
|
+
{ type: 'command', timeout: fastTimeouts.session, command: `${hookCmd} hooks pre-compact --auto 2>/dev/null || true` },
|
|
3017
|
+
{ type: 'command', timeout: fastTimeouts.session, command: `${hookCmd} hooks compress 2>/dev/null || true` }
|
|
3018
|
+
]
|
|
2957
3019
|
},
|
|
2958
3020
|
{
|
|
2959
3021
|
matcher: 'manual',
|
|
2960
3022
|
hooks: [{
|
|
2961
3023
|
type: 'command',
|
|
2962
|
-
timeout:
|
|
2963
|
-
command:
|
|
3024
|
+
timeout: fastTimeouts.session,
|
|
3025
|
+
command: `${hookCmd} hooks pre-compact 2>/dev/null || true`
|
|
2964
3026
|
}]
|
|
2965
3027
|
}
|
|
2966
3028
|
];
|
|
@@ -2970,11 +3032,11 @@ fi
|
|
|
2970
3032
|
matcher: '.*',
|
|
2971
3033
|
hooks: [{
|
|
2972
3034
|
type: 'command',
|
|
2973
|
-
timeout:
|
|
2974
|
-
command:
|
|
3035
|
+
timeout: fastTimeouts.simple,
|
|
3036
|
+
command: `${hookCmd} hooks track-notification 2>/dev/null || true`
|
|
2975
3037
|
}]
|
|
2976
3038
|
}];
|
|
2977
|
-
console.log(chalk.blue(
|
|
3039
|
+
console.log(chalk.blue(` ✓ Advanced hooks (UserPromptSubmit, PreCompact, Notification, Compress)${opts.fast ? ' - fast mode' : ''}`));
|
|
2978
3040
|
|
|
2979
3041
|
// Extended environment variables for new capabilities
|
|
2980
3042
|
settings.env.RUVECTOR_AST_ENABLED = settings.env.RUVECTOR_AST_ENABLED || 'true';
|
|
@@ -3176,6 +3238,7 @@ Stored in \`.ruvector/intelligence.json\`:
|
|
|
3176
3238
|
\`\`\`bash
|
|
3177
3239
|
npx ruvector hooks init # Full configuration with all capabilities
|
|
3178
3240
|
npx ruvector hooks init --minimal # Basic hooks only
|
|
3241
|
+
npx ruvector hooks init --fast # Use fast local wrapper (20x faster)
|
|
3179
3242
|
npx ruvector hooks init --pretrain # Initialize + pretrain from git history
|
|
3180
3243
|
npx ruvector hooks init --build-agents quality # Generate optimized agents
|
|
3181
3244
|
npx ruvector hooks init --force # Overwrite existing configuration
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,SAAS,CAAC;AAGxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAE3B,QAAA,IAAI,cAAc,EAAE,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,SAAS,CAAC;AAGxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAE3B,QAAA,IAAI,cAAc,EAAE,GAAG,CAAC;AAmCxB;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,QAAQ,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,wBAAgB,QAAQ,IA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AY,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,CAAC,CAAC;IAuB1N;;OAEG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,YAAY,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GAAG,IAAI,CAAC;IAW5G;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI1C;;OAEG;IACG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;IAI5B;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;CAGlC;AAGD,eAAO,MAAM,QAAQ,wBAAkB,CAAC;AACxC,eAAO,MAAM,QAAQ,wBAAkB,CAAC;AAGxC,eAAO,MAAM,cAAc,KAA0B,CAAC;AAGtD,eAAe,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -39,21 +39,31 @@ try {
|
|
|
39
39
|
// Try to load native module first
|
|
40
40
|
implementation = require('@ruvector/core');
|
|
41
41
|
implementationType = 'native';
|
|
42
|
-
// Verify it's actually working
|
|
43
|
-
if (typeof implementation.
|
|
44
|
-
throw new Error('Native module loaded but
|
|
42
|
+
// Verify it's actually working (native module exports VectorDb, not VectorDB)
|
|
43
|
+
if (typeof implementation.VectorDb !== 'function') {
|
|
44
|
+
throw new Error('Native module loaded but VectorDb class not found');
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
catch (e) {
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
// Graceful fallback - don't crash, just warn
|
|
49
|
+
console.warn('[RuVector] Native module not available:', e.message);
|
|
50
|
+
console.warn('[RuVector] Vector operations will be limited. Install @ruvector/core for full functionality.');
|
|
51
|
+
// Create a stub implementation that provides basic functionality
|
|
52
|
+
implementation = {
|
|
53
|
+
VectorDb: class StubVectorDb {
|
|
54
|
+
constructor() {
|
|
55
|
+
console.warn('[RuVector] Using stub VectorDb - install @ruvector/core for native performance');
|
|
56
|
+
}
|
|
57
|
+
async insert() { return 'stub-id-' + Date.now(); }
|
|
58
|
+
async insertBatch(entries) { return entries.map(() => 'stub-id-' + Date.now()); }
|
|
59
|
+
async search() { return []; }
|
|
60
|
+
async delete() { return true; }
|
|
61
|
+
async get() { return null; }
|
|
62
|
+
async len() { return 0; }
|
|
63
|
+
async isEmpty() { return true; }
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
implementationType = 'wasm'; // Mark as fallback mode
|
|
57
67
|
}
|
|
58
68
|
/**
|
|
59
69
|
* Get the current implementation type
|