cc-discipline 2.1.0 → 2.2.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.
Files changed (2) hide show
  1. package/init.sh +43 -10
  2. package/package.json +1 -1
package/init.sh CHANGED
@@ -7,8 +7,12 @@
7
7
 
8
8
  set -e
9
9
 
10
- # ─── Version ───
11
- VERSION="2.0.0"
10
+ # ─── Version (single source: package.json) ───
11
+ _INIT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
+ if command -v node &>/dev/null && [ -f "$_INIT_DIR/package.json" ]; then
13
+ VERSION=$(node -p "require('$_INIT_DIR/package.json').version" 2>/dev/null)
14
+ fi
15
+ VERSION="${VERSION:-unknown}"
12
16
 
13
17
  # ─── Parse CLI arguments ───
14
18
  ARG_STACK=""
@@ -390,16 +394,45 @@ if [ ! -f "docs/debug-log.md" ]; then
390
394
  cp "$SCRIPT_DIR/templates/docs/debug-log.md" docs/
391
395
  fi
392
396
 
393
- # ─── Install auto memory ───
397
+ # ─── Install auto memory (symlink to .claude/memory/) ───
394
398
  echo -e "${GREEN}Installing auto memory...${NC}"
395
399
  MEMORY_PROJECT_KEY=$(echo "$PROJECT_DIR" | sed 's|/|-|g')
396
- MEMORY_DIR="$HOME/.claude/projects/${MEMORY_PROJECT_KEY}/memory"
397
- mkdir -p "$MEMORY_DIR"
398
- if [ ! -f "$MEMORY_DIR/MEMORY.md" ]; then
399
- cp "$SCRIPT_DIR/templates/memory/MEMORY.md" "$MEMORY_DIR/MEMORY.md"
400
- echo " ✓ Memory installed to $MEMORY_DIR/MEMORY.md"
400
+ MEMORY_CLAUDE_DIR="$HOME/.claude/projects/${MEMORY_PROJECT_KEY}"
401
+ MEMORY_LOCAL_DIR="$PROJECT_DIR/.claude/memory"
402
+
403
+ # Ensure local .claude/memory/ exists in repo
404
+ mkdir -p "$MEMORY_LOCAL_DIR"
405
+
406
+ # If MEMORY.md doesn't exist locally, seed from template
407
+ if [ ! -f "$MEMORY_LOCAL_DIR/MEMORY.md" ]; then
408
+ cp "$SCRIPT_DIR/templates/memory/MEMORY.md" "$MEMORY_LOCAL_DIR/MEMORY.md"
409
+ echo " ✓ Memory template installed to .claude/memory/MEMORY.md"
410
+ else
411
+ echo -e " ${YELLOW}.claude/memory/MEMORY.md already exists (preserved)${NC}"
412
+ fi
413
+
414
+ # Create symlink: ~/.claude/projects/<key>/memory → .claude/memory/
415
+ mkdir -p "$MEMORY_CLAUDE_DIR"
416
+ if [ -L "$MEMORY_CLAUDE_DIR/memory" ]; then
417
+ # Symlink already exists — update it
418
+ rm "$MEMORY_CLAUDE_DIR/memory"
419
+ ln -s "$MEMORY_LOCAL_DIR" "$MEMORY_CLAUDE_DIR/memory"
420
+ echo " ✓ Memory symlink updated"
421
+ elif [ -d "$MEMORY_CLAUDE_DIR/memory" ]; then
422
+ # Existing real directory — migrate files then replace with symlink
423
+ for f in "$MEMORY_CLAUDE_DIR/memory/"*; do
424
+ [ -f "$f" ] || continue
425
+ fname=$(basename "$f")
426
+ if [ ! -f "$MEMORY_LOCAL_DIR/$fname" ]; then
427
+ cp "$f" "$MEMORY_LOCAL_DIR/$fname"
428
+ fi
429
+ done
430
+ rm -rf "$MEMORY_CLAUDE_DIR/memory"
431
+ ln -s "$MEMORY_LOCAL_DIR" "$MEMORY_CLAUDE_DIR/memory"
432
+ echo " ✓ Existing memory migrated to .claude/memory/ and symlinked"
401
433
  else
402
- echo -e " ${YELLOW}MEMORY.md already exists, skipping (no overwrite)${NC}"
434
+ ln -s "$MEMORY_LOCAL_DIR" "$MEMORY_CLAUDE_DIR/memory"
435
+ echo " ✓ Memory symlinked: ~/.claude/projects/.../ → .claude/memory/"
403
436
  fi
404
437
 
405
438
  # ─── Install global rules (optional) ───
@@ -446,7 +479,7 @@ if [ "$INSTALL_MODE" = "fresh" ]; then
446
479
  echo -e " ${GREEN}.claude/settings.json${NC} ← Hooks configuration"
447
480
  echo -e " ${GREEN}docs/progress.md${NC} ← Progress log (maintained by Claude)"
448
481
  echo -e " ${GREEN}docs/debug-log.md${NC} ← Debug log (maintained by Claude)"
449
- echo -e " ${GREEN}~/.claude/projects/.../memory/${NC} ← Auto memory (cross-session)"
482
+ echo -e " ${GREEN}.claude/memory/${NC} ← Auto memory (symlinked, lives in repo)"
450
483
  echo ""
451
484
  echo -e "${YELLOW}Next steps:${NC}"
452
485
  echo " 1. Edit CLAUDE.md and fill in the [TODO] sections with project info"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-discipline",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Discipline framework for Claude Code — rules, hooks, and agents that keep AI on track",
5
5
  "bin": {
6
6
  "cc-discipline": "bin/cli.sh"