@simonfestl/husky-cli 1.25.1 ā 1.25.2
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/brain.js +0 -106
- package/package.json +1 -1
package/dist/commands/brain.js
CHANGED
|
@@ -698,112 +698,6 @@ brainCommand
|
|
|
698
698
|
process.exit(1);
|
|
699
699
|
}
|
|
700
700
|
});
|
|
701
|
-
// ============================================================================
|
|
702
|
-
// Auto-Brain: Hook Integration Commands
|
|
703
|
-
// ============================================================================
|
|
704
|
-
brainCommand
|
|
705
|
-
.command("auto-recall <prompt>")
|
|
706
|
-
.description("Automatically search brain for relevant memories based on user prompt (for hook integration)")
|
|
707
|
-
.option("-a, --agent <id>", "Agent ID", DEFAULT_AGENT)
|
|
708
|
-
.option("-l, --limit <num>", "Max results", "3")
|
|
709
|
-
.option("-m, --min-score <score>", "Minimum similarity score (0-1)", "0.6")
|
|
710
|
-
.option("--agent-type <type>", `Agent type for database selection (${AGENT_TYPES.join(", ")})`)
|
|
711
|
-
.option("--format <format>", "Output format (hint, json, markdown)", "hint")
|
|
712
|
-
.option("--quiet", "Suppress output if no results found")
|
|
713
|
-
.action(async (prompt, options) => {
|
|
714
|
-
try {
|
|
715
|
-
// Skip very short prompts (likely not meaningful queries)
|
|
716
|
-
if (prompt.length < 10) {
|
|
717
|
-
if (!options.quiet) {
|
|
718
|
-
console.log("");
|
|
719
|
-
}
|
|
720
|
-
return;
|
|
721
|
-
}
|
|
722
|
-
const brain = createBrain(options.agent, options.agentType);
|
|
723
|
-
const results = await brain.recall(prompt, parseInt(options.limit, 10), parseFloat(options.minScore));
|
|
724
|
-
if (results.length === 0) {
|
|
725
|
-
if (!options.quiet) {
|
|
726
|
-
console.log("");
|
|
727
|
-
}
|
|
728
|
-
return;
|
|
729
|
-
}
|
|
730
|
-
if (options.format === "json") {
|
|
731
|
-
console.log(JSON.stringify({ success: true, results }));
|
|
732
|
-
return;
|
|
733
|
-
}
|
|
734
|
-
if (options.format === "markdown") {
|
|
735
|
-
console.log("\n## š§ Brain Recall - Relevante Erinnerungen\n");
|
|
736
|
-
for (const r of results) {
|
|
737
|
-
const tags = r.memory.tags.length > 0 ? ` (Tags: ${r.memory.tags.join(", ")})` : "";
|
|
738
|
-
console.log(`- **[${(r.score * 100).toFixed(0)}%]** ${r.memory.content.slice(0, 150)}...${tags}`);
|
|
739
|
-
}
|
|
740
|
-
console.log("");
|
|
741
|
-
return;
|
|
742
|
-
}
|
|
743
|
-
// Default: hint format (compact, for hooks)
|
|
744
|
-
console.log("\nš§ BRAIN RECALL - Relevante Erinnerungen:");
|
|
745
|
-
console.log("ā".repeat(50));
|
|
746
|
-
for (const r of results) {
|
|
747
|
-
const tags = r.memory.tags.length > 0 ? ` [${r.memory.tags.join(", ")}]` : "";
|
|
748
|
-
console.log(` [${(r.score * 100).toFixed(0)}%] ${r.memory.content.slice(0, 120)}...${tags}`);
|
|
749
|
-
}
|
|
750
|
-
console.log("ā".repeat(50));
|
|
751
|
-
console.log("");
|
|
752
|
-
}
|
|
753
|
-
catch (error) {
|
|
754
|
-
// Fail silently for hook integration - don't block agent workflow
|
|
755
|
-
if (options.format === "json") {
|
|
756
|
-
console.log(JSON.stringify({ success: false, error: error.message }));
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
});
|
|
760
|
-
brainCommand
|
|
761
|
-
.command("auto-remember <content>")
|
|
762
|
-
.description("Automatically store a learning/insight (for hook integration after task completion)")
|
|
763
|
-
.option("-a, --agent <id>", "Agent ID", DEFAULT_AGENT)
|
|
764
|
-
.option("--agent-type <type>", `Agent type for database selection (${AGENT_TYPES.join(", ")})`)
|
|
765
|
-
.option("--task-id <id>", "Associated task ID")
|
|
766
|
-
.option("-t, --tags <tags>", "Comma-separated tags", "auto-learning")
|
|
767
|
-
.option("--source <source>", "Source of learning (task, conversation, tool)", "task")
|
|
768
|
-
.option("--json", "Output as JSON")
|
|
769
|
-
.action(async (content, options) => {
|
|
770
|
-
try {
|
|
771
|
-
// Skip very short content
|
|
772
|
-
if (content.length < 20) {
|
|
773
|
-
if (options.json) {
|
|
774
|
-
console.log(JSON.stringify({ success: false, error: "Content too short" }));
|
|
775
|
-
}
|
|
776
|
-
return;
|
|
777
|
-
}
|
|
778
|
-
const brain = createBrain(options.agent, options.agentType);
|
|
779
|
-
const tags = options.tags.split(",").map((t) => t.trim());
|
|
780
|
-
// Add source and task info to tags
|
|
781
|
-
if (options.source && !tags.includes(options.source)) {
|
|
782
|
-
tags.push(options.source);
|
|
783
|
-
}
|
|
784
|
-
if (options.taskId) {
|
|
785
|
-
tags.push(`task:${options.taskId}`);
|
|
786
|
-
}
|
|
787
|
-
const id = await brain.remember(content, tags, {
|
|
788
|
-
source: options.source,
|
|
789
|
-
taskId: options.taskId,
|
|
790
|
-
autoGenerated: true,
|
|
791
|
-
timestamp: new Date().toISOString(),
|
|
792
|
-
});
|
|
793
|
-
if (options.json) {
|
|
794
|
-
console.log(JSON.stringify({ success: true, id, tags }));
|
|
795
|
-
}
|
|
796
|
-
else {
|
|
797
|
-
console.log(` ā Auto-Remember: ${id.slice(0, 8)}... [${tags.join(", ")}]`);
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
catch (error) {
|
|
801
|
-
if (options.json) {
|
|
802
|
-
console.log(JSON.stringify({ success: false, error: error.message }));
|
|
803
|
-
}
|
|
804
|
-
// Fail silently for hook integration
|
|
805
|
-
}
|
|
806
|
-
});
|
|
807
701
|
brainCommand
|
|
808
702
|
.command("kb-stats <kb>")
|
|
809
703
|
.description("Show statistics for a knowledge base")
|