guardrails-ref 1.0.2 → 1.0.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # guardrails-ref
2
2
 
3
- CLI for [Agent Guardrails](https://github.com/9atar6/agent-guardrails) — validate, init, setup, and add GUARDRAIL.md files.
3
+ CLI for [Agent Guardrails](https://github.com/9atar6/agent-guardrails) — init, add, remove, setup, validate, and list GUARDRAIL.md files.
4
4
 
5
5
  ## Install
6
6
 
@@ -18,7 +18,7 @@ No global install needed. Or: `npm install -g guardrails-ref`
18
18
  | `npx guardrails-ref add <name> [path]` | Add an example guardrail (e.g. no-destructive-commands, database-migrations) |
19
19
  | `npx guardrails-ref remove <name> [path]` | Remove a guardrail from .agents/guardrails/ |
20
20
  | `npx guardrails-ref setup [path]` | Add the guardrail rule to Cursor rules and Claude instructions |
21
- | `npx guardrails-ref validate [path]` | Validate GUARDRAIL.md files |
21
+ | `npx guardrails-ref validate [path]` | Validate GUARDRAIL.md files (use `--json` for JSON output) |
22
22
  | `npx guardrails-ref list [path]` | List discovered guardrails (use `--json` for JSON output) |
23
23
 
24
24
  ## Examples
package/dist/cli.js CHANGED
@@ -13,8 +13,25 @@ program
13
13
  program
14
14
  .command("validate [path]")
15
15
  .description("Validate GUARDRAIL.md files in a directory or a single file")
16
- .action((path = ".") => {
16
+ .option("-j, --json", "Output as JSON")
17
+ .action((path = ".", options) => {
17
18
  const result = validatePath(path);
19
+ if (options.json) {
20
+ const json = {
21
+ valid: result.valid,
22
+ invalid: result.invalid,
23
+ total: result.total,
24
+ results: result.results.map((r) => ({
25
+ path: r.path,
26
+ success: r.success,
27
+ errors: r.errors,
28
+ warnings: r.warnings,
29
+ })),
30
+ };
31
+ console.log(JSON.stringify(json, null, 2));
32
+ process.exit(result.invalid > 0 ? 1 : 0);
33
+ return;
34
+ }
18
35
  let hasErrors = false;
19
36
  for (const r of result.results) {
20
37
  if (r.success) {
package/dist/templates.js CHANGED
@@ -12,6 +12,10 @@ triggers:
12
12
  - "Implementing authentication"
13
13
  - "API integration"
14
14
  - "Handling credentials"
15
+ license: MIT
16
+ metadata:
17
+ author: agent-guardrails
18
+ version: "1.0"
15
19
  ---
16
20
 
17
21
  # No Plaintext Secrets
@@ -40,6 +44,10 @@ triggers:
40
44
  - "Database migrations"
41
45
  - "Prisma schema"
42
46
  - "SQL migrations"
47
+ license: MIT
48
+ metadata:
49
+ author: agent-guardrails
50
+ version: "1.0"
43
51
  ---
44
52
 
45
53
  # Database Migrations
@@ -70,6 +78,10 @@ triggers:
70
78
  - "rm -rf"
71
79
  - "DROP TABLE"
72
80
  - "TRUNCATE"
81
+ license: MIT
82
+ metadata:
83
+ author: agent-guardrails
84
+ version: "1.0"
73
85
  ---
74
86
 
75
87
  # No Destructive Commands
@@ -99,6 +111,10 @@ triggers:
99
111
  - "pip install"
100
112
  - "New library"
101
113
  - "Use package X"
114
+ license: MIT
115
+ metadata:
116
+ author: agent-guardrails
117
+ version: "1.0"
102
118
  ---
103
119
 
104
120
  # No New Dependencies Without Approval
@@ -126,6 +142,10 @@ triggers:
126
142
  - "Stripe or payment API calls"
127
143
  - "External API calls in loops"
128
144
  - "Context window approaching capacity"
145
+ license: MIT
146
+ metadata:
147
+ author: agent-guardrails
148
+ version: "1.0"
129
149
  ---
130
150
 
131
151
  # Rate Limiting
@@ -154,6 +174,10 @@ triggers:
154
174
  - "console.log"
155
175
  - "console.debug"
156
176
  - "Trace statements"
177
+ license: MIT
178
+ metadata:
179
+ author: agent-guardrails
180
+ version: "1.0"
157
181
  ---
158
182
 
159
183
  # No Console in Production
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "guardrails-ref",
3
- "version": "1.0.2",
4
- "description": "Validate and manage Agent Guardrails (GUARDRAIL.md) — init, setup, add, validate",
3
+ "version": "1.0.3",
4
+ "description": "Validate and manage Agent Guardrails (GUARDRAIL.md) — init, add, remove, setup, validate, list",
5
5
  "type": "module",
6
6
  "main": "dist/validate.js",
7
7
  "bin": {
@@ -9,6 +9,7 @@
9
9
  },
10
10
  "scripts": {
11
11
  "build": "tsc",
12
+ "test": "npm run build && node --test test/*.test.js",
12
13
  "validate": "node dist/cli.js validate",
13
14
  "list": "node dist/cli.js list",
14
15
  "prepublishOnly": "npm run build"