carson 3.30.0 → 3.30.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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/MANUAL.md +3 -3
  3. data/RELEASE.md +12 -0
  4. data/VERSION +1 -1
  5. data/hooks/command-guard +27 -4
  6. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5156cb5207a0ee95cad65c30d494a24ddcee97c90f2aab6861b34f9ec8e92069
4
- data.tar.gz: 182a83aaa84ec1d9c0a548bdaf98e421b4eab9e4ab1248b0d67db58e42a7c5ae
3
+ metadata.gz: 6f1c9bdf439edf6f4c50dbf4c2640ec87cf0cf7f5aacd7960d16c2d32600a0c3
4
+ data.tar.gz: b82620a9e4524b9e08c7851f9de133967ce64284c7d2c57a71d87df7055ce8a1
5
5
  SHA512:
6
- metadata.gz: 3e42b39fad6ca26a05bd914f7653c9cd4e7bb4227c9eb03ba5288b5e54d30f87f4b8e69991236caab797964d293ec1e6b01c4ec6a8853b24f80f7a7bb1670cfe
7
- data.tar.gz: fd147d7b1941670279ad3261b0cca81639d72043b3e429a1f0290aff4a9deb53000971c5bb5953d7f36b4b574a1c5b03547f9cf33fdb3bcc16bbe4f30e5b770a
6
+ metadata.gz: 9433570c67b8f8b793eba64969356c6ec92775515e8291079518b0be7a4f051183eb20e19d23e0d6456a38a95c875f06d9e6d7536b434c30ec69fe36d63b0c4e
7
+ data.tar.gz: 7b82e7e07750d8e0ac4d0502a95e86925e210c1cca5b0c0e33355604cc4910819f46c57b002c9b7d9fd8dd4c312b4bc4cfba26192875e1a23818498343a4b0d0
data/MANUAL.md CHANGED
@@ -66,12 +66,12 @@ on:
66
66
 
67
67
  jobs:
68
68
  governance:
69
- uses: wanghailei/carson/.github/workflows/carson_policy.yml@v3.29.0
69
+ uses: wanghailei/carson/.github/workflows/carson_policy.yml@v3.30.0
70
70
  secrets:
71
71
  CARSON_READ_TOKEN: ${{ secrets.CARSON_READ_TOKEN }}
72
72
  with:
73
- carson_ref: "v3.29.0"
74
- carson_version: "3.29.0"
73
+ carson_ref: "v3.30.0"
74
+ carson_version: "3.30.0"
75
75
  rubocop_version: "1.81.0"
76
76
  ```
77
77
 
data/RELEASE.md CHANGED
@@ -5,6 +5,18 @@ Release-note scope rule:
5
5
  - `RELEASE.md` records only version deltas, breaking changes, and migration actions.
6
6
  - Operational usage guides live in `MANUAL.md` and `API.md`.
7
7
 
8
+ ## 3.30.1
9
+
10
+ ### What changed
11
+
12
+ - **MANUAL.md CI example updated to v3.30.0** — The CI workflow reference, `carson_ref`, and `carson_version` in the setup example were still pinned to v3.29.0. Now aligned with the current release.
13
+ - **CI split into fast PR gate and full smoke on main** — PR checks run the unit test suite only; the full smoke script runs on main after merge. Reduces PR feedback time.
14
+ - **Command guard respects leading `cd` in Bash commands** — `cd /path && gh pr create` is now correctly detected as a governed command.
15
+
16
+ ### No migration required
17
+
18
+ - Existing workflows continue to work unchanged.
19
+
8
20
  ## 3.30.0
9
21
 
10
22
  ### What changed
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.30.0
1
+ 3.30.1
data/hooks/command-guard CHANGED
@@ -31,6 +31,28 @@ block_command() {
31
31
  exit 2
32
32
  }
33
33
 
34
+ resolve_command_pwd() {
35
+ local command_text="$1"
36
+ local base_pwd
37
+ local raw_cd_target
38
+ local cd_target
39
+ local resolved_pwd
40
+
41
+ base_pwd="$(pwd -P)"
42
+ if [[ ! "$command_text" =~ ^[[:space:]]*cd[[:space:]]+([^;&|]+)[[:space:]]*(&&|;) ]]; then
43
+ echo "$base_pwd"
44
+ return
45
+ fi
46
+
47
+ raw_cd_target="${BASH_REMATCH[1]}"
48
+ cd_target="$(printf '%s' "$raw_cd_target" | sed -E "s/^[[:space:]]+//; s/[[:space:]]+$//; s/^'(.*)'$/\\1/; s/^\"(.*)\"$/\\1/")"
49
+ if resolved_pwd="$(cd "$base_pwd" && cd "$cd_target" 2>/dev/null && pwd -P)"; then
50
+ echo "$resolved_pwd"
51
+ else
52
+ echo "$base_pwd"
53
+ fi
54
+ }
55
+
34
56
  # Read the tool call JSON from stdin.
35
57
  input="$(cat)"
36
58
 
@@ -40,16 +62,17 @@ tool_name="$(echo "$input" | jq -r '.tool_name // empty' 2>/dev/null)"
40
62
 
41
63
  command_text="$(echo "$input" | jq -r '.tool_input.command // empty' 2>/dev/null)"
42
64
  [ -n "$command_text" ] || exit 0
65
+ command_pwd="$(resolve_command_pwd "$command_text")"
43
66
 
44
67
  # Check if the current directory is inside a governed repository.
45
68
  config_file="${HOME}/.carson/config.json"
46
69
  [ -f "$config_file" ] || exit 0
47
70
 
48
- repo_root="$(git rev-parse --show-toplevel 2>/dev/null || echo "")"
71
+ repo_root="$(git -C "$command_pwd" rev-parse --show-toplevel 2>/dev/null || echo "")"
49
72
  [ -n "$repo_root" ] || exit 0
50
73
 
51
74
  current_root="$(cd "$repo_root" && pwd -P)"
52
- common_dir="$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null || echo "")"
75
+ common_dir="$(git -C "$command_pwd" rev-parse --path-format=absolute --git-common-dir 2>/dev/null || echo "")"
53
76
  if [ -n "$common_dir" ]; then
54
77
  governed_root="$(cd "$(dirname "$common_dir")" && pwd -P)"
55
78
  else
@@ -62,7 +85,7 @@ fi
62
85
 
63
86
  main_branch="$(jq -r '.git.main_branch // "main"' "$config_file" 2>/dev/null || echo "main")"
64
87
  [ -n "$main_branch" ] || main_branch="main"
65
- current_branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")"
88
+ current_branch="$(git -C "$command_pwd" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")"
66
89
  on_main_worktree=false
67
90
  on_main_branch=false
68
91
  [ "$current_root" = "$governed_root" ] && on_main_worktree=true
@@ -96,7 +119,7 @@ fi
96
119
  if [ "$on_main_worktree" = true ] && [ "$on_main_branch" = true ] && grep -qE "$main_mutation_pattern" <<<"$command_text"; then
97
120
  block_command \
98
121
  "Main working tree is read-only in this Carson-governed repo." \
99
- "Use \`carson worktree create <name>\` first, then run \`git add\` or \`git commit\` inside that worktree."
122
+ "Use \`carson worktree create <name>\` first, then commit inside that worktree or let Carson do it with \`carson deliver --commit \"...\"\`."
100
123
  fi
101
124
 
102
125
  exit 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carson
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.30.0
4
+ version: 3.30.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hailei Wang