cortexhawk 3.3.0 → 3.3.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/CHANGELOG.md CHANGED
@@ -3,7 +3,27 @@
3
3
  All notable changes to CortexHawk are documented here.
4
4
  Format: [Keep a Changelog](https://keepachangelog.com/)
5
5
 
6
- ## [Unreleased]
6
+ ## [3.3.1] - 2026-02-20
7
+
8
+ ### Added
9
+ - Native git `post-merge` hook opt-in: `cortexhawk post-merge-hook` (or `install --post-merge-hook`) installs `.git/hooks/post-merge` that auto-runs cleanup after every `git merge`; also offered interactively during `cortexhawk install` (#150)
10
+ - Gitflow strategy support in `post-merge-cleanup.sh`: dual-target merge detection (feat→develop, release/hotfix→main), conditional `release/*`/`hotfix/*` protection, resync `develop ← main` after release merges (#151)
11
+
12
+ ### Security
13
+ - `codex-dispatcher.sh`: reject paths containing `../` before dispatch to hooks, preventing arbitrary file scanning via path traversal (#152)
14
+ - MCP configs: pin all `npx -y` packages to exact versions — context7@2.1.1, sequential-thinking@2025.12.18, puppeteer@2025.5.12, github@2025.4.8; also fix puppeteer package name (`@modelcontextprotocol/server-puppeteer` replaces removed `@anthropic-ai/mcp-server-puppeteer`) (#153)
15
+
16
+ ### Changed
17
+ - `post-merge-cleanup.sh` refactored to dispatch-by-strategy architecture: central `PROTECTED_BRANCHES` list + `is_protected()`, extracted helpers (`delete_branch`, `delete_merged_branches`, `resync_work_branch`, `prompt_new_feature_branch`), strategy dispatch via `strategy_*()` functions + `case` (#149)
18
+ - `install.sh` modularized: extracted `install_claude()`, `do_update()`, `do_snapshot()`, `do_restore()`, `do_doctor()` into `scripts/` modules (4114 → 3168 lines, -23%); install.sh sources them before dispatch (#137)
19
+
20
+ ### Fixed
21
+ - `post-merge-cleanup.sh`: `MAIN_BRANCH` was assigned `WORK_BRANCH` value (e.g. `dev`) for `dev-branch` and `gitflow` strategies — merged-branch detection, resync, and post-cleanup were all targeting the wrong branch; now always `MAIN_BRANCH="main"` (#148)
22
+ - `post-merge-cleanup.sh`: script exited early when no merged branches, skipping resync for `dev-branch`/`gitflow`; resync now always runs after cleanup (#148)
23
+ - `post-merge-cleanup.sh`: added `--dry-run` flag (preview actions without executing) and resync block `WORK_BRANCH ← MAIN_BRANCH` with `--ff-only` + interactive merge fallback (#148)
24
+ - `cortexhawk update` crash when installed via npm: manifest's `source: "git"` was overriding runtime detection, causing `git pull` to run on the npm global dir (not a git repo); now validates SCRIPT_DIR is a real git repo before trusting manifest source (#154)
25
+ - `get_version()` in `cortexhawk` wrapper now skips `[Unreleased]` heading (fixes `self-update` version display)
26
+ - `branch-guard`: work branch (dev) was incorrectly added to `PROTECTED_BRANCHES` for `dev-branch` strategy, blocking all regular `git push origin dev` operations
7
27
 
8
28
  ## [3.3.0] - 2026-02-19
9
29
 
@@ -34,3 +34,4 @@ Delete merged local branches and optionally delete remote branches.
34
34
  - Handle git errors without crashing (network, permissions, no remote)
35
35
  - If compose.yml missing, warn and skip hook enablement
36
36
  - If sed fails, report error but continue cleanup
37
+ - For a native git hook (fires on all `git merge`, not just via Claude): `cortexhawk post-merge-hook`
package/cortexhawk CHANGED
@@ -29,7 +29,7 @@ yellow() { printf "\033[33m%s\033[0m\n" "$1"; }
29
29
  red() { printf "\033[31m%s\033[0m\n" "$1"; }
30
30
 
31
31
  get_version() {
32
- grep -m1 '## \[' "$CORTEXHAWK_HOME/CHANGELOG.md" 2>/dev/null | sed 's/.*\[\([^]]*\)\].*/\1/' || echo "unknown"
32
+ grep -m1 '## \[[0-9]' "$CORTEXHAWK_HOME/CHANGELOG.md" 2>/dev/null | sed 's/.*\[\([^]]*\)\].*/\1/' || echo "unknown"
33
33
  }
34
34
 
35
35
  # --- validate command ---
@@ -383,6 +383,7 @@ show_help() {
383
383
  echo " enable-hook <name> Enable a hook"
384
384
  echo " disable-hook <name> Disable a hook"
385
385
  echo " test-hooks Dry-run hooks with synthetic inputs"
386
+ echo " post-merge-hook Install native git post-merge hook (auto-cleanup)"
386
387
  echo ""
387
388
  echo "Other:"
388
389
  echo " self-update Update CortexHawk source (git pull)"
@@ -501,6 +502,11 @@ case "$cmd" in
501
502
  shift
502
503
  bash "$INSTALL_SH" --test-hooks "$@"
503
504
  ;;
505
+ post-merge-hook)
506
+ check_home
507
+ shift
508
+ bash "$INSTALL_SH" --post-merge-hook "$@"
509
+ ;;
504
510
  self-update)
505
511
  check_home
506
512
  if [ ! -d "$CORTEXHAWK_HOME/.git" ]; then
@@ -28,8 +28,7 @@ if [[ -f "$CONF_FILE" ]]; then
28
28
  if [[ "$_BRANCHING" == "direct-main" ]]; then
29
29
  PROTECTED_BRANCHES=("master" "production" "release")
30
30
  elif [[ "$_BRANCHING" == "dev-branch" ]]; then
31
- _WORK_BRANCH=$(grep '^WORK_BRANCH=' "$CONF_FILE" | cut -d= -f2)
32
- [[ -n "$_WORK_BRANCH" ]] && PROTECTED_BRANCHES+=("$_WORK_BRANCH")
31
+ : # Work branch is the normal push target — only main stays protected
33
32
  fi
34
33
  fi
35
34
 
@@ -59,6 +59,9 @@ HOOKS_DIR="$(cd "$(dirname "$0")" && pwd)"
59
59
  while IFS= read -r file; do
60
60
  [ -z "$file" ] && continue
61
61
 
62
+ # Reject path traversal attempts
63
+ case "$file" in "."|".."|*../*|*/..*) continue ;; esac
64
+
62
65
  # Resolve to absolute path
63
66
  if [[ "$file" != /* ]]; then
64
67
  file="$CWD/$file"