fastgrc-openclaw 1.0.6 → 1.0.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.
- package/dist/bin.js +70 -1
- package/dist/bin.mjs +70 -1
- package/openclaw.plugin.json +6 -6
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -120,13 +120,82 @@ if (cmd === "unset-key") {
|
|
|
120
120
|
process.stdout.write("FastGRC API key removed.\n");
|
|
121
121
|
process.exit(0);
|
|
122
122
|
}
|
|
123
|
+
if (cmd === "set-policy") {
|
|
124
|
+
if (!arg) {
|
|
125
|
+
process.stderr.write("Usage: fastgrc-hook set-policy <policy-id>\n");
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
128
|
+
writeConfig({ ...readConfig(), policyId: arg });
|
|
129
|
+
process.stdout.write(`\u2713 FastGRC policy ID saved to ${CONFIG_PATH}
|
|
130
|
+
`);
|
|
131
|
+
process.stdout.write(' Run "fastgrc-hook get-policy" to verify.\n');
|
|
132
|
+
process.exit(0);
|
|
133
|
+
}
|
|
134
|
+
if (cmd === "get-policy") {
|
|
135
|
+
const id = readConfig().policyId;
|
|
136
|
+
if (!id) {
|
|
137
|
+
process.stdout.write("No policy ID stored \u2014 org-wide default will be used.\n");
|
|
138
|
+
process.stdout.write("Run: fastgrc-hook set-policy <policy-id>\n");
|
|
139
|
+
} else {
|
|
140
|
+
process.stdout.write(`${id}
|
|
141
|
+
`);
|
|
142
|
+
}
|
|
143
|
+
process.exit(0);
|
|
144
|
+
}
|
|
145
|
+
if (cmd === "unset-policy") {
|
|
146
|
+
const cfg = readConfig();
|
|
147
|
+
delete cfg.policyId;
|
|
148
|
+
writeConfig(cfg);
|
|
149
|
+
process.stdout.write("FastGRC policy ID removed \u2014 org-wide default will be used.\n");
|
|
150
|
+
process.exit(0);
|
|
151
|
+
}
|
|
152
|
+
if (cmd === "install-hook") {
|
|
153
|
+
const targetDir = arg || process.cwd();
|
|
154
|
+
const hookMdPath = path.join(targetDir, "HOOK.md");
|
|
155
|
+
const HOOK_ENTRY = ' - matcher: PreToolUse\n handler: "fastgrc-hook"\n';
|
|
156
|
+
const HOOK_BLOCK = "---\nname: FastGRC Policy Check\ndescription: Evaluate every tool call against your FastGRC compliance policy\nhooks:\n" + HOOK_ENTRY + "---\n";
|
|
157
|
+
const hasKey = !!(readConfig().apiKey || process.env.FASTGRC_API_KEY);
|
|
158
|
+
if (!hasKey) {
|
|
159
|
+
process.stdout.write("\u26A0 No API key set yet. Run: fastgrc-hook set-key fgrc_k1_your_key\n\n");
|
|
160
|
+
}
|
|
161
|
+
if (!fs.existsSync(hookMdPath)) {
|
|
162
|
+
fs.writeFileSync(hookMdPath, HOOK_BLOCK, "utf8");
|
|
163
|
+
process.stdout.write(`\u2713 Created ${hookMdPath}
|
|
164
|
+
|
|
165
|
+
Restart OpenClaw \u2014 FastGRC will evaluate every tool call.
|
|
166
|
+
`);
|
|
167
|
+
process.exit(0);
|
|
168
|
+
}
|
|
169
|
+
const existing = fs.readFileSync(hookMdPath, "utf8");
|
|
170
|
+
if (existing.includes("fastgrc-hook")) {
|
|
171
|
+
process.stdout.write(`\u2713 FastGRC hook already present in ${hookMdPath}
|
|
172
|
+
`);
|
|
173
|
+
process.exit(0);
|
|
174
|
+
}
|
|
175
|
+
const fmEnd = existing.indexOf("\n---", 3);
|
|
176
|
+
let updated;
|
|
177
|
+
if (fmEnd !== -1) {
|
|
178
|
+
const hasHooksKey = existing.lastIndexOf("hooks:", fmEnd) !== -1;
|
|
179
|
+
const insertText = hasHooksKey ? HOOK_ENTRY : `hooks:
|
|
180
|
+
${HOOK_ENTRY}`;
|
|
181
|
+
updated = existing.slice(0, fmEnd) + "\n" + insertText + existing.slice(fmEnd);
|
|
182
|
+
} else {
|
|
183
|
+
updated = HOOK_BLOCK + "\n" + existing;
|
|
184
|
+
}
|
|
185
|
+
fs.writeFileSync(hookMdPath, updated, "utf8");
|
|
186
|
+
process.stdout.write(`\u2713 Updated ${hookMdPath} \u2014 FastGRC hook added.
|
|
187
|
+
|
|
188
|
+
Restart OpenClaw to activate.
|
|
189
|
+
`);
|
|
190
|
+
process.exit(0);
|
|
191
|
+
}
|
|
123
192
|
var apiKey = process.env.FASTGRC_API_KEY ?? readConfig().apiKey;
|
|
124
193
|
if (!apiKey) {
|
|
125
194
|
process.stderr.write("[fastgrc-hook] No API key configured \u2014 run: fastgrc-hook set-key fgrc_k1_...\n");
|
|
126
195
|
process.exit(0);
|
|
127
196
|
}
|
|
128
197
|
var baseUrl = process.env.FASTGRC_BASE_URL ?? "https://app.fastgrc.ai";
|
|
129
|
-
var policyId = process.env.FASTGRC_POLICY_ID;
|
|
198
|
+
var policyId = process.env.FASTGRC_POLICY_ID ?? readConfig().policyId;
|
|
130
199
|
async function main() {
|
|
131
200
|
const chunks = [];
|
|
132
201
|
for await (const chunk of process.stdin) chunks.push(chunk);
|
package/dist/bin.mjs
CHANGED
|
@@ -97,13 +97,82 @@ if (cmd === "unset-key") {
|
|
|
97
97
|
process.stdout.write("FastGRC API key removed.\n");
|
|
98
98
|
process.exit(0);
|
|
99
99
|
}
|
|
100
|
+
if (cmd === "set-policy") {
|
|
101
|
+
if (!arg) {
|
|
102
|
+
process.stderr.write("Usage: fastgrc-hook set-policy <policy-id>\n");
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
writeConfig({ ...readConfig(), policyId: arg });
|
|
106
|
+
process.stdout.write(`\u2713 FastGRC policy ID saved to ${CONFIG_PATH}
|
|
107
|
+
`);
|
|
108
|
+
process.stdout.write(' Run "fastgrc-hook get-policy" to verify.\n');
|
|
109
|
+
process.exit(0);
|
|
110
|
+
}
|
|
111
|
+
if (cmd === "get-policy") {
|
|
112
|
+
const id = readConfig().policyId;
|
|
113
|
+
if (!id) {
|
|
114
|
+
process.stdout.write("No policy ID stored \u2014 org-wide default will be used.\n");
|
|
115
|
+
process.stdout.write("Run: fastgrc-hook set-policy <policy-id>\n");
|
|
116
|
+
} else {
|
|
117
|
+
process.stdout.write(`${id}
|
|
118
|
+
`);
|
|
119
|
+
}
|
|
120
|
+
process.exit(0);
|
|
121
|
+
}
|
|
122
|
+
if (cmd === "unset-policy") {
|
|
123
|
+
const cfg = readConfig();
|
|
124
|
+
delete cfg.policyId;
|
|
125
|
+
writeConfig(cfg);
|
|
126
|
+
process.stdout.write("FastGRC policy ID removed \u2014 org-wide default will be used.\n");
|
|
127
|
+
process.exit(0);
|
|
128
|
+
}
|
|
129
|
+
if (cmd === "install-hook") {
|
|
130
|
+
const targetDir = arg || process.cwd();
|
|
131
|
+
const hookMdPath = path.join(targetDir, "HOOK.md");
|
|
132
|
+
const HOOK_ENTRY = ' - matcher: PreToolUse\n handler: "fastgrc-hook"\n';
|
|
133
|
+
const HOOK_BLOCK = "---\nname: FastGRC Policy Check\ndescription: Evaluate every tool call against your FastGRC compliance policy\nhooks:\n" + HOOK_ENTRY + "---\n";
|
|
134
|
+
const hasKey = !!(readConfig().apiKey || process.env.FASTGRC_API_KEY);
|
|
135
|
+
if (!hasKey) {
|
|
136
|
+
process.stdout.write("\u26A0 No API key set yet. Run: fastgrc-hook set-key fgrc_k1_your_key\n\n");
|
|
137
|
+
}
|
|
138
|
+
if (!fs.existsSync(hookMdPath)) {
|
|
139
|
+
fs.writeFileSync(hookMdPath, HOOK_BLOCK, "utf8");
|
|
140
|
+
process.stdout.write(`\u2713 Created ${hookMdPath}
|
|
141
|
+
|
|
142
|
+
Restart OpenClaw \u2014 FastGRC will evaluate every tool call.
|
|
143
|
+
`);
|
|
144
|
+
process.exit(0);
|
|
145
|
+
}
|
|
146
|
+
const existing = fs.readFileSync(hookMdPath, "utf8");
|
|
147
|
+
if (existing.includes("fastgrc-hook")) {
|
|
148
|
+
process.stdout.write(`\u2713 FastGRC hook already present in ${hookMdPath}
|
|
149
|
+
`);
|
|
150
|
+
process.exit(0);
|
|
151
|
+
}
|
|
152
|
+
const fmEnd = existing.indexOf("\n---", 3);
|
|
153
|
+
let updated;
|
|
154
|
+
if (fmEnd !== -1) {
|
|
155
|
+
const hasHooksKey = existing.lastIndexOf("hooks:", fmEnd) !== -1;
|
|
156
|
+
const insertText = hasHooksKey ? HOOK_ENTRY : `hooks:
|
|
157
|
+
${HOOK_ENTRY}`;
|
|
158
|
+
updated = existing.slice(0, fmEnd) + "\n" + insertText + existing.slice(fmEnd);
|
|
159
|
+
} else {
|
|
160
|
+
updated = HOOK_BLOCK + "\n" + existing;
|
|
161
|
+
}
|
|
162
|
+
fs.writeFileSync(hookMdPath, updated, "utf8");
|
|
163
|
+
process.stdout.write(`\u2713 Updated ${hookMdPath} \u2014 FastGRC hook added.
|
|
164
|
+
|
|
165
|
+
Restart OpenClaw to activate.
|
|
166
|
+
`);
|
|
167
|
+
process.exit(0);
|
|
168
|
+
}
|
|
100
169
|
var apiKey = process.env.FASTGRC_API_KEY ?? readConfig().apiKey;
|
|
101
170
|
if (!apiKey) {
|
|
102
171
|
process.stderr.write("[fastgrc-hook] No API key configured \u2014 run: fastgrc-hook set-key fgrc_k1_...\n");
|
|
103
172
|
process.exit(0);
|
|
104
173
|
}
|
|
105
174
|
var baseUrl = process.env.FASTGRC_BASE_URL ?? "https://app.fastgrc.ai";
|
|
106
|
-
var policyId = process.env.FASTGRC_POLICY_ID;
|
|
175
|
+
var policyId = process.env.FASTGRC_POLICY_ID ?? readConfig().policyId;
|
|
107
176
|
async function main() {
|
|
108
177
|
const chunks = [];
|
|
109
178
|
for await (const chunk of process.stdin) chunks.push(chunk);
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "fastgrc",
|
|
3
|
-
"name": "FastGRC Policy Router",
|
|
4
|
-
"description": "Evaluate every tool call against your FastGRC compliance policy before it executes. Blocks violations, flags drift, builds an audit trail.",
|
|
5
|
-
"extensions": ["./dist/plugin.js"]
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "fastgrc",
|
|
3
|
+
"name": "FastGRC Policy Router",
|
|
4
|
+
"description": "Evaluate every tool call against your FastGRC compliance policy before it executes. Blocks violations, flags drift, builds an audit trail.",
|
|
5
|
+
"extensions": ["./dist/plugin.js"]
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastgrc-openclaw",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "FastGRC agent compliance plugin for OpenClaw — evaluates every tool call against your policy before it executes",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|