cc-safe-setup 9.0.0 → 9.1.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.
Files changed (2) hide show
  1. package/index.mjs +48 -17
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1866,7 +1866,7 @@ function generateCI() {
1866
1866
 
1867
1867
  const workflow = `# Claude Code Safety Audit
1868
1868
  # Generated by: npx cc-safe-setup --generate-ci
1869
- # Checks safety score on every PR and fails if below threshold
1869
+ # Runs safety checks on every PR and push to main
1870
1870
 
1871
1871
  name: Claude Code Safety
1872
1872
  on:
@@ -1880,24 +1880,55 @@ jobs:
1880
1880
  steps:
1881
1881
  - uses: actions/checkout@v4
1882
1882
 
1883
- - name: Run safety audit
1884
- uses: yurukusa/cc-safe-setup@main
1883
+ - name: Setup Node.js
1884
+ uses: actions/setup-node@v4
1885
1885
  with:
1886
- threshold: 70
1886
+ node-version: 20
1887
1887
 
1888
- - name: Comment PR with score
1889
- if: github.event_name == 'pull_request'
1890
- uses: actions/github-script@v7
1891
- with:
1892
- script: |
1893
- const score = '\${{ steps.audit.outputs.score }}' || '?';
1894
- const grade = '\${{ steps.audit.outputs.grade }}' || '?';
1895
- github.rest.issues.createComment({
1896
- issue_number: context.issue.number,
1897
- owner: context.repo.owner,
1898
- repo: context.repo.repo,
1899
- body: \`## Claude Code Safety: \${score}/100 (Grade \${grade})\\n\\nRun \\\`npx cc-safe-setup --audit\\\` locally for details.\`
1900
- });
1888
+ - name: Install jq
1889
+ run: sudo apt-get install -y jq
1890
+
1891
+ - name: Run safety audit
1892
+ id: audit
1893
+ run: |
1894
+ npx cc-safe-setup --audit --json > /tmp/audit.json 2>&1 || true
1895
+ SCORE=\$(cat /tmp/audit.json | jq -r '.score // 0' 2>/dev/null || echo 0)
1896
+ echo "score=\$SCORE" >> \$GITHUB_OUTPUT
1897
+ echo "Safety score: \$SCORE/100"
1898
+ if [ "\$SCORE" -lt 70 ]; then
1899
+ echo "::error::Safety score \$SCORE is below threshold (70)"
1900
+ exit 1
1901
+ fi
1902
+
1903
+ - name: Verify hooks syntax
1904
+ run: |
1905
+ ERRORS=0
1906
+ for f in .claude/hooks/*.sh 2>/dev/null; do
1907
+ [ -f "\$f" ] || continue
1908
+ if ! bash -n "\$f" 2>/dev/null; then
1909
+ echo "::error file=\$f::Syntax error in hook"
1910
+ ERRORS=\$((ERRORS+1))
1911
+ fi
1912
+ done
1913
+ echo "Checked hooks: \$ERRORS error(s)"
1914
+ [ "\$ERRORS" -gt 0 ] && exit 1 || true
1915
+
1916
+ - name: Check settings.json validity
1917
+ run: |
1918
+ if [ -f ".claude/settings.json" ]; then
1919
+ python3 -c "import json; json.load(open('.claude/settings.json'))" || {
1920
+ echo "::error::.claude/settings.json has invalid JSON"
1921
+ exit 1
1922
+ }
1923
+ echo "settings.json: valid"
1924
+ fi
1925
+ if [ -f ".claude/settings.local.json" ]; then
1926
+ python3 -c "import json; json.load(open('.claude/settings.local.json'))" || {
1927
+ echo "::error::.claude/settings.local.json has invalid JSON"
1928
+ exit 1
1929
+ }
1930
+ echo "settings.local.json: valid"
1931
+ fi
1901
1932
  `;
1902
1933
 
1903
1934
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-safe-setup",
3
- "version": "9.0.0",
3
+ "version": "9.1.0",
4
4
  "description": "One command to make Claude Code safe. 59 hooks (8 built-in + 51 examples). 26 CLI commands: dashboard, create, audit, lint, diff, migrate, compare, generate-ci. 284 tests.",
5
5
  "main": "index.mjs",
6
6
  "bin": {