carson 2.15.2 → 2.15.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9e5677b6e4929ae5157a42c54ea9c72134695d7ec117f5173040eb2b37b8f52
4
- data.tar.gz: 5184adc9c300945bc2e8f8cb524ce2403d69be2705142dc9134dc42deba979c9
3
+ metadata.gz: b0c21d5ea31230fc4612636239e9de191266fa2d34b2cce7ea7259ac41f931a2
4
+ data.tar.gz: 3af15a3d35fa85c7ab0b0af8113f4f7210ad3b95097767c1e8056c6c75b02c56
5
5
  SHA512:
6
- metadata.gz: fc82d8e07668b795d75c881d213677faedc7de0d4936ee9f4212cb81df441853a6cc049ecf99ea2f2a67907e0328d8be6ca44b0c580dad61a20e503bd285b57f
7
- data.tar.gz: 4fa1fd958283661c7206ecec2ed33228fe0d55462c11d05b61be50050499c8bafc2cd716ab32b0081361f382e7de22e929bd347726423a06c9ee1473898a9e48
6
+ metadata.gz: 4c541901df28b9a174e31fb4e1ce6f2cefda6ec4a8968853cc542cc44490addb6f2b751348c58eb88c9aeb0ac0e010fc4cea5fa8b759c3f6795cb56bc5f6b0f1
7
+ data.tar.gz: 7d597b6b65469ad0cf969b960ddd01dace459ba463bebc1749e57d1056a3a2651c9186c6ad8f38d5810994513f75207d75eac0ae6d375d22384fc627d6a54b99
data/RELEASE.md CHANGED
@@ -5,6 +5,17 @@ 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
+ ## 2.15.3 — Initial Commit Guard
9
+
10
+ ### What changed
11
+
12
+ - `carson audit` and `carson check` now return success in repositories with no commits (HEAD does not exist). Previously, the pre-commit hook called `git rev-parse --abbrev-ref HEAD` which crashed, creating a chicken-and-egg problem that blocked the very first commit.
13
+ - Shell hooks (`prepare-commit-msg`, `pre-merge-commit`) now exit cleanly when HEAD is absent, allowing the initial commit without `--no-verify`.
14
+
15
+ ### No migration required
16
+
17
+ Run `carson prepare` in existing repositories to refresh hooks. No configuration changes needed.
18
+
8
19
  ## 2.15.2 — Release Guard
9
20
 
10
21
  ### What changed
@@ -43,7 +54,7 @@ No configuration or workflow changes needed.
43
54
 
44
55
  ### No migration required
45
56
 
46
- Run `bash install.sh` to pick up the updated pre-push hook in all governed repos.
57
+ Run `carson prepare` in each governed repo to pick up the updated pre-push hook.
47
58
 
48
59
  ## 2.14.2 — Docs Enrichment
49
60
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.15.2
1
+ 2.15.3
data/carson.gemspec CHANGED
@@ -5,7 +5,7 @@ require_relative "lib/carson/version"
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "carson"
7
7
  spec.version = Carson::VERSION
8
- spec.authors = [ "Hailei Wang" ]
8
+ spec.authors = [ "Hailei Wang", "Codex", "Claude Code" ]
9
9
  spec.email = [ "wanghailei@users.noreply.github.com" ]
10
10
  spec.summary = "Autonomous repository governance — you write the code, Carson manages everything else."
11
11
  spec.description = "Carson is a governance runtime that lives outside the repositories it governs — no Carson-owned artefacts in your repo. On every commit, managed hooks enforce centralised lint policy and review gates. At portfolio level, carson govern triages every open PR across your registered repositories: merge what's ready, dispatch coding agents to fix what's failing, escalate what needs human judgement. One command, all your projects, unmanned."
@@ -5,6 +5,9 @@ hooks_dir="$(cd "$(dirname "$0")" && pwd)"
5
5
  style="$(cat "$hooks_dir/workflow_style" 2>/dev/null || echo "branch")"
6
6
  [ "$style" = "trunk" ] && exit 0
7
7
 
8
+ # Allow the very first commit in a new repository (HEAD does not exist yet).
9
+ git rev-parse --verify HEAD >/dev/null 2>&1 || exit 0
10
+
8
11
  branch_name="$(git rev-parse --abbrev-ref HEAD)"
9
12
  if [[ "$branch_name" == "main" || "$branch_name" == "master" ]]; then
10
13
  echo "Carson policy: direct merge commits on ${branch_name} are blocked. Merge through a pull request." >&2
@@ -5,6 +5,9 @@ hooks_dir="$(cd "$(dirname "$0")" && pwd)"
5
5
  style="$(cat "$hooks_dir/workflow_style" 2>/dev/null || echo "branch")"
6
6
  [ "$style" = "trunk" ] && exit 0
7
7
 
8
+ # Allow the very first commit in a new repository (HEAD does not exist yet).
9
+ git rev-parse --verify HEAD >/dev/null 2>&1 || exit 0
10
+
8
11
  branch_name="$(git rev-parse --abbrev-ref HEAD)"
9
12
  if [[ "$branch_name" == "main" || "$branch_name" == "master" ]]; then
10
13
  echo "Carson policy: direct commits on ${branch_name} are blocked. Work on a feature branch and merge via PR." >&2
@@ -6,6 +6,10 @@ module Carson
6
6
  def audit!
7
7
  fingerprint_status = block_if_outsider_fingerprints!
8
8
  return fingerprint_status unless fingerprint_status.nil?
9
+ unless head_exists?
10
+ puts_line "No commits yet — audit skipped for initial commit."
11
+ return EXIT_OK
12
+ end
9
13
  audit_state = "ok"
10
14
  audit_concise_problems = []
11
15
  puts_verbose ""
@@ -77,6 +81,10 @@ module Carson
77
81
  # Thin focused command: show required-check status for the current branch's open PR.
78
82
  # Always exits 0 for pending or passing so callers never see a false "Error: Exit code 8".
79
83
  def check!
84
+ unless head_exists?
85
+ puts_line "Checks: no commits yet."
86
+ return EXIT_OK
87
+ end
80
88
  unless gh_available?
81
89
  puts_line "Checks: gh CLI not available."
82
90
  return EXIT_ERROR
@@ -60,6 +60,12 @@ module Carson
60
60
  @out, @err = saved_out, saved_err
61
61
  end
62
62
 
63
+ # Returns true when the repository has at least one commit (HEAD exists).
64
+ def head_exists?
65
+ _, _, success, = git_run( "rev-parse", "--verify", "HEAD" )
66
+ success
67
+ end
68
+
63
69
  # Current local branch name.
64
70
  def current_branch
65
71
  git_capture!( "rev-parse", "--abbrev-ref", "HEAD" ).strip
metadata CHANGED
@@ -1,10 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carson
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.2
4
+ version: 2.15.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hailei Wang
8
+ - Codex
9
+ - Claude Code
8
10
  bindir: exe
9
11
  cert_chain: []
10
12
  date: 1980-01-02 00:00:00.000000000 Z