@sigmashake/ssg 0.24.5 → 0.24.7

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.
package/README.md CHANGED
@@ -1,209 +1,101 @@
1
- # sigmashake-gov
1
+ # @sigmashake/ssg
2
2
 
3
- **AI Agent Governance System** Evaluate tool calls, block dangerous operations, and approve via dashboard.
3
+ `ssg` is SigmaShake's AI agent governance CLI. It helps you apply rules to agent tool calls, review approvals locally, search audit history, and manage rulesets from the SigmaShake Hub.
4
4
 
5
- ## Incident Highlight: Claude Code Source Code Leak (March 31, 2026)
6
-
7
- > **One rule. Zero source leaks.**
8
-
9
- On March 31, 2026, Claude Code's TypeScript source code was exposed because `"sourceMap": true` was set in `tsconfig.json`. Source map files (`.map`) map compiled JavaScript back to the original TypeScript source — if served in production, anyone can reconstruct private code.
10
-
11
- The [`rules-typescript`](https://hub.sigmashake.com) ruleset on the SigmaShake Hub includes `no-sourcemap-in-tsconfig`, which blocks any AI agent from enabling source maps in production tsconfig files:
12
-
13
- ```
14
- rule no-sourcemap-in-tsconfig {
15
- enabled true
16
- priority 95
17
- severity error
18
- DENY write
19
- IF path GLOB "**/tsconfig.json"
20
- AND content LINE_REGEX "\"sourceMap\"\\s*:\\s*true"
21
- MESSAGE "sourceMap: true exposes your TypeScript source via .map files.
22
- This configuration caused the Claude Code source code leak (March 31, 2026)."
23
- }
24
- ```
5
+ ## Install
25
6
 
26
7
  ```bash
27
- ssg hub pull rules-typescript # Install the TypeScript ruleset
8
+ npm install -g @sigmashake/ssg
9
+ ssg --help
28
10
  ```
29
11
 
30
- This is precisely the category of silent misconfiguration AI agents introduce — and exactly what SigmaShake governance rules are built to prevent.
31
-
32
- ---
33
-
34
12
  ## Quick Start
35
13
 
36
14
  ```bash
37
- # Install the CLI
38
- npm install -g @sigmashake/ssg
39
-
40
- # Initialize configuration
15
+ # Install adapters and local project config
41
16
  ssg init
42
17
 
43
- # Test a rule (blocks rm -rf)
44
- echo '{"tool":"Bash","input":{"command":"rm -rf /"}}' | ssg eval
45
- # → {"decision":"block", "rule_id":"no-destructive-ops", ...}
46
-
47
- # Start persistent daemon for sub-2ms eval (recommended)
48
- ssg daemon &
49
- echo '{"tool":"Bash","input":{"command":"ls"}}' | nc -U ~/.sigmashake/evald.sock
50
- # → {"decision":"allow", "duration_ns":150000, ...}
18
+ # Re-run guided setup at any time
19
+ ssg setup
51
20
 
52
- # Start approval dashboard
21
+ # Start the local approval dashboard
53
22
  ssg serve
54
23
  ```
55
24
 
56
- ## Overview
57
-
58
- sigmashake-gov provides **runtime safety for AI agents** by:
59
-
60
- 1. **Evaluating tool calls** against configurable rules (e.g., block `rm -rf`, restrict file access)
61
- 2. **Dashboard approval workflow** for uncertain cases (ASK decisions)
62
- 3. **Local SQLite** storage with audit logging
63
-
64
- ## Architecture
65
-
66
- ```
67
- Agent Tool Call
68
-
69
- Hook → ┌─ Daemon (Unix socket, ~0.1-2ms) ← recommended
70
- └─ ssg eval (subprocess, ~73ms+)
71
-
72
- Engine: Native (Zig/Rust, ~5-30µs) → TS Rule Index → TS evaluate
73
-
74
- Decision → Audit Log → Dashboard (if ASK)
75
- ```
25
+ To evaluate a tool call directly:
76
26
 
77
- - **Daemon**: Persistent process (`ssg daemon`) — keeps rules, DB, and native engine hot in memory
78
- - **Native Engine**: Zig + Rust FFI with SIMD-accelerated matching and zero-alloc eval
79
- - **Engine Core**: Rules parser, evaluation logic, SQLite database
80
- - **Server**: Local dashboard (server-rendered HTML + HTMX + SSE for real-time updates)
81
-
82
- See `ARCHITECTURE.md` for full system diagrams and performance budget.
83
-
84
- ## Commands
85
-
86
- | Command | Description |
87
- |---------|-------------|
88
- | `ssg eval` | Evaluate tool call from stdin JSON |
89
- | `ssg check [path]` | Scan files for rule violations |
90
- | `ssg serve` | Start local dashboard (port 5599) |
91
- | `ssg sync` | Pull rules from edge API to SQLite |
92
- | `ssg push` | Push local `.rules` files to edge API |
93
- | `ssg init` | Initialize `.sigmashake/` directory |
94
- | `ssg lint` | Validate `.rules` file syntax |
95
- | `ssg format` | Format `.rules` files (normalize + split oversized rules) |
96
- | `ssg new` | Scaffold a new `.rules` file |
97
- | `ssg man` | Print `.rules` DSL syntax reference |
98
- | `ssg list` | Show all loaded rules |
99
- | `ssg status` | Check setup and dashboard health |
100
- | `ssg doctor` | Full system health diagnostic (`--json` for machine-readable output) |
101
- | `ssg setup` | Interactive setup wizard (re-runnable) |
102
- | `ssg test-rule` | Test rule matching with `--explain` trace |
103
- | `ssg metrics` | Show session metrics (evals, blocked) |
104
- | `ssg blocked` | Show blocked/forced commands from this session |
105
- | `ssg usage` | Show eval usage, storage, and plan limits |
106
- | `ssg dedupe` | Detect duplicate rules (exact/structural/semantic) |
107
- | `ssg rule` | Non-interactive rule management for AI agents (list, disable, enable, set-decision, search) |
108
- | `ssg daemon` | Persistent eval daemon (Unix socket, sub-2ms eval) |
109
- | `ssg profile` | Eval latency profiling (flight logs + live daemon metrics) |
110
- | `ssg flight` | Flight recorder stats (latency, memory, CPU) |
111
- | `ssg install` | Install ssg binary to `~/.local/bin` |
112
- | `ssg keys` | Manage Ed25519 signing keys (generate, show, register, sign, verify) |
113
- | `ssg publish` | Publish local `.rules` to GitHub and hub |
114
- | `ssg hub pull <id>` | Install a ruleset from hub.sigmashake.com (integrity + signature verified) |
115
- | `ssg hub search <q>` | Search the Hub for rulesets by keyword or technology |
116
- | `ssg hub update` | Check installed rulesets for newer versions (`--apply` to install) |
117
- | `ssg hub audit <id>` | Verify a ruleset's transparency log chain integrity locally |
118
- | `ssg certify` | Run scenario files and produce certification report |
119
- | `ssg insights` | Analyze conversation history for governance patterns |
120
- | `ssg audit-sync` | Push local audit log to cloud (Pro/Enterprise) — `--dry-run`, `--quiet`, `--org=<slug>` |
121
-
122
- ## Rule Syntax
123
-
124
- ```
125
- rule no-destructive-ops {
126
- enabled true
127
- priority 100
128
- severity error
129
- DENY execution
130
- IF command CONTAINS "rm -rf"
131
- OR command CONTAINS "git push --force"
132
- MESSAGE "Destructive command blocked."
133
- }
27
+ ```bash
28
+ echo '{"tool":"Bash","input":{"command":"ls"}}' | ssg eval
134
29
  ```
135
30
 
136
- **Key fields:**
137
- - `priority`: Higher = checked first (short-circuit evaluation)
138
- - `decision`: `allow` | `block` | `log` | `shadow` | `ask`
139
- - `target`: `execution` | `read` | `write` | `edit` | `any`
140
- - `IF/OR`: Group conditions with AND/OR logic
141
- - `MESSAGE`: Required human-readable description
31
+ ## What `ssg` Does
142
32
 
143
- See `RULE_SYNTAX.md` for full DSL reference.
33
+ - Evaluates agent tool calls against local governance rules
34
+ - Runs a local approval dashboard for `ask` decisions
35
+ - Stores local audit history and makes it searchable from the CLI
36
+ - Manages rules and rulesets from the SigmaShake Hub
37
+ - Exposes an MCP server for AI agents and editor integrations
144
38
 
145
- ## Configuration
39
+ ## Common Workflows
146
40
 
147
- `.sigmashake/config.toml`:
148
- ```toml
149
- [project]
150
- name = "sigmashake-gov"
41
+ ### Search Local Audit History
151
42
 
152
- [api]
153
- url = "" # Set via SSG_API_URL env var
154
-
155
- [dashboard]
156
- port = 5599
157
- bind = "127.0.0.1"
43
+ ```bash
44
+ ssg audit search --query=rm
45
+ ssg audit search --tool=Bash --decision=block --json
46
+ ```
158
47
 
159
- [eval]
160
- ask_timeout_ms = 60000
161
- ask_fallback = "block"
48
+ ### Manage Rules
162
49
 
163
- [agents]
164
- claude = true
50
+ ```bash
51
+ ssg rule list --json
52
+ ssg rule search destructive
53
+ ssg blocked --json
165
54
  ```
166
55
 
167
- ## Hot Reload
56
+ ### Work with the Hub
168
57
 
169
- Rules from `.sigmashake/rules/*.rules` are loaded fresh on every `ssg eval` invocation. Adding, editing, or removing a `.rules` file takes effect on the very next tool call — no restart needed.
170
-
171
- **Note:** If rules were loaded into SQLite via `ssg sync`, file changes are ignored until you re-run `ssg sync`. Use `ssg list` to verify which rules are active.
58
+ ```bash
59
+ ssg hub search typescript
60
+ ssg hub pull rules-typescript
61
+ ssg hub update --apply
62
+ ```
172
63
 
173
- ## Agent Integration
64
+ ### Configure Agent Integrations
174
65
 
175
- ssg enforces governance for multiple AI coding agents from a single rule set:
66
+ ```bash
67
+ # Configure all supported clients
68
+ ssg init
176
69
 
177
- - **Claude Code**: `ssg hook eval` registered as PreToolUse hook — evaluates tool calls via daemon or subprocess
70
+ # Or configure a single client
71
+ ssg init --client=codex
72
+ ```
178
73
 
179
- Both agents share the same rules from `.sigmashake/rules/` and log to the same SQLite audit database.
74
+ ## Supported AI Clients
180
75
 
181
- ## Safety Features
76
+ `ssg init` supports `claude-code`, `antigravity`, `gemini`, `codex`, `copilot`, and `pi`.
182
77
 
183
- - **Loop guard**: Blocks identical Bash commands repeated 3 times consecutively (prevents agent loops)
184
- - **Circuit breaker**: After 5 consecutive denies in Claude Code hook, auto-allows to prevent lockout. Reset by deleting `/tmp/ssg-deny-count`.
185
- - **Rate limiter**: Per-PID token bucket in daemon (1000 burst, 500/s refill) with permanent trip on exhaustion
186
- - **Fail-open**: If the ssg binary is missing or crashes, tool calls are allowed through — governance never blocks the agent entirely.
187
- - **Native engine fail-secure**: Invalid regex patterns in native Zig engine default to `match=true` (block) with ReDoS protection
78
+ ## Authentication
188
79
 
189
- ## Build
80
+ Local rule evaluation, local dashboard usage, and local audit inspection can be used without signing in. Use `ssg auth login` for account-backed features such as Hub publishing, organization workflows, support, and private repository or ruleset access.
190
81
 
191
- ```bash
192
- bun build --compile src/cli.ts --outfile ssg # Local binary
193
- bun build:linux # Linux x64
194
- bun build:macos # macOS ARM
195
- ```
82
+ ## Useful Commands
196
83
 
197
- ## Tests
84
+ - `ssg init` installs agent adapters and local configuration
85
+ - `ssg setup` walks through recommended setup and ruleset selection
86
+ - `ssg serve` starts the local approval dashboard
87
+ - `ssg audit search` queries local audit history for agents, tools, and actions
88
+ - `ssg doctor` runs a health diagnostic for the local installation
89
+ - `ssg rule ...` lists, searches, enables, disables, and edits rules
90
+ - `ssg hub ...` searches, installs, updates, and audits Hub rulesets
91
+ - `ssg mcp-server` starts the local MCP server for agent integrations
198
92
 
199
- ```bash
200
- bun test # All 931 tests
201
- bun test test/engine.test.ts # Engine only
202
- npx gts fix # Format + lint
203
- ```
93
+ ## Links
204
94
 
205
- Tests: `engine`, `parser`, `evaluate_operators`, `db`, `server`, `html`, `integration`, `e2e-daemon`, `daemon-metrics`, `flight-recorder`, `certify`.
95
+ - Hub: https://hub.sigmashake.com
96
+ - Repository: https://github.com/sigmashake/ssg
97
+ - Accounts: https://accounts.sigmashake.com
206
98
 
207
- ---
99
+ ## License
208
100
 
209
- **License**: Proprietary — Copyright (c) 2026 Sigma Shake. All rights reserved.
101
+ Proprietary. See `LICENSE`.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sigmashake/ssg",
3
- "version": "0.24.5",
4
- "description": "AI Agent Governance CLI \u2014 evaluate tool calls against rules, block dangerous operations, and surface blocked commands",
3
+ "version": "0.24.7",
4
+ "description": "AI Agent Governance CLI evaluate tool calls against rules, block dangerous operations, and surface blocked commands",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "ssg": "bin/ssg.cjs"
@@ -13,11 +13,11 @@
13
13
  "README.md"
14
14
  ],
15
15
  "optionalDependencies": {
16
- "@sigmashake/ssg-linux-x64": "0.24.5",
17
- "@sigmashake/ssg-linux-arm64": "0.24.5",
18
- "@sigmashake/ssg-darwin-arm64": "0.24.5",
19
- "@sigmashake/ssg-darwin-x64": "0.24.5",
20
- "@sigmashake/ssg-win32-x64": "0.24.5"
16
+ "@sigmashake/ssg-linux-x64": "0.24.7",
17
+ "@sigmashake/ssg-linux-arm64": "0.24.7",
18
+ "@sigmashake/ssg-darwin-arm64": "0.24.7",
19
+ "@sigmashake/ssg-darwin-x64": "0.24.7",
20
+ "@sigmashake/ssg-win32-x64": "0.24.7"
21
21
  },
22
22
  "scripts": {
23
23
  "postinstall": "node ./bin/cleanup-globals.cjs",