@sigmashake/ssg 0.12.6 → 0.12.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.
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ // bin/cleanup-globals.cjs — Cleans up conflicting global ssg installations
3
+ // This runs on `postinstall` to ensure npm takes precedence
4
+
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+ const os = require('os');
8
+
9
+ // Only run cleanup if installed globally via npm (or we assume global if running in a global node_modules directory)
10
+ const isGlobal =
11
+ process.env.npm_config_global === 'true' ||
12
+ __dirname.includes('/lib/node_modules/') ||
13
+ __dirname.includes('\\npm\\node_modules\\');
14
+
15
+ if (!isGlobal) {
16
+ process.exit(0);
17
+ }
18
+
19
+ const homedir = os.homedir();
20
+ const targets = [
21
+ path.join(homedir, '.local', 'bin', 'ssg'),
22
+ path.join(homedir, '.local', 'bin', 'libssg_eval.so'),
23
+ path.join(homedir, '.bun', 'bin', 'ssg'),
24
+ ];
25
+
26
+ let cleaned = false;
27
+
28
+ for (const target of targets) {
29
+ try {
30
+ if (!fs.existsSync(target)) continue;
31
+
32
+ // Do not delete if it actually belongs to this exact npm installation (symlink loopback check)
33
+ // Sometimes package managers like bun map symlinks directly to the node_modules bin.
34
+ const realPath = fs.realpathSync(target);
35
+ if (realPath.includes(__dirname)) {
36
+ continue;
37
+ }
38
+
39
+ // Attempt to remove the conflicting binary
40
+ fs.rmSync(target, {force: true});
41
+ console.log(`[ssg-cleanup] Removed conflicting global binary: ${target}`);
42
+ cleaned = true;
43
+ } catch (e) {
44
+ console.warn(`[ssg-cleanup] Could not remove ${target}: ${e.message}`);
45
+ }
46
+ }
47
+
48
+ if (cleaned) {
49
+ console.log('[ssg-cleanup] Successfully cleaned up old binary conflicts designed for local development.');
50
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigmashake/ssg",
3
- "version": "0.12.6",
3
+ "version": "0.12.7",
4
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": {
@@ -12,13 +12,14 @@
12
12
  "README.md"
13
13
  ],
14
14
  "optionalDependencies": {
15
- "@sigmashake/ssg-linux-x64": "~0.12.6",
16
- "@sigmashake/ssg-linux-arm64": "~0.12.6",
17
- "@sigmashake/ssg-darwin-arm64": "~0.12.6",
18
- "@sigmashake/ssg-darwin-x64": "~0.12.6",
19
- "@sigmashake/ssg-win32-x64": "~0.12.6"
15
+ "@sigmashake/ssg-linux-x64": "~0.12.7",
16
+ "@sigmashake/ssg-linux-arm64": "~0.12.7",
17
+ "@sigmashake/ssg-darwin-arm64": "~0.12.7",
18
+ "@sigmashake/ssg-darwin-x64": "~0.12.7",
19
+ "@sigmashake/ssg-win32-x64": "~0.12.7"
20
20
  },
21
21
  "scripts": {
22
+ "postinstall": "node ./bin/cleanup-globals.cjs",
22
23
  "dev": "bun run src/cli.ts",
23
24
  "build": "bun build --compile src/cli.ts --outfile ssg",
24
25
  "build:linux": "bun build --compile --target=bun-linux-x64 src/cli.ts --outfile dist/ssg-linux-x64",