opencode-claude-memory 1.4.0 → 1.5.1
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/README.md +7 -1
- package/bin/opencode-memory +28 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,6 +65,12 @@ opencode-memory uninstall # removes shell hook from .zshrc/.bashrc
|
|
|
65
65
|
npm uninstall -g opencode-claude-memory
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
+
To print the wrapper package version:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
opencode-memory self -v
|
|
72
|
+
```
|
|
73
|
+
|
|
68
74
|
This removes the shell hook, the CLI, and the plugin. Your saved memories in `~/.claude/projects/` are **not** deleted.
|
|
69
75
|
|
|
70
76
|
## 💡 Why this exists
|
|
@@ -168,7 +174,7 @@ Yes. Set `OPENCODE_MEMORY_AUTODREAM=0`. You can also tune gates with:
|
|
|
168
174
|
|
|
169
175
|
### Logs
|
|
170
176
|
|
|
171
|
-
Logs are written to
|
|
177
|
+
Logs are written to `/tmp/opencode-claude-memory/<project-hash>/`:
|
|
172
178
|
- `extract-*.log`: automatic memory extraction
|
|
173
179
|
- `dream-*.log`: auto-dream consolidation
|
|
174
180
|
|
package/bin/opencode-memory
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
# Subcommands:
|
|
9
9
|
# opencode-memory install — Install shell hook to ~/.zshrc or ~/.bashrc
|
|
10
10
|
# opencode-memory uninstall — Remove shell hook
|
|
11
|
+
# opencode-memory self -v — Print the wrapper package version
|
|
11
12
|
# opencode-memory [args...] — Run opencode with post-session memory maintenance
|
|
12
13
|
#
|
|
13
14
|
# How it works:
|
|
@@ -39,6 +40,22 @@
|
|
|
39
40
|
|
|
40
41
|
set -euo pipefail
|
|
41
42
|
|
|
43
|
+
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
44
|
+
PACKAGE_JSON="$SCRIPT_DIR/../package.json"
|
|
45
|
+
|
|
46
|
+
print_wrapper_version() {
|
|
47
|
+
local version
|
|
48
|
+
|
|
49
|
+
version=$(awk -F'"' '/^[[:space:]]*"version"[[:space:]]*:/ { print $4; exit }' "$PACKAGE_JSON")
|
|
50
|
+
|
|
51
|
+
if [ -z "$version" ]; then
|
|
52
|
+
echo "[opencode-memory] ERROR: Cannot read package version from $PACKAGE_JSON" >&2
|
|
53
|
+
exit 1
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
printf '%s\n' "$version"
|
|
57
|
+
}
|
|
58
|
+
|
|
42
59
|
# ============================================================================
|
|
43
60
|
# Shell Hook Management
|
|
44
61
|
# ============================================================================
|
|
@@ -138,6 +155,14 @@ case "${1:-}" in
|
|
|
138
155
|
uninstall_hook
|
|
139
156
|
exit 0
|
|
140
157
|
;;
|
|
158
|
+
self)
|
|
159
|
+
case "${2:-}" in
|
|
160
|
+
-v|--version|version)
|
|
161
|
+
print_wrapper_version
|
|
162
|
+
exit 0
|
|
163
|
+
;;
|
|
164
|
+
esac
|
|
165
|
+
;;
|
|
141
166
|
esac
|
|
142
167
|
|
|
143
168
|
# ============================================================================
|
|
@@ -179,13 +204,7 @@ AUTODREAM_STALE_LOCK_SECS=$((60 * 60))
|
|
|
179
204
|
|
|
180
205
|
WORKING_DIR="${OPENCODE_MEMORY_DIR:-$(pwd)}"
|
|
181
206
|
|
|
182
|
-
|
|
183
|
-
while [ "$TMP_BASE_DIR" != "/" ] && [ "${TMP_BASE_DIR%/}" != "$TMP_BASE_DIR" ]; do
|
|
184
|
-
TMP_BASE_DIR="${TMP_BASE_DIR%/}"
|
|
185
|
-
done
|
|
186
|
-
if [ -z "$TMP_BASE_DIR" ]; then
|
|
187
|
-
TMP_BASE_DIR="/"
|
|
188
|
-
fi
|
|
207
|
+
LOG_BASE_DIR="/tmp/opencode-claude-memory"
|
|
189
208
|
|
|
190
209
|
# Scope lock files at project root granularity (not per-subdirectory).
|
|
191
210
|
PROJECT_SCOPE_DIR="$WORKING_DIR"
|
|
@@ -196,7 +215,7 @@ fi
|
|
|
196
215
|
PROJECT_KEY="$(printf '%s' "$PROJECT_SCOPE_DIR" | cksum | awk '{print $1}')"
|
|
197
216
|
|
|
198
217
|
# Lock files (prevent concurrent work on the same project)
|
|
199
|
-
LOCK_DIR="
|
|
218
|
+
LOCK_DIR="/tmp/opencode-memory-locks"
|
|
200
219
|
mkdir -p "$LOCK_DIR"
|
|
201
220
|
EXTRACT_LOCK_FILE="$LOCK_DIR/${PROJECT_KEY}.extract.lock"
|
|
202
221
|
|
|
@@ -205,7 +224,7 @@ mkdir -p "$STATE_DIR"
|
|
|
205
224
|
CONSOLIDATION_LOCK_FILE="$STATE_DIR/${PROJECT_KEY}.consolidate-lock"
|
|
206
225
|
|
|
207
226
|
# Logs
|
|
208
|
-
LOG_DIR="$
|
|
227
|
+
LOG_DIR="$LOG_BASE_DIR/${PROJECT_KEY}"
|
|
209
228
|
mkdir -p "$LOG_DIR"
|
|
210
229
|
TASK_LOG_PREFIX="$(date +%Y%m%d-%H%M%S)-${PROJECT_KEY}"
|
|
211
230
|
EXTRACT_LOG_FILE="$LOG_DIR/extract-${TASK_LOG_PREFIX}.log"
|
package/package.json
CHANGED