fastgrc-openclaw 1.0.7 → 1.0.9
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 +18 -2
- package/dist/bin.mjs +18 -2
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -152,7 +152,11 @@ if (cmd === "unset-policy") {
|
|
|
152
152
|
if (cmd === "install-hook") {
|
|
153
153
|
const targetDir = arg || process.cwd();
|
|
154
154
|
const hookMdPath = path.join(targetDir, "HOOK.md");
|
|
155
|
-
const
|
|
155
|
+
const homeDir = os.homedir();
|
|
156
|
+
const handlerStr = `HOME=${homeDir} fastgrc-hook`;
|
|
157
|
+
const HOOK_ENTRY = ` - matcher: PreToolUse
|
|
158
|
+
handler: "${handlerStr}"
|
|
159
|
+
`;
|
|
156
160
|
const HOOK_BLOCK = "---\nname: FastGRC Policy Check\ndescription: Evaluate every tool call against your FastGRC compliance policy\nhooks:\n" + HOOK_ENTRY + "---\n";
|
|
157
161
|
const hasKey = !!(readConfig().apiKey || process.env.FASTGRC_API_KEY);
|
|
158
162
|
if (!hasKey) {
|
|
@@ -167,8 +171,20 @@ Restart OpenClaw \u2014 FastGRC will evaluate every tool call.
|
|
|
167
171
|
process.exit(0);
|
|
168
172
|
}
|
|
169
173
|
const existing = fs.readFileSync(hookMdPath, "utf8");
|
|
174
|
+
if (existing.includes(handlerStr)) {
|
|
175
|
+
process.stdout.write(`\u2713 FastGRC hook already up to date in ${hookMdPath}
|
|
176
|
+
`);
|
|
177
|
+
process.exit(0);
|
|
178
|
+
}
|
|
170
179
|
if (existing.includes("fastgrc-hook")) {
|
|
171
|
-
|
|
180
|
+
const patched = existing.replace(
|
|
181
|
+
/handler:\s*"[^"]*fastgrc-hook[^"]*"/,
|
|
182
|
+
`handler: "${handlerStr}"`
|
|
183
|
+
);
|
|
184
|
+
fs.writeFileSync(hookMdPath, patched, "utf8");
|
|
185
|
+
process.stdout.write(`\u2713 Updated handler in ${hookMdPath} \u2014 added HOME prefix.
|
|
186
|
+
|
|
187
|
+
Restart OpenClaw to activate.
|
|
172
188
|
`);
|
|
173
189
|
process.exit(0);
|
|
174
190
|
}
|
package/dist/bin.mjs
CHANGED
|
@@ -129,7 +129,11 @@ if (cmd === "unset-policy") {
|
|
|
129
129
|
if (cmd === "install-hook") {
|
|
130
130
|
const targetDir = arg || process.cwd();
|
|
131
131
|
const hookMdPath = path.join(targetDir, "HOOK.md");
|
|
132
|
-
const
|
|
132
|
+
const homeDir = os.homedir();
|
|
133
|
+
const handlerStr = `HOME=${homeDir} fastgrc-hook`;
|
|
134
|
+
const HOOK_ENTRY = ` - matcher: PreToolUse
|
|
135
|
+
handler: "${handlerStr}"
|
|
136
|
+
`;
|
|
133
137
|
const HOOK_BLOCK = "---\nname: FastGRC Policy Check\ndescription: Evaluate every tool call against your FastGRC compliance policy\nhooks:\n" + HOOK_ENTRY + "---\n";
|
|
134
138
|
const hasKey = !!(readConfig().apiKey || process.env.FASTGRC_API_KEY);
|
|
135
139
|
if (!hasKey) {
|
|
@@ -144,8 +148,20 @@ Restart OpenClaw \u2014 FastGRC will evaluate every tool call.
|
|
|
144
148
|
process.exit(0);
|
|
145
149
|
}
|
|
146
150
|
const existing = fs.readFileSync(hookMdPath, "utf8");
|
|
151
|
+
if (existing.includes(handlerStr)) {
|
|
152
|
+
process.stdout.write(`\u2713 FastGRC hook already up to date in ${hookMdPath}
|
|
153
|
+
`);
|
|
154
|
+
process.exit(0);
|
|
155
|
+
}
|
|
147
156
|
if (existing.includes("fastgrc-hook")) {
|
|
148
|
-
|
|
157
|
+
const patched = existing.replace(
|
|
158
|
+
/handler:\s*"[^"]*fastgrc-hook[^"]*"/,
|
|
159
|
+
`handler: "${handlerStr}"`
|
|
160
|
+
);
|
|
161
|
+
fs.writeFileSync(hookMdPath, patched, "utf8");
|
|
162
|
+
process.stdout.write(`\u2713 Updated handler in ${hookMdPath} \u2014 added HOME prefix.
|
|
163
|
+
|
|
164
|
+
Restart OpenClaw to activate.
|
|
149
165
|
`);
|
|
150
166
|
process.exit(0);
|
|
151
167
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastgrc-openclaw",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
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",
|