cleargate 0.3.0 → 0.5.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.
@@ -1,7 +1,18 @@
1
1
  #!/usr/bin/env bash
2
2
  set -u
3
3
  REPO_ROOT="${CLAUDE_PROJECT_DIR}"
4
- node "${REPO_ROOT}/cleargate-cli/dist/cli.js" doctor --session-start 2>/dev/null || true
4
+
5
+ # Resolve cleargate CLI: prefer on-PATH binary, fall back to meta-repo-local
6
+ # dist. If neither is present, this hook is a no-op (BUG-006).
7
+ if command -v cleargate >/dev/null 2>&1; then
8
+ CG=(cleargate)
9
+ elif [ -f "${REPO_ROOT}/cleargate-cli/dist/cli.js" ]; then
10
+ CG=(node "${REPO_ROOT}/cleargate-cli/dist/cli.js")
11
+ else
12
+ exit 0
13
+ fi
14
+
15
+ "${CG[@]}" doctor --session-start 2>/dev/null || true
5
16
 
6
17
  # ── §14.9 SessionStart sync nudge (STORY-010-08) ─────────────────────────────
7
18
  # Daily-throttled: probe remote for updates at most once per 24h.
@@ -26,9 +37,9 @@ else
26
37
  # Cross-platform 3-second timeout: prefer `timeout` (Linux); fall back to
27
38
  # background-process kill (macOS where GNU coreutils may be absent).
28
39
  if command -v timeout > /dev/null 2>&1; then
29
- timeout 3 node "${REPO_ROOT}/cleargate-cli/dist/cli.js" sync --check > "${RESULT_FILE}" 2>/dev/null || true
40
+ timeout 3 "${CG[@]}" sync --check > "${RESULT_FILE}" 2>/dev/null || true
30
41
  else
31
- node "${REPO_ROOT}/cleargate-cli/dist/cli.js" sync --check > "${RESULT_FILE}" 2>/dev/null &
42
+ "${CG[@]}" sync --check > "${RESULT_FILE}" 2>/dev/null &
32
43
  _PROBE_PID=$!
33
44
  (sleep 3 && kill "${_PROBE_PID}" 2>/dev/null) &
34
45
  _KILL_PID=$!
@@ -3,16 +3,29 @@ set -u
3
3
  REPO_ROOT="${CLAUDE_PROJECT_DIR}"
4
4
  LOG="${REPO_ROOT}/.cleargate/hook-log/gate-check.log"
5
5
  mkdir -p "$(dirname "$LOG")"
6
+
7
+ # Resolve cleargate CLI: prefer on-PATH binary (`npm i -g cleargate` / `npx`),
8
+ # fall back to a meta-repo-local dist (dogfood case). If neither is present,
9
+ # log a remediation message and exit 0 (BUG-006).
10
+ if command -v cleargate >/dev/null 2>&1; then
11
+ CG=(cleargate)
12
+ elif [ -f "${REPO_ROOT}/cleargate-cli/dist/cli.js" ]; then
13
+ CG=(node "${REPO_ROOT}/cleargate-cli/dist/cli.js")
14
+ else
15
+ echo "[$(date -u +"%Y-%m-%dT%H:%M:%SZ")] cleargate CLI not found — install with 'npm i -g cleargate' or run via 'npx cleargate'. Hook skipped." >>"$LOG"
16
+ exit 0
17
+ fi
18
+
6
19
  FILE=$(jq -r '.tool_input.file_path' 2>/dev/null || echo "")
7
20
  [ -z "$FILE" ] && exit 0
