@sigmashake/ssg 0.24.5 → 0.24.6
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 +61 -169
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,209 +1,101 @@
|
|
|
1
|
-
# sigmashake
|
|
1
|
+
# @sigmashake/ssg
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
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
|
|
38
|
-
npm install -g @sigmashake/ssg
|
|
39
|
-
|
|
40
|
-
# Initialize configuration
|
|
15
|
+
# Install adapters and local project config
|
|
41
16
|
ssg init
|
|
42
17
|
|
|
43
|
-
#
|
|
44
|
-
|
|
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
|
-
|
|
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
|
-
|
|
78
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
39
|
+
## Common Workflows
|
|
146
40
|
|
|
147
|
-
|
|
148
|
-
```toml
|
|
149
|
-
[project]
|
|
150
|
-
name = "sigmashake-gov"
|
|
41
|
+
### Search Local Audit History
|
|
151
42
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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
|
-
|
|
160
|
-
ask_timeout_ms = 60000
|
|
161
|
-
ask_fallback = "block"
|
|
48
|
+
### Manage Rules
|
|
162
49
|
|
|
163
|
-
|
|
164
|
-
|
|
50
|
+
```bash
|
|
51
|
+
ssg rule list --json
|
|
52
|
+
ssg rule search destructive
|
|
53
|
+
ssg blocked --json
|
|
165
54
|
```
|
|
166
55
|
|
|
167
|
-
|
|
56
|
+
### Work with the Hub
|
|
168
57
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
58
|
+
```bash
|
|
59
|
+
ssg hub search typescript
|
|
60
|
+
ssg hub pull rules-typescript
|
|
61
|
+
ssg hub update --apply
|
|
62
|
+
```
|
|
172
63
|
|
|
173
|
-
|
|
64
|
+
### Configure Agent Integrations
|
|
174
65
|
|
|
175
|
-
|
|
66
|
+
```bash
|
|
67
|
+
# Configure all supported clients
|
|
68
|
+
ssg init
|
|
176
69
|
|
|
177
|
-
|
|
70
|
+
# Or configure a single client
|
|
71
|
+
ssg init --client=codex
|
|
72
|
+
```
|
|
178
73
|
|
|
179
|
-
|
|
74
|
+
## Supported AI Clients
|
|
180
75
|
|
|
181
|
-
|
|
76
|
+
`ssg init` supports `claude-code`, `antigravity`, `gemini`, `codex`, `copilot`, and `pi`.
|
|
182
77
|
|
|
183
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
101
|
+
Proprietary. See `LICENSE`.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigmashake/ssg",
|
|
3
|
-
"version": "0.24.
|
|
4
|
-
"description": "AI Agent Governance CLI
|
|
3
|
+
"version": "0.24.6",
|
|
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.
|
|
17
|
-
"@sigmashake/ssg-linux-arm64": "0.24.
|
|
18
|
-
"@sigmashake/ssg-darwin-arm64": "0.24.
|
|
19
|
-
"@sigmashake/ssg-darwin-x64": "0.24.
|
|
20
|
-
"@sigmashake/ssg-win32-x64": "0.24.
|
|
16
|
+
"@sigmashake/ssg-linux-x64": "0.24.6",
|
|
17
|
+
"@sigmashake/ssg-linux-arm64": "0.24.6",
|
|
18
|
+
"@sigmashake/ssg-darwin-arm64": "0.24.6",
|
|
19
|
+
"@sigmashake/ssg-darwin-x64": "0.24.6",
|
|
20
|
+
"@sigmashake/ssg-win32-x64": "0.24.6"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"postinstall": "node ./bin/cleanup-globals.cjs",
|