create-ai-memory 0.2.1 → 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
  [![npm](https://img.shields.io/npm/v/create-ai-memory?color=cb3837&label=npm)](https://www.npmjs.com/package/create-ai-memory)
19
+ [![ci](https://img.shields.io/github/actions/workflow/status/rambaarde/create-ai-memory/ci.yml?label=ci)](https://github.com/rambaarde/create-ai-memory/actions/workflows/ci.yml)
20
+ [![release](https://img.shields.io/github/actions/workflow/status/rambaarde/create-ai-memory/publish.yml?label=release)](https://github.com/rambaarde/create-ai-memory/actions/workflows/publish.yml)
19
21
  ![zsh](https://img.shields.io/badge/shell-zsh-89e051)
20
- ![tests](https://img.shields.io/badge/tests-44%20passing-brightgreen)
21
22
  ![deps](https://img.shields.io/badge/runtime%20deps-0-blue)
22
23
  ![license](https://img.shields.io/badge/license-MIT-blue)
23
24
  ![PRs](https://img.shields.io/badge/PRs-welcome-orange)
@@ -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.2.1",
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
- SESSION_DATE="$(date +%Y-%m-%d)" PROJECT_NAME="$project_name" perl -0pe 's/\{\{date\}\}/$ENV{SESSION_DATE}/g; s/\{\{project_name\}\}/$ENV{PROJECT_NAME}/g' \
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"
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  date: {{date}}
3
- project: {{project_name}}
3
+ project: "[[{{project_name}}]]"
4
+ previous: "{{previous_session_link}}"
4
5
  repo_root: [Insert Repo Root]
5
6
  ---
6
7