@uniglot/wont-let-you-see 0.1.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.
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@uniglot/wont-let-you-see",
3
+ "version": "0.1.0",
4
+ "description": "OpenCode plugin that masks sensitive cloud infrastructure data (AWS, Kubernetes) from LLMs",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "module": "dist/index.js",
8
+ "type": "module",
9
+ "private": false,
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "keywords": [
14
+ "opencode",
15
+ "plugin",
16
+ "security",
17
+ "aws",
18
+ "kubernetes",
19
+ "k8s",
20
+ "masking",
21
+ "privacy"
22
+ ],
23
+ "author": "Yuneui Jeong (contact@uniglot.dev)",
24
+ "license": "MIT",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/uniglot/wont-let-you-see.git"
28
+ },
29
+ "scripts": {
30
+ "test": "vitest",
31
+ "build": "bun build src/index.ts --outdir=dist --target=node --format=esm",
32
+ "typecheck": "tsc --noEmit",
33
+ "format": "prettier --write \"src/**/*.ts\""
34
+ },
35
+ "devDependencies": {
36
+ "@types/bun": "latest",
37
+ "prettier": "^3.8.1",
38
+ "typescript": "^5.9.3",
39
+ "vitest": "^2.1.8"
40
+ },
41
+ "dependencies": {
42
+ "@opencode-ai/plugin": "^1.1.35"
43
+ }
44
+ }
@@ -0,0 +1,98 @@
1
+ import { describe, it, expect, beforeEach, afterEach } from "vitest";
2
+ import { getConfig, resetConfig, isPatternEnabled } from "../config";
3
+
4
+ describe("Config", () => {
5
+ const originalEnv = { ...process.env };
6
+
7
+ beforeEach(() => {
8
+ resetConfig();
9
+ });
10
+
11
+ afterEach(() => {
12
+ process.env = { ...originalEnv };
13
+ resetConfig();
14
+ });
15
+
16
+ describe("getConfig", () => {
17
+ it("should return enabled by default", () => {
18
+ const config = getConfig();
19
+ expect(config.enabled).toBe(true);
20
+ });
21
+
22
+ it("should respect WONT_LET_YOU_SEE_ENABLED=false", () => {
23
+ process.env.WONT_LET_YOU_SEE_ENABLED = "false";
24
+ const config = getConfig();
25
+ expect(config.enabled).toBe(false);
26
+ });
27
+
28
+ it("should respect WONT_LET_YOU_SEE_ENABLED=0", () => {
29
+ process.env.WONT_LET_YOU_SEE_ENABLED = "0";
30
+ const config = getConfig();
31
+ expect(config.enabled).toBe(false);
32
+ });
33
+
34
+ it("should treat WONT_LET_YOU_SEE_ENABLED=true as enabled", () => {
35
+ process.env.WONT_LET_YOU_SEE_ENABLED = "true";
36
+ const config = getConfig();
37
+ expect(config.enabled).toBe(true);
38
+ });
39
+
40
+ it("should parse WONT_LET_YOU_SEE_REVEALED_PATTERNS", () => {
41
+ process.env.WONT_LET_YOU_SEE_REVEALED_PATTERNS = "eks-cluster,arn,vpc";
42
+ const config = getConfig();
43
+ expect(config.revealedPatterns).toEqual(["eks-cluster", "arn", "vpc"]);
44
+ });
45
+
46
+ it("should trim whitespace from revealed patterns", () => {
47
+ process.env.WONT_LET_YOU_SEE_REVEALED_PATTERNS =
48
+ " eks-cluster , arn , vpc ";
49
+ const config = getConfig();
50
+ expect(config.revealedPatterns).toEqual(["eks-cluster", "arn", "vpc"]);
51
+ });
52
+
53
+ it("should filter empty patterns", () => {
54
+ process.env.WONT_LET_YOU_SEE_REVEALED_PATTERNS = "eks-cluster,,arn";
55
+ const config = getConfig();
56
+ expect(config.revealedPatterns).toEqual(["eks-cluster", "arn"]);
57
+ });
58
+
59
+ it("should cache config after first load", () => {
60
+ const config1 = getConfig();
61
+ process.env.WONT_LET_YOU_SEE_ENABLED = "false";
62
+ const config2 = getConfig();
63
+ expect(config1).toBe(config2);
64
+ expect(config2.enabled).toBe(true);
65
+ });
66
+ });
67
+
68
+ describe("resetConfig", () => {
69
+ it("should clear cached config", () => {
70
+ const config1 = getConfig();
71
+ expect(config1.enabled).toBe(true);
72
+
73
+ process.env.WONT_LET_YOU_SEE_ENABLED = "false";
74
+ resetConfig();
75
+
76
+ const config2 = getConfig();
77
+ expect(config2.enabled).toBe(false);
78
+ });
79
+ });
80
+
81
+ describe("isPatternEnabled", () => {
82
+ it("should return true for enabled patterns", () => {
83
+ expect(isPatternEnabled("vpc")).toBe(true);
84
+ });
85
+
86
+ it("should return false when plugin is disabled", () => {
87
+ process.env.WONT_LET_YOU_SEE_ENABLED = "false";
88
+ expect(isPatternEnabled("vpc")).toBe(false);
89
+ });
90
+
91
+ it("should return false for revealed patterns", () => {
92
+ process.env.WONT_LET_YOU_SEE_REVEALED_PATTERNS = "eks-cluster,arn";
93
+ expect(isPatternEnabled("eks-cluster")).toBe(false);
94
+ expect(isPatternEnabled("arn")).toBe(false);
95
+ expect(isPatternEnabled("vpc")).toBe(true);
96
+ });
97
+ });
98
+ });