383 Commits

Author SHA1 Message Date
Affaan Mustafa
601c626b03
Merge pull request #1495 from ratorin/fix/session-end-transcript-path-isolation
fix(hooks): isolate session-end.js filename using transcript_path UUID (#1494)
2026-04-21 18:14:23 -04:00
Affaan Mustafa
14f8f66833
Merge pull request #1490 from gaurav0107/fix/1459-remove-agents-manifest-field
fix: remove unsupported `agents` field from plugin.json
2026-04-21 18:14:12 -04:00
Vishnu Pradeep
b27551897d
fix(hooks): wrap SessionStart summary with stale-replay guard (#1536)
The SessionStart hook injects the most recent *-session.tmp as
additionalContext labelled only with 'Previous session summary:'.
After a /compact boundary, the model frequently re-executes stale
slash-skill invocations it finds inside that summary, re-running
ARGUMENTS-bearing skills (e.g. /fw-task-new, /fw-raise-pr) with the
last ARGUMENTS they saw.

Observed on claude-opus-4-7 with ECC v1.9.0 on a firmware project:
after compaction resume, the model spontaneously re-enters the prior
skill with stale ARGUMENTS, duplicating GitHub issues, Notion tasks,
and branches for work that is already merged.

ECC cannot fix Claude Code's skill-state replay across compactions,
but it can stop amplifying it. Wrap the injected summary in an
explicit HISTORICAL REFERENCE ONLY preamble with a STALE-BY-DEFAULT
contract and delimit the block with BEGIN/END markers so the model
treats everything inside as frozen reference material.

Tests: update the two hooks.test.js cases that asserted on the old
'Previous session summary' literal to assert on the new guard
preamble, the STALE-BY-DEFAULT contract, and both delimiters. 219/219
tests pass locally.

Tracked at: #1534
2026-04-21 18:02:19 -04:00
Taro Kawakami
01d816781e review: apply sanitizeSessionId to UUID shortId, fix test comment
- Route the transcript-derived shortId through sanitizeSessionId so the
  fallback and transcript branches remain byte-for-byte equivalent for any
  non-UUID session IDs that still land in CLAUDE_SESSION_ID (greptile P1).
- Clarify the inline comment in the first regression test: clearing
  CLAUDE_SESSION_ID exercises the transcript_path branch, not the
  getSessionIdShort() fallback (coderabbit P2).

Refs #1494
2026-04-19 14:30:00 +09:00
Taro Kawakami
93cd5f4cff review: address P1/P2 bot feedback on shortId derivation
- Use last-8 chars of transcript UUID instead of first-8, matching
  getSessionIdShort()'s .slice(-8) convention. Same session now produces the
  same filename whether shortId comes from CLAUDE_SESSION_ID or transcript_path,
  so existing .tmp files are not orphaned on upgrade.
- Normalize extracted hex prefix to lowercase to avoid case-driven filename
  divergence from sanitizeSessionId()'s lowercase output.
- Explicitly clear CLAUDE_SESSION_ID in the first regression test so the env
  leak from parent test runs cannot hide the fallback path.
- Add regression tests for the lowercase-normalization path and for the case
  where CLAUDE_SESSION_ID and transcript_path refer to the same UUID (backward
  compat guarantee).

Refs #1494
2026-04-19 14:19:29 +09:00
Taro Kawakami
a35b2d125d fix(hooks): isolate session-end.js filename using transcript_path UUID
When session-end.js runs and CLAUDE_SESSION_ID is unset, getSessionIdShort()
falls back to the project/worktree name. If any other Stop-hook in the chain
spawns a claude subprocess (e.g. an AI-summary generator using 'claude -p'),
the subprocess also fires the full Stop chain and writes to the same project-
name-based filename, clobbering the parent's valid session summary with a
summary of the summarization prompt itself.

Fix: when stdin JSON (or CLAUDE_TRANSCRIPT_PATH) provides a transcript_path,
extract the first 8 hex chars of the session UUID from the filename and use
that as shortId. Falls back to the original getSessionIdShort() when no
transcript_path is available, so existing behavior is preserved for all
callers that do not set it.

Adds a regression test in tests/hooks/hooks.test.js.

Refs #1494
2026-04-19 11:37:32 +09:00
Gaurav Dubey
c19fde229a fix: remove agents field from plugin.json manifest (#1459)
The Claude Code plugin validator rejects the "agents" field entirely.
Remove it from the manifest, schema, and tests. Update schema notes
to document this as a known constraint alongside the hooks field.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-18 23:29:47 +05:30
Affaan Mustafa
eb900ddd81 test: align hook install expectations with Claude schema 2026-04-15 19:33:34 -07:00
Affaan Mustafa
ccecb0b9f4 fix: restore string hook commands for Claude Code schema 2026-04-15 17:25:33 -07:00
Affaan Mustafa
1fabf4d2cf fix: consolidate bash hooks without fork storms 2026-04-14 21:23:57 -07:00
Affaan Mustafa
c1e7a272cc
Merge pull request #1446 from affaan-m/fix/release-publish-and-migration-docs
fix: publish npm releases and clarify install identifiers
2026-04-14 20:58:20 -07:00
Affaan Mustafa
5427c27930
Merge pull request #1445 from affaan-m/fix/plugin-installed-hook-root-resolution
fix: resolve plugin-installed hook root on marketplace installs
2026-04-14 20:43:40 -07:00
Affaan Mustafa
b5c4d2beb9 fix: wire npm auth into release publish 2026-04-14 20:43:22 -07:00
Affaan Mustafa
34380326c8 fix: publish npm releases and clarify install identifiers 2026-04-14 20:42:28 -07:00
Affaan Mustafa
1b7c5789fc fix: bootstrap plugin-installed hook commands safely 2026-04-14 20:24:21 -07:00
Affaan Mustafa
cdeb837838 Merge origin/main into fix/urgent-install-and-name 2026-04-14 20:23:54 -07:00
Affaan Mustafa
c54b44edf3 test: fix harness audit env fallback 2026-04-14 20:03:57 -07:00
Affaan Mustafa
e46deb93c8 fix: harden dashboard terminal launch helpers 2026-04-14 19:44:32 -07:00
Affaan Mustafa
8776c4f8f3 fix: harden urgent install and gateguard patch 2026-04-14 19:44:08 -07:00
Affaan Mustafa
76b6e22b4d fix: unblock urgent install and gateguard regressions 2026-04-14 19:23:07 -07:00
Affaan Mustafa
e0ddb331f6
Merge pull request #1367 from ozoz5/feat/gateguard
feat(hooks,skills): add gateguard fact-forcing pre-action gate
2026-04-13 01:05:20 -07:00
Affaan Mustafa
5eedc8adb4
Merge pull request #1377 from Anish29801/feat/dashboard-gui
Feat/dashboard gui
2026-04-13 01:04:14 -07:00
Affaan Mustafa
6c67566767 fix: keep gateguard session state alive 2026-04-13 00:58:50 -07:00
Affaan Mustafa
2e44beabc1 test: isolate gateguard state dir cleanup 2026-04-13 00:53:57 -07:00
Affaan Mustafa
e2b5353fec
Merge pull request #1398 from affaan-m/fix/opencode-plugin-version-sync
fix: sync OpenCode hook banner version
2026-04-13 00:52:40 -07:00
Affaan Mustafa
9ae51bc3c1
Merge pull request #1393 from affaan-m/fix/cursor-rule-mdc-install
fix: install Cursor rules as .mdc files
2026-04-13 00:52:03 -07:00
Affaan Mustafa
7a33b2b3c9
Merge pull request #1395 from affaan-m/fix/npm-publish-surface
fix: narrow npm publish surface to the module graph
2026-04-13 00:46:15 -07:00
seto
dd2962ee92 fix: 5 bugs + 2 tests from 3-agent deep bughunt
Bugs fixed:
- B1: JS gate messages still said "cat one real record" -> redacted/synthetic
- B2: Destructive bash key used 200-char truncation (collision bypass) -> SHA256 hash
- B3: sanitizePath only stripped \n\r -> now strips null bytes, bidi overrides, all control chars
- B4: Tool name matching was case-sensitive (latent bypass) -> lookup map normalization
- B5: SKILL.md Gate Types missing MultiEdit -> added with explanation

Tests added:
- T1: MultiEdit gate denies first unchecked file (CRITICAL - was untested)
- T2: MultiEdit allows after all files gated

11/11 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 16:32:46 +09:00
Affaan Mustafa
a0a1eda8fc fix: sync opencode hook banner version 2026-04-13 00:15:55 -07:00
Affaan Mustafa
9e607ebb30 fix: prefer cursor native hooks during install 2026-04-13 00:07:15 -07:00
Affaan Mustafa
30f6ae4253 test: align cursor manifest expectations 2026-04-12 23:58:59 -07:00
Affaan Mustafa
c826305060 fix: keep runtime schemas in npm package 2026-04-12 23:56:58 -07:00
Affaan Mustafa
7374ef6a73 fix: normalize cursor rule installs 2026-04-12 23:51:58 -07:00
Affaan Mustafa
bd2aec48ed fix: narrow npm publish surface to the module graph 2026-04-12 23:48:53 -07:00
seto
5540282dcb fix: remove unnecessary disk I/O + fix test cleanup
- isChecked() no longer calls saveState() — read-only operation
  should not write to disk (was causing 3x writes per tool call)
- Test cleanup uses fs.rmSync(recursive) instead of fs.rmdirSync
  which failed with ENOTEMPTY when .tmp files remained

9/9 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 15:41:58 +09:00
seto
67256194a0 fix: P1 test state-file PID mismatch + P2 session key eviction
P1 (cubic-dev-ai): Test process PID differs from spawned hook PID,
so test was seeding/clearing wrong state file. Fix: pass fixed
CLAUDE_SESSION_ID='gateguard-test-session' to spawned hooks.

P2 (cubic-dev-ai): Pruning checked array could evict __bash_session__
and other session keys, causing gates to re-fire mid-session. Fix:
preserve __prefixed keys during pruning, only evict file-path entries.

9/9 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 15:40:13 +09:00
Affaan Mustafa
bb96fdc9dc test: wait for http mcp fixtures to accept connections 2026-04-12 23:38:46 -07:00
Affaan Mustafa
133e881ce0 fix: install Cursor rules as mdc files 2026-04-12 23:32:39 -07:00
seto
45823fcede fix: session-scoped state to prevent cross-session race
Addresses reviewer feedback from @affaan-m:

1. State keyed by CLAUDE_SESSION_ID / ECC_SESSION_ID
   - Falls back to pid-based isolation when env vars absent
   - State file: state-{sessionId}.json (was .session_state.json)

2. Atomic write+rename semantics
   - Write to temp file, then fs.renameSync to final path
   - Prevents partial reads from concurrent hooks

3. Bounded checked list (MAX_CHECKED_ENTRIES = 500)
   - Prunes to last 500 entries when cap exceeded
   - Stale session files auto-deleted after 1 hour

9/9 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 15:30:34 +09:00
Affaan Mustafa
18c90a7a17 fix: document supported claude hook install path 2026-04-12 23:29:45 -07:00
Affaan Mustafa
3792b69a38 fix: block unsafe privileged workflow checkouts 2026-04-12 23:23:01 -07:00
Affaan Mustafa
1b17c5c9d8 test: match published claude plugin name 2026-04-12 23:14:38 -07:00
Affaan Mustafa
94e8f29d19 fix: use shared slash-command plugin root resolver 2026-04-12 23:10:29 -07:00
Affaan Mustafa
5f55484fa9
Merge pull request #1385 from KeWang0622/fix/block-no-verify-hook
fix: route block-no-verify hook through run-with-flags.js
2026-04-12 23:02:19 -07:00
Affaan Mustafa
f4c7aac5b8 fix: remove unused hook install test constant 2026-04-12 22:51:03 -07:00
Affaan Mustafa
b749f5d772 fix: clean up hook install docs and tests 2026-04-12 22:47:25 -07:00
Affaan Mustafa
2ece2cfc90 fix: stop injecting managed hooks into claude settings 2026-04-12 22:39:48 -07:00
Affaan Mustafa
28edd197c2
fix: harden release surface version and packaging sync (#1388)
* fix: keep ecc release surfaces version-synced

* fix: keep lockfile release version in sync

* fix: remove release version drift from locks and tests

* fix: keep root release metadata version-synced

* fix: keep codex marketplace metadata version-synced

* fix: gate release workflows on full metadata sync

* fix: ship all versioned release metadata

* fix: harden manual release path

* fix: keep localized release docs version-synced

* fix: sync install architecture version examples

* test: cover shipped plugin metadata in npm pack

* fix: verify final npm payload in release script

* fix: ship opencode lockfile in npm package

* docs: sync localized release highlights

* fix: stabilize windows ci portability

* fix: tighten release script version sync

* fix: prefer repo-relative hook file paths

* fix: make npm pack test shell-safe on windows
2026-04-12 22:33:32 -07:00
Affaan Mustafa
fc5921a521
fix: detach ecc2 background session runners (#1387)
* fix: detach ecc2 background session runners

* fix: stabilize windows ci portability

* fix: persist detached runner startup stderr

* fix: prefer repo-relative hook file paths

* fix: make npm pack test shell-safe on windows
2026-04-12 22:29:05 -07:00
Ke Wang
809e0fa0a9 fix: address PR review comments on block-no-verify hook
- Add `minimal` profile so the security hook runs in all profiles
- Scope -n/--no-verify flag check to the detected subcommand region,
  preventing false positives on chained commands (e.g. `git log -n 10`)
- Guard stdin listeners with `require.main === module` so require()
  from run-with-flags.js does not register unnecessary listeners
- Verify subcommand token is preceded only by flags/flag-args after
  "git", preventing misclassification of argument values as subcommands
- Add integration tests for block-no-verify hook

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 20:29:01 -05:00