Skip to content

Commit e635593

Browse files
committed
chore: prepare for npm publishing
- Updated name to @fpr1m3/opencode-pai-plugin - Added publishConfig for public access - Updated repository field to standard format
1 parent ed38782 commit e635593

5 files changed

Lines changed: 25 additions & 12 deletions

File tree

bun.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lib/redaction.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
* Redaction utility to scrub sensitive data from logs
33
*/
44
export declare function redactString(str: string): string;
5-
export declare function redactObject(obj: any): any;
5+
export declare function redactObject(obj: any, visited?: WeakSet<any>): any;

dist/lib/redaction.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,24 @@ export function redactString(str) {
3838
});
3939
return redacted;
4040
}
41-
export function redactObject(obj) {
41+
export function redactObject(obj, visited = new WeakSet()) {
4242
if (obj === null || obj === undefined)
4343
return obj;
4444
if (typeof obj === 'string') {
4545
return redactString(obj);
4646
}
47+
if (typeof obj !== 'object') {
48+
return obj;
49+
}
50+
if (obj instanceof Date) {
51+
return obj;
52+
}
53+
if (visited.has(obj)) {
54+
return '[CIRCULAR]';
55+
}
56+
visited.add(obj);
4757
if (Array.isArray(obj)) {
48-
return obj.map(item => redactObject(item));
58+
return obj.map(item => redactObject(item, visited));
4959
}
5060
if (typeof obj === 'object') {
5161
const newObj = {};
@@ -56,7 +66,7 @@ export function redactObject(obj) {
5666
newObj[key] = '[REDACTED]';
5767
}
5868
else {
59-
newObj[key] = redactObject(value);
69+
newObj[key] = redactObject(value, visited);
6070
}
6171
}
6272
return newObj;

dist/lib/security.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
/**
2-
* Security Library for PAI Plugin
3-
* Ported from legacy security-validator.ts
4-
*/
1+
import { redactString } from './redaction';
52
const REVERSE_SHELL_PATTERNS = [
63
/\/dev\/(tcp|udp)\/[0-9]/,
74
/bash\s+-i\s+>&?\s*\/dev\//,
@@ -40,7 +37,7 @@ export function validateCommand(command) {
4037
return {
4138
status: 'deny',
4239
category,
43-
feedback: `🚨 SECURITY: Blocked ${category} pattern. Command: ${command.slice(0, 50)}...`,
40+
feedback: `🚨 SECURITY: Blocked ${category} pattern. Command: ${redactString(command).slice(0, 50)}...`,
4441
};
4542
}
4643
}

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "opencode-pai-plugin",
2+
"name": "@fpr1m3/opencode-pai-plugin",
33
"version": "1.0.0",
44
"type": "module",
55
"description": "Personal AI Infrastructure (PAI) plugin for OpenCode",
@@ -8,7 +8,13 @@
88
"files": [
99
"dist"
1010
],
11-
"repository": "fpr1m3/opencode-pai-plugin",
11+
"publishConfig": {
12+
"access": "public"
13+
},
14+
"repository": {
15+
"type": "git",
16+
"url": "git+https://github.com/fpr1m3/opencode-pai-plugin.git"
17+
},
1218
"scripts": {
1319
"build": "tsc",
1420
"test": "bun test",

0 commit comments

Comments
 (0)