cortexhawk 3.3.0 → 3.3.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/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
 
package/README.md CHANGED
@@ -2,16 +2,28 @@
2
2
 
3
3
  [![GitHub stars](https://img.shields.io/github/stars/Spechawk94/CortexHawk?style=flat-square)](https://github.com/Spechawk94/CortexHawk/stargazers)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE)
5
- [![Version](https://img.shields.io/badge/version-3.2.0-green.svg?style=flat-square)](CHANGELOG.md)
5
+ [![Version](https://img.shields.io/badge/version-3.3.1-green.svg?style=flat-square)](CHANGELOG.md)
6
6
  [![npm](https://img.shields.io/npm/v/cortexhawk?style=flat-square&color=red)](https://www.npmjs.com/package/cortexhawk)
7
7
  [![Skills](https://img.shields.io/badge/skills-36%20built--in%20%7C%2087k%2B%20via%20SkillsMP-orange.svg?style=flat-square)](https://skillsmp.com)
8
- [![Components](https://img.shields.io/badge/20%20agents%20%7C%2033%20commands%20%7C%209%20hooks%20%7C%207%20modes-purple.svg?style=flat-square)](#whats-inside)
8
+ [![Components](https://img.shields.io/badge/20%20agents%20%7C%2035%20commands%20%7C%2011%20hooks%20%7C%207%20modes-purple.svg?style=flat-square)](#whats-inside)
9
9
 
10
10
  An open-source, community-driven development toolkit for Claude Code.
11
11
 
12
12
  CortexHawk provides a modular collection of optimized agents, skills, commands, hooks, and behavioral modes that transform Claude Code into a full-stack development team. Every prompt has been written for maximum efficiency — less token bloat, sharper instructions, better agent coordination.
13
13
 
14
- ### What's New in v3.2
14
+ ### What's New in v3.3
15
+
16
+ - **Gitflow strategy** — full gitflow support in `/cleanup`: dual-target merge detection (feat→develop, release/hotfix→main), conditional branch protection, auto-resync `develop ← main`
17
+ - **`/cleanup` command** — unified post-merge cleanup with 4 strategies (direct-main, feature-branches, dev-branch, gitflow), `--dry-run` preview, native `post-merge` hook opt-in
18
+ - **`/review-pr` command** — fetch, triage, and fix PR review comments in batch (one commit, one notification)
19
+ - **`lint-guard` hook** — auto-detects formatters/linters on staged files; auto-fix for prettier/black/gofmt/rustfmt, check-only for eslint/flake8/mypy; parallel execution, pre-commit delegation
20
+ - **`install.sh` modularized** — extracted 5 modules into `scripts/` (4114 → 3168 lines, -23%)
21
+ - **MCP configs hardened** — all packages pinned to exact versions, puppeteer package name fixed
22
+ - **Security fixes** — path traversal guards in codex-dispatcher and restore, python3 availability guards
23
+ - **10+ bug fixes** — see [CHANGELOG.md](CHANGELOG.md) for full details
24
+
25
+ <details>
26
+ <summary>v3.2 changes</summary>
15
27
 
16
28
  - **`/commit` command** — lightweight conventional commit + push without review or PR (use `/ship` for full workflow)
17
29
  - **`--version` flag** — standard CLI version display
@@ -21,6 +33,8 @@ CortexHawk provides a modular collection of optimized agents, skills, commands,
21
33
  - **`--init` wizard** — "Auto-detect" target option, improved multi-target support
22
34
  - **15+ bug fixes** — see [CHANGELOG.md](CHANGELOG.md) for full details
23
35
 
36
+ </details>
37
+
24
38
  <details>
25
39
  <summary>v3.1 changes</summary>
26
40
 
@@ -116,7 +130,7 @@ Specialized AI agents that coordinate together instead of working in silos.
116
130
  | `fullstack-developer` | Full-stack orchestration front+back |
117
131
  | `teacher` | Teaches concepts with 3 pedagogical levels (guided, mentor, professor) |
118
132
 
119
- ### Commands (33)
133
+ ### Commands (35)
120
134
 
121
135
  Slash commands for common workflows.
122
136
 
@@ -126,8 +140,10 @@ Slash commands for common workflows.
126
140
  | `/build` | Implement code from plan or description |
127
141
  | `/test` | Generate and run tests |
128
142
  | `/review` | Multi-agent code review |
143
+ | `/review-pr` | Fetch, triage, and fix PR review comments in batch |
129
144
  | `/ship` | Commit + PR pipeline |
130
145
  | `/commit` | Lightweight commit + push (no review, no PR) |
146
+ | `/cleanup` | Post-merge branch cleanup (auto-detects strategy) |
131
147
  | `/debug` | Debug and fix issues |
132
148
  | `/scan` | Full security audit |
133
149
  | `/check` | Pre-commit quality gate (lint + test + scan + review → GO/NO-GO) |
@@ -270,7 +286,7 @@ Create custom agents that inherit from base agents with rule/style overrides:
270
286
 
271
287
  Personas use `extends:` frontmatter and are auto-copied to `.claude/agents/` on install/update.
272
288
 
273
- ### Hooks (9)
289
+ ### Hooks (11)
274
290
 
275
291
  Automatic lifecycle hooks that run during Claude Code sessions.
276
292
 
@@ -279,12 +295,14 @@ Automatic lifecycle hooks that run during Claude Code sessions.
279
295
  | `file-guard` | PreToolUse | Blocks access to .env, secrets, credentials |
280
296
  | `branch-guard` | PreToolUse | Prevents direct push to protected branches |
281
297
  | `commit-guard` | PreToolUse | Validates conventional commits, checks staged secrets |
298
+ | `lint-guard` | PreToolUse | Auto-detects formatters/linters on staged files; auto-fix or check-only |
282
299
  | `self-review` | PostToolUse | Checks for TODO/FIXME, secrets, debug artifacts |
283
300
  | `dependency-check` | PostToolUse | Alerts when dependency files are modified |
284
301
  | `test-reminder` | PostToolUse | Reminds to update tests for modified source files |
285
302
  | `agent-analytics` | PostToolUse | Tracks agent invocations, tokens, timestamps to `docs/.metrics/` |
286
303
  | `session-telemetry` | SessionEnd | Generates session summary (agents, tokens, duration, files) |
287
304
  | `session-start` | SessionStart | Project context injection, daily stats display |
305
+ | `post-merge` | git post-merge | Auto-runs cleanup after `git merge` (opt-in native git hook) |
288
306
 
289
307
  Hook pipelines are configured in `hooks/compose.yml`. Manage individual hooks:
290
308
 
@@ -327,9 +345,9 @@ Each target adapts components to the CLI's native format:
327
345
  | Component | Claude Code | Kimi CLI | Codex CLI |
328
346
  |---|---|---|---|
329
347
  | Agents (20) | `.claude/agents/*.md` | Skills (`/skill:agent-*`) + `AGENTS.md` | `AGENTS.md` |
330
- | Commands (33) | `.claude/commands/*.md` → `/plan` | Skills (`/skill:cmd-*`) | Skills (`$cmd-*`) |
348
+ | Commands (35) | `.claude/commands/*.md` → `/plan` | Skills (`/skill:cmd-*`) | Skills (`$cmd-*`) |
331
349
  | Skills (36) | `.claude/skills/` | `.kimi/skills/` (auto-discovered) | `.agents/skills/` |
332
- | Hooks (9) | `settings.json` (automatic) | Skills (`/skill:hook-*`, manual) | Dispatcher (partial) |
350
+ | Hooks (11) | `settings.json` (automatic) | Skills (`/skill:hook-*`, manual) | Dispatcher (partial) |
333
351
  | Modes (7) | `.claude/modes/` (native) | Skills (`/skill:modes/*`) | Skills (`$mode-*`) |
334
352
  | MCP | `settings.json` | Optional (`MCP-SETUP.md`) | `config.toml` |
335
353
 
@@ -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"