local-agent-memory 1.0.11 → 1.0.12
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/cli/commands/hook.js +14 -1
- package/dist/cli/commands/init.js +13 -0
- package/package.json +1 -1
|
@@ -26,6 +26,12 @@ async function installGitHook() {
|
|
|
26
26
|
const hookContent = `#!/bin/sh
|
|
27
27
|
# local-agent-memory prepare-commit-msg hook
|
|
28
28
|
|
|
29
|
+
# Only inject reminder when opening interactive editor, not for automated / GUI / -m commits
|
|
30
|
+
COMMIT_SOURCE="$2"
|
|
31
|
+
if [ "$COMMIT_SOURCE" = "message" ]; then
|
|
32
|
+
exit 0
|
|
33
|
+
fi
|
|
34
|
+
|
|
29
35
|
# Add a reminder to the commit message template
|
|
30
36
|
echo "" >> "$1"
|
|
31
37
|
echo '# 🧠 Remember to update the local-agent-memory ledger if you made architectural changes.' >> "$1"
|
|
@@ -45,9 +51,16 @@ echo '# You can run: memory record-session --summary "..."' >> "$1"
|
|
|
45
51
|
# local-agent-memory post-commit hook
|
|
46
52
|
# Automatically records a memory session for this commit with changed files.
|
|
47
53
|
|
|
48
|
-
COMMIT_MSG=$(git log -1 --pretty=%B)
|
|
49
54
|
CHANGED_FILES=$(git diff-tree --no-commit-id --name-status -r HEAD)
|
|
50
55
|
|
|
56
|
+
# Avoid infinite loops: if the commit only touches .memory files, do not record a new session
|
|
57
|
+
NON_MEMORY_CHANGES=$(echo "$CHANGED_FILES" | grep -v -E '^[A-Z0-9]+[[:space:]]+\\.memory/' | grep -v '^[[:space:]]*$')
|
|
58
|
+
if [ -z "$NON_MEMORY_CHANGES" ]; then
|
|
59
|
+
exit 0
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
COMMIT_MSG=$(git log -1 --pretty=%B)
|
|
63
|
+
|
|
51
64
|
SUMMARY="Commit: $COMMIT_MSG
|
|
52
65
|
|
|
53
66
|
Modified files:
|
|
@@ -88,6 +88,19 @@ async function initProject(options = {}) {
|
|
|
88
88
|
resolve();
|
|
89
89
|
});
|
|
90
90
|
});
|
|
91
|
+
// Ensure .gitignore ignores local binary databases
|
|
92
|
+
const gitignorePath = node_path_1.default.join(cwd, ".gitignore");
|
|
93
|
+
try {
|
|
94
|
+
if (node_fs_1.default.existsSync(gitignorePath)) {
|
|
95
|
+
const gitignoreContent = await node_fs_1.default.promises.readFile(gitignorePath, "utf8");
|
|
96
|
+
if (!gitignoreContent.includes(".memory/*.sqlite")) {
|
|
97
|
+
await node_fs_1.default.promises.appendFile(gitignorePath, "\n# local-agent-memory local SQLite database\n.memory/*.sqlite*\n");
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// Non-fatal if .gitignore cannot be read or written
|
|
103
|
+
}
|
|
91
104
|
// Global Registry
|
|
92
105
|
// Make sure global registry db is initialized
|
|
93
106
|
const registryDb = (0, registry_1.initRegistryDb)();
|