8
21
  case "$FILE" in *.cleargate/delivery/*) : ;; *) exit 0 ;; esac
9
22
  TS=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
10
23
  # Ordered chain — stamp MUST precede gate (gate may read draft_tokens)
11
- node "${REPO_ROOT}/cleargate-cli/dist/cli.js" stamp-tokens "$FILE" >>"$LOG" 2>&1
24
+ "${CG[@]}" stamp-tokens "$FILE" >>"$LOG" 2>&1
12
25
  SR1=$?
13
- node "${REPO_ROOT}/cleargate-cli/dist/cli.js" gate check "$FILE" >>"$LOG" 2>&1
26
+ "${CG[@]}" gate check "$FILE" >>"$LOG" 2>&1
14
27
  SR2=$?
15
- node "${REPO_ROOT}/cleargate-cli/dist/cli.js" wiki ingest "$FILE" >>"$LOG" 2>&1
28
+ "${CG[@]}" wiki ingest "$FILE" >>"$LOG" 2>&1
16
29
  SR3=$?
17
30
  echo "[$TS] stamp=$SR1 gate=$SR2 ingest=$SR3 file=$FILE" >>"$LOG"
18
31
  exit 0 # ALWAYS 0 — severity enforcement is at wiki lint, not hook
@@ -1,6 +1,6 @@
1
1
  {
2
- "cleargate_version": "0.3.0",
3
- "generated_at": "2026-04-24T22:02:35.096Z",
2
+ "cleargate_version": "0.5.0",
3
+ "generated_at": "2026-04-25T21:53:30.430Z",
4
4
  "files": [
5
5
  {
6
6
  "path": ".claude/agents/architect.md",
@@ -81,14 +81,14 @@
81
81
  },
82
82
  {
83
83
  "path": ".claude/hooks/session-start.sh",
84
- "sha256": "a611286330f36e5d0bbdc5642e9409ffbfc569cc3d0b370918e973b545c50741",
84
+ "sha256": "ddaa1a461e6730db0ca7312ee44d66b78379250ba8b30a04125b37dc49350479",
85
85
  "tier": "hook",
86
86
  "overwrite_policy": "always",
87
87
  "preserve_on_uninstall": false
88
88
  },
89
89
  {
90
90
  "path": ".claude/hooks/stamp-and-gate.sh",
91
- "sha256": "a9ab1afb6ef18ff954543a218b0d1a1b433dc85ca0311b34e785b17b08ced0df",
91
+ "sha256": "3f64faff6d142b9ec997480944fc709aed8ed44c3f2adca026804f1e64946059",
92
92
  "tier": "hook",
93
93
  "overwrite_policy": "always",
94
94
  "preserve_on_uninstall": false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cleargate",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Planning framework for Claude Code agents — sprint/epic/story protocol, four-agent loop (architect/developer/qa/reporter), Karpathy-style awareness wiki.",
@@ -1,7 +1,18 @@
1
1
  #!/usr/bin/env bash
2
2
  set -u
3
3
  REPO_ROOT="${CLAUDE_PROJECT_DIR}"
4
- node "${REPO_ROOT}/cleargate-cli/dist/cli.js" doctor --session-start 2>/dev/null || true
4
+
5
+ # Resolve cleargate CLI: prefer on-PATH binary, fall back to meta-repo-local
6
+ # dist. If neither is present, this hook is a no-op (BUG-006).
7
+ if command -v cleargate >/dev/null 2>&1; then
8
+ CG=(cleargate)
9
+ elif [ -f "${REPO_ROOT}/cleargate-cli/dist/cli.js" ]; then
10
+ CG=(node "${REPO_ROOT}/cleargate-cli/dist/cli.js")
11
+ else
12
+ exit 0
13
+ fi
14
+
15
+ "${CG[@]}" doctor --session-start 2>/dev/null || true
5
16
 
6
17
  # ── §14.9 SessionStart sync nudge (STORY-010-08) ─────────────────────────────
7
18
  # Daily-throttled: probe remote for updates at most once per 24h.
@@ -26,9 +37,9 @@ else
26
37
  # Cross-platform 3-second timeout: prefer `timeout` (Linux); fall back to
27
38
  # background-process kill (macOS where GNU coreutils may be absent).
28
39
  if command -v timeout > /dev/null 2>&1; then
29
- timeout 3 node "${REPO_ROOT}/cleargate-cli/dist/cli.js" sync --check > "${RESULT_FILE}" 2>/dev/null || true
40
+ timeout 3 "${CG[@]}" sync --check > "${RESULT_FILE}" 2>/dev/null || true
30
41
  else
31
- node "${REPO_ROOT}/cleargate-cli/dist/cli.js" sync --check > "${RESULT_FILE}" 2>/dev/null &
42
+ "${CG[@]}" sync --check > "${RESULT_FILE}" 2>/dev/null &
32
43
  _PROBE_PID=$!
33
44
  (sleep 3 && kill "${_PROBE_PID}" 2>/dev/null) &
34
45
  _KILL_PID=$!
@@ -3,16 +3,29 @@ set -u
3
3
  REPO_ROOT="${CLAUDE_PROJECT_DIR}"
4
4
  LOG="${REPO_ROOT}/.cleargate/hook-log/gate-check.log"
5
5
  mkdir -p "$(dirname "$LOG")"
6
+
7
+ # Resolve cleargate CLI: prefer on-PATH binary (`npm i -g cleargate` / `npx`),
8
+ # fall back to a meta-repo-local dist (dogfood case). If neither is present,
9
+ # log a remediation message and exit 0 (BUG-006).
10
+ if command -v cleargate >/dev/null 2>&1; then
11
+ CG=(cleargate)
12
+ elif [ -f "${REPO_ROOT}/cleargate-cli/dist/cli.js" ]; then
13
+ CG=(node "${REPO_ROOT}/cleargate-cli/dist/cli.js")
14
+ else
15
+ echo "[$(date -u +"%Y-%m-%dT%H:%M:%SZ")] cleargate CLI not found — install with 'npm i -g cleargate' or run via 'npx cleargate'. Hook skipped." >>"$LOG"
16
+ exit 0
17
+ fi
18
+
6
19
  FILE=$(jq -r '.tool_input.file_path' 2>/dev/null || echo "")
7
20
  [ -z "$FILE" ] && exit 0
8
21
  case "$FILE" in *.cleargate/delivery/*) : ;; *) exit 0 ;; esac
9
22
  TS=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
10
23
  # Ordered chain — stamp MUST precede gate (gate may read draft_tokens)
11
- node "${REPO_ROOT}/cleargate-cli/dist/cli.js" stamp-tokens "$FILE" >>"$LOG" 2>&1
24
+ "${CG[@]}" stamp-tokens "$FILE" >>"$LOG" 2>&1
12
25
  SR1=$?
13
- node "${REPO_ROOT}/cleargate-cli/dist/cli.js" gate check "$FILE" >>"$LOG" 2>&1
26
+ "${CG[@]}" gate check "$FILE" >>"$LOG" 2>&1
14
27
  SR2=$?
15
- node "${REPO_ROOT}/cleargate-cli/dist/cli.js" wiki ingest "$FILE" >>"$LOG" 2>&1
28
+ "${CG[@]}" wiki ingest "$FILE" >>"$LOG" 2>&1
16
29
  SR3=$?
17
30
  echo "[$TS] stamp=$SR1 gate=$SR2 ingest=$SR3 file=$FILE" >>"$LOG"
18
31
  exit 0 # ALWAYS 0 — severity enforcement is at wiki lint, not hook
@@ -1,6 +1,6 @@
1
1
  {
2
- "cleargate_version": "0.3.0",
3
- "generated_at": "2026-04-24T22:02:35.096Z",
2
+ "cleargate_version": "0.5.0",
3
+ "generated_at": "2026-04-25T21:53:30.430Z",
4
4
  "files": [
5
5
  {
6
6
  "path": ".claude/agents/architect.md",
@@ -81,14 +81,14 @@
81
81
  },
82
82
  {
83
83
  "path": ".claude/hooks/session-start.sh",
84
- "sha256": "a611286330f36e5d0bbdc5642e9409ffbfc569cc3d0b370918e973b545c50741",
84
+ "sha256": "ddaa1a461e6730db0ca7312ee44d66b78379250ba8b30a04125b37dc49350479",
85
85
  "tier": "hook",
86
86
  "overwrite_policy": "always",
87
87
  "preserve_on_uninstall": false
88
88
  },
89
89
  {
90
90
  "path": ".claude/hooks/stamp-and-gate.sh",
91
- "sha256": "a9ab1afb6ef18ff954543a218b0d1a1b433dc85ca0311b34e785b17b08ced0df",
91
+ "sha256": "3f64faff6d142b9ec997480944fc709aed8ed44c3f2adca026804f1e64946059",
92
92
  "tier": "hook",
93
93
  "overwrite_policy": "always",
94
94
  "preserve_on_uninstall": false