ruvector 0.1.43 → 0.1.44
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 +55 -1
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -2267,7 +2267,7 @@ class Intelligence {
|
|
|
2267
2267
|
// Hooks command group
|
|
2268
2268
|
const hooksCmd = program.command('hooks').description('Self-learning intelligence hooks for Claude Code');
|
|
2269
2269
|
|
|
2270
|
-
hooksCmd.command('init').description('Initialize hooks in current project').option('--force', 'Force overwrite').action((opts) => {
|
|
2270
|
+
hooksCmd.command('init').description('Initialize hooks in current project').option('--force', 'Force overwrite').option('--no-claude-md', 'Skip CLAUDE.md creation').action((opts) => {
|
|
2271
2271
|
const settingsPath = path.join(process.cwd(), '.claude', 'settings.json');
|
|
2272
2272
|
const settingsDir = path.dirname(settingsPath);
|
|
2273
2273
|
if (!fs.existsSync(settingsDir)) fs.mkdirSync(settingsDir, { recursive: true });
|
|
@@ -2297,6 +2297,60 @@ hooksCmd.command('init').description('Initialize hooks in current project').opti
|
|
|
2297
2297
|
settings.hooks.Stop = [{ hooks: [{ type: 'command', command: 'npx ruvector hooks session-end' }] }];
|
|
2298
2298
|
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
2299
2299
|
console.log(chalk.green('✅ Hooks initialized in .claude/settings.json'));
|
|
2300
|
+
|
|
2301
|
+
// Create CLAUDE.md if it doesn't exist (or force)
|
|
2302
|
+
const claudeMdPath = path.join(process.cwd(), 'CLAUDE.md');
|
|
2303
|
+
if (opts.claudeMd !== false && (!fs.existsSync(claudeMdPath) || opts.force)) {
|
|
2304
|
+
const claudeMdContent = `# Claude Code Project Configuration
|
|
2305
|
+
|
|
2306
|
+
## RuVector Self-Learning Hooks
|
|
2307
|
+
|
|
2308
|
+
This project uses RuVector's self-learning intelligence hooks for enhanced AI-assisted development.
|
|
2309
|
+
|
|
2310
|
+
### Active Hooks
|
|
2311
|
+
|
|
2312
|
+
| Hook | Trigger | Purpose |
|
|
2313
|
+
|------|---------|---------|
|
|
2314
|
+
| PreToolUse | Before Edit/Write/Bash | Agent routing, command analysis |
|
|
2315
|
+
| PostToolUse | After Edit/Write/Bash | Q-learning update, pattern recording |
|
|
2316
|
+
| SessionStart | Conversation begins | Load intelligence, display stats |
|
|
2317
|
+
| Stop | Conversation ends | Save learning data |
|
|
2318
|
+
|
|
2319
|
+
### Commands
|
|
2320
|
+
|
|
2321
|
+
\`\`\`bash
|
|
2322
|
+
# View learning statistics
|
|
2323
|
+
npx ruvector hooks stats
|
|
2324
|
+
|
|
2325
|
+
# Route a task to best agent
|
|
2326
|
+
npx ruvector hooks route "implement feature X"
|
|
2327
|
+
|
|
2328
|
+
# Store context in memory
|
|
2329
|
+
npx ruvector hooks remember "important context" -t project
|
|
2330
|
+
|
|
2331
|
+
# Recall from memory
|
|
2332
|
+
npx ruvector hooks recall "context query"
|
|
2333
|
+
\`\`\`
|
|
2334
|
+
|
|
2335
|
+
### How It Works
|
|
2336
|
+
|
|
2337
|
+
1. **Pre-edit hooks** analyze files and suggest the best agent for the task
|
|
2338
|
+
2. **Post-edit hooks** record outcomes to improve future suggestions via Q-learning
|
|
2339
|
+
3. **Memory hooks** store and retrieve context using vector embeddings
|
|
2340
|
+
4. **Session hooks** manage learning state across conversations
|
|
2341
|
+
|
|
2342
|
+
### Configuration
|
|
2343
|
+
|
|
2344
|
+
Settings are stored in \`.claude/settings.json\`. Run \`npx ruvector hooks init\` to regenerate.
|
|
2345
|
+
|
|
2346
|
+
---
|
|
2347
|
+
*Powered by [RuVector](https://github.com/ruvnet/ruvector) self-learning intelligence*
|
|
2348
|
+
`;
|
|
2349
|
+
fs.writeFileSync(claudeMdPath, claudeMdContent);
|
|
2350
|
+
console.log(chalk.green('✅ CLAUDE.md created in project root'));
|
|
2351
|
+
} else if (fs.existsSync(claudeMdPath) && !opts.force) {
|
|
2352
|
+
console.log(chalk.yellow('ℹ️ CLAUDE.md already exists (use --force to overwrite)'));
|
|
2353
|
+
}
|
|
2300
2354
|
});
|
|
2301
2355
|
|
|
2302
2356
|
hooksCmd.command('stats').description('Show intelligence statistics').action(() => {
|