@tznthou/ccrecall 0.8.1 → 0.8.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/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@tznthou/ccrecall",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "AI memory service for Claude Code — on-demand context injection with metacognition",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
8
8
  "ccmem": "./dist/index.js",
9
- "ccmem-mcp": "./dist/mcp/server.js"
9
+ "ccmem-mcp": "./dist/mcp/server.js",
10
+ "ccmem-backfill": "./scripts/backfill-extract.sh"
10
11
  },
11
12
  "files": [
12
13
  "dist",
@@ -2,9 +2,11 @@
2
2
  # ccRecall backfill extraction — re-run memory extraction for sessions whose
3
3
  # original run never happened.
4
4
  #
5
- # Usage:
6
- # scripts/backfill-extract.sh <session-id> [session-id...]
7
- # scripts/backfill-extract.sh --from-log # sessions this bug killed
5
+ # Usage (installed from npm — the bin entry is what makes it executable):
6
+ # ccmem-backfill <session-id> [session-id...]
7
+ # ccmem-backfill --from-log # sessions this bug killed
8
+ # ccmem-backfill --from-log --dry-run
9
+ # From a checkout, the same thing:
8
10
  # scripts/backfill-extract.sh --from-log --dry-run
9
11
  #
10
12
  # Options:
@@ -40,7 +42,26 @@
40
42
 
41
43
  set -uo pipefail
42
44
 
43
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
45
+ # Resolve through symlinks before taking the directory. As an npm `bin` entry
46
+ # this file is reached through ~/.npm-global/bin/ccmem-backfill, which is a
47
+ # symlink — while the siblings it needs (post-session-extract.sh,
48
+ # extraction-prompt.md) sit next to the REAL file, not next to the link. Taking
49
+ # dirname of the link lands in the bin directory and the script dies at "wrapper
50
+ # not found" the moment it is run the way it is installed.
51
+ #
52
+ # The loop rather than `readlink -f`: that flag is GNU-only and macOS readlink
53
+ # does not have it. `cd -P` on top, because it resolves symlinked PARENT
54
+ # directories too — a `npm link`-style install symlinks the whole package
55
+ # directory, so the link chain has a component the readlink loop never sees.
56
+ _bf_source="${BASH_SOURCE[0]}"
57
+ while [ -L "$_bf_source" ]; do
58
+ _bf_dir="$(cd -P "$(dirname "$_bf_source")" && pwd)"
59
+ _bf_source="$(readlink "$_bf_source")"
60
+ [[ "$_bf_source" != /* ]] && _bf_source="${_bf_dir}/${_bf_source}"
61
+ done
62
+ SCRIPT_DIR="$(cd -P "$(dirname "$_bf_source")" && pwd)"
63
+ # The real file, for --help to read its own header out of.
64
+ SELF="$_bf_source"
44
65
  WRAPPER="${SCRIPT_DIR}/post-session-extract.sh"
45
66
  PROMPT_FILE="${SCRIPT_DIR}/extraction-prompt.md"
46
67
  CLAUDE_DATA_DIR="${HOME}/.claude"
@@ -72,7 +93,7 @@ while [[ $# -gt 0 ]]; do
72
93
  --from-log-all) FROM_LOG=1; FROM_LOG_ALL=1 ;;
73
94
  # Usage + Options only. The rationale below it is for whoever reads the
74
95
  # source; printing half of it (the range has to stop somewhere) helps nobody.
75
- -h|--help) sed -n '2,16p' "${BASH_SOURCE[0]}"; exit 0 ;;
96
+ -h|--help) sed -n '2,17p' "$SELF"; exit 0 ;;
76
97
  -*) die "unknown option: $1" ;;
77
98
  *) SESSION_IDS+=("$1") ;;
78
99
  esac