pkg-gate 0.1.0 → 0.2.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 (3) hide show
  1. package/README.md +7 -1
  2. package/bin/cli.js +3 -0
  3. package/package.json +11 -2
package/README.md CHANGED
@@ -4,6 +4,7 @@ Pre-install security gate for npm lifecycle scripts using TypeSafe System One.
4
4
 
5
5
  ```bash
6
6
  npm install pkg-gate
7
+ export TYPESAFE_API_KEY="ts_..." # get a key at typesafe.ai
7
8
  ```
8
9
 
9
10
  ## Quick start
@@ -21,7 +22,7 @@ if (!report.isSafe()) {
21
22
  console.log(report.inspect());
22
23
  ```
23
24
 
24
- `pkgGate()` evaluates a package or script against TypeSafe System One. `report.isSafe()` returns a boolean verdict. `report.inspect()` renders the TUI card.
25
+ `pkgGate()` evaluates a package or script against TypeSafe System One. `report.isSafe()` returns a boolean verdict. `report.inspect()` renders the TUI card. Without `TYPESAFE_API_KEY`, it falls back to an offline calibrated simulator.
25
26
 
26
27
  ## Check local package
27
28
 
@@ -100,6 +101,11 @@ npx pkg-gate esbuild --plain
100
101
 
101
102
  Exit code `0` on allow, `1` on block, `2` on warn. When a warning triggers in an interactive terminal, prompts the user for confirmation.
102
103
 
104
+ ## Playground
105
+
106
+ Interactive browser playground with live package evaluation, preset scenarios, and architecture flow:
107
+ https://hemanth.github.io/pkg-gate/
108
+
103
109
  ## Demo
104
110
 
105
111
  ```bash
package/bin/cli.js CHANGED
@@ -9,6 +9,7 @@ const helpText = `
9
9
  $ pkg-gate [package-name | path | script]
10
10
 
11
11
  Options
12
+ --api-key, -k TypeSafe API key (or set TYPESAFE_API_KEY env var)
12
13
  --script, -s Evaluate a raw shell command string
13
14
  --json Output strictly typed structured JSON
14
15
  --plain Output plain text summary (no TUI boxes)
@@ -36,6 +37,7 @@ async function main() {
36
37
  plain: { type: 'boolean' },
37
38
  mock: { type: 'boolean' },
38
39
  yes: { type: 'boolean', short: 'y' },
40
+ 'api-key': { type: 'string', short: 'k' },
39
41
  'block-score': { type: 'string' },
40
42
  'warn-score': { type: 'string' },
41
43
  };
@@ -86,6 +88,7 @@ async function main() {
86
88
 
87
89
  try {
88
90
  const report = await pkgGate(target, {
91
+ apiKey: args.values['api-key'] || process.env.TYPESAFE_API_KEY,
89
92
  script: args.values.script,
90
93
  mock: args.values.mock,
91
94
  blockScore: args.values['block-score'] ? parseFloat(args.values['block-score']) : undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pkg-gate",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Pre-install security gate for npm lifecycle scripts using TypeSafe System One.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -22,7 +22,8 @@
22
22
  ],
23
23
  "scripts": {
24
24
  "test": "node --test test/*.test.js",
25
- "demo": "node bin/cli.js test/fixtures/credential-theft.json --mock"
25
+ "demo": "node bin/cli.js test/fixtures/credential-theft.json --mock",
26
+ "playground": "npx serve docs"
26
27
  },
27
28
  "keywords": [
28
29
  "typesafe",
@@ -36,6 +37,14 @@
36
37
  ],
37
38
  "author": "Hemanth HM <hemanth@h3manth.com> (https://h3manth.com)",
38
39
  "license": "MIT",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "git+https://github.com/hemanth/pkg-gate.git"
43
+ },
44
+ "bugs": {
45
+ "url": "https://github.com/hemanth/pkg-gate/issues"
46
+ },
47
+ "homepage": "https://github.com/hemanth/pkg-gate#readme",
39
48
  "dependencies": {
40
49
  "@typesafe-ai/sdk": "^0.6.0"
41
50
  }