create-ai-memory 0.2.0 → 0.3.0
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
CHANGED
|
@@ -16,8 +16,9 @@ npm create ai-memory@latest
|
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
[](https://www.npmjs.com/package/create-ai-memory)
|
|
19
|
+
[](https://github.com/rambaarde/create-ai-memory/actions/workflows/ci.yml)
|
|
20
|
+
[](https://github.com/rambaarde/create-ai-memory/actions/workflows/publish.yml)
|
|
19
21
|

|
|
20
|
-

|
|
21
22
|

|
|
22
23
|

|
|
23
24
|

|
|
@@ -224,13 +225,6 @@ auto-scaffolds from the shipped templates on first use, so `install.sh` is
|
|
|
224
225
|
optional. Set `AI_MEM_ROOT` in `~/.zshrc` first if you do not want the default
|
|
225
226
|
`~/.ai-memory/_Ai_Memory`.
|
|
226
227
|
|
|
227
|
-
**Clone and run** (the source of truth all paths reuse):
|
|
228
|
-
|
|
229
|
-
```sh
|
|
230
|
-
git clone https://github.com/rambaarde/create-ai-memory.git ~/ai-memory
|
|
231
|
-
~/ai-memory/install.sh
|
|
232
|
-
```
|
|
233
|
-
|
|
234
228
|
> **zsh only.** The module uses `print -r`, `${(s:|:)}`, and associative arrays. A bash
|
|
235
229
|
> port is welcome as a PR; see [Roadmap](#roadmap).
|
|
236
230
|
|
|
@@ -457,6 +451,14 @@ lines.
|
|
|
457
451
|
|
|
458
452
|
## Contributing
|
|
459
453
|
|
|
454
|
+
Clone the repo and run `install.sh` from the checkout — that's the source of
|
|
455
|
+
truth every other install path (npm, plugin managers) reuses:
|
|
456
|
+
|
|
457
|
+
```sh
|
|
458
|
+
git clone https://github.com/rambaarde/create-ai-memory.git ~/ai-memory
|
|
459
|
+
~/ai-memory/install.sh
|
|
460
|
+
```
|
|
461
|
+
|
|
460
462
|
Issues and PRs are welcome. Good first areas: a bash port, new agent adapters, and
|
|
461
463
|
docs. Run `zsh tests/run.sh` before opening a PR; keep changes additive and the
|
|
462
464
|
vault path-guarded.
|
|
@@ -52,3 +52,18 @@ tmp="$(mktemp)"
|
|
|
52
52
|
awk -v m="$marker" 'index($0, m)==1 { exit } { print }' "$log" > "$tmp"
|
|
53
53
|
printf '%s\n\n%s\n' "$(cat "$tmp")" "$block" > "$log"
|
|
54
54
|
rm -f "$tmp"
|
|
55
|
+
|
|
56
|
+
# Optional vault backup: if AI_MEM_ROOT (or an ancestor directory) is its own
|
|
57
|
+
# git repo, commit and push whatever changed this session. Entirely separate
|
|
58
|
+
# from the project repo git calls above -- this targets the vault, not the
|
|
59
|
+
# code being worked on. No-ops silently if the vault isn't git-backed; this
|
|
60
|
+
# is best-effort and must never fail the hook or block the session on a push
|
|
61
|
+
# error (no network, no remote configured, etc).
|
|
62
|
+
vault_git_root="$(git -C "${AI_MEM_ROOT:-}" rev-parse --show-toplevel 2>/dev/null || true)"
|
|
63
|
+
if [ -n "$vault_git_root" ]; then
|
|
64
|
+
git -C "$vault_git_root" add -A 2>/dev/null || true
|
|
65
|
+
if ! git -C "$vault_git_root" diff --cached --quiet 2>/dev/null; then
|
|
66
|
+
git -C "$vault_git_root" commit -q -m "vault backup: ${stamp}" 2>/dev/null || true
|
|
67
|
+
git -C "$vault_git_root" push -q 2>/dev/null || true
|
|
68
|
+
fi
|
|
69
|
+
fi
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ai-memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Persistent, agent-agnostic session memory for AI coding CLIs (Claude Code, Codex, Gemini, Cursor, opencode). One Markdown vault, any agent.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-ai-memory": "bin/create-ai-memory.js"
|
package/shell/ai-mem.zsh
CHANGED
|
@@ -172,7 +172,12 @@ _ai_mem_prepare_session() {
|
|
|
172
172
|
"$AI_MEM_PROJECT_DIR/_project_template.md" > "$project_note"
|
|
173
173
|
fi
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
local prev_link=""
|
|
176
|
+
if [[ -n "$previous_session_note" ]]; then
|
|
177
|
+
prev_link="[[${previous_session_note:t:r}]]"
|
|
178
|
+
fi
|
|
179
|
+
|
|
180
|
+
SESSION_DATE="$(date +%Y-%m-%d)" PROJECT_NAME="$project_name" PREV_LINK="$prev_link" perl -0pe 's/\{\{date\}\}/$ENV{SESSION_DATE}/g; s/\{\{project_name\}\}/$ENV{PROJECT_NAME}/g; s/\{\{previous_session_link\}\}/$ENV{PREV_LINK}/g' \
|
|
176
181
|
"$AI_MEM_SESSION_DIR/_session_template.md" > "$session_note"
|
|
177
182
|
|
|
178
183
|
export AI_MEM_ACTIVE_PROJECT="$project_name"
|
|
@@ -459,6 +464,11 @@ source "$AI_MEM_HOME/adapters.zsh"
|
|
|
459
464
|
: "${AI_MEM_AGENTS:=claude codex gemini cursor opencode}"
|
|
460
465
|
for _ai_agent in ${(z)AI_MEM_AGENTS}; do
|
|
461
466
|
if typeset -f "_ai_adapter_$_ai_agent" >/dev/null; then
|
|
467
|
+
# A same-named alias (e.g. from another plugin) makes zsh refuse to
|
|
468
|
+
# `eval` a function definition of that name at all -- "defining
|
|
469
|
+
# function based on alias", parse error near '()'. Clear it first;
|
|
470
|
+
# the function this defines is what should win.
|
|
471
|
+
unalias "${_ai_agent}-start" 2>/dev/null
|
|
462
472
|
eval "${_ai_agent}-start() { _ai_session_start ${_ai_agent} \"\$@\"; }"
|
|
463
473
|
fi
|
|
464
474
|
done
|