auditor-lambda 0.3.29 → 0.3.30
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 +1 -1
- package/scripts/postinstall.mjs +49 -0
package/package.json
CHANGED
package/scripts/postinstall.mjs
CHANGED
|
@@ -200,6 +200,26 @@ function renderGlobalMcpLauncher(installedPkgRoot) {
|
|
|
200
200
|
].join('\n');
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
+
function splitFrontmatter(text) {
|
|
204
|
+
const normalized = text.replace(/\r\n/g, '\n');
|
|
205
|
+
const match = normalized.match(/^---\n[\s\S]*?\n---\n?/u);
|
|
206
|
+
return { body: match ? normalized.slice(match[0].length) : normalized };
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function renderAntigravityToml(description, promptBody) {
|
|
210
|
+
const escaped = promptBody.replace(/"""/g, '\\"\\"\\"');
|
|
211
|
+
return `description = ${JSON.stringify(description)}\nprompt = """\n${escaped}"""\n`;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function mergeExtensionEnablement(existing, extensionName) {
|
|
215
|
+
const parsed = existing ? JSON.parse(existing) : {};
|
|
216
|
+
if (!parsed[extensionName]) {
|
|
217
|
+
const homePrefix = replaceBackslashes(join(homedir(), '*'));
|
|
218
|
+
parsed[extensionName] = { overrides: [`/${homePrefix}`] };
|
|
219
|
+
}
|
|
220
|
+
return parsed;
|
|
221
|
+
}
|
|
222
|
+
|
|
203
223
|
function objectValue(value) {
|
|
204
224
|
return value && typeof value === 'object' && !Array.isArray(value)
|
|
205
225
|
? value
|
|
@@ -359,6 +379,7 @@ if (!promptSource || !skillSource) {
|
|
|
359
379
|
process.exit(0);
|
|
360
380
|
}
|
|
361
381
|
|
|
382
|
+
const promptBody = splitFrontmatter(promptSource.toString('utf8')).body;
|
|
362
383
|
const codexOpenAiAgentSource = readOptionalSource(codexOpenAiAgentSourceFile, 'Codex skill UI metadata');
|
|
363
384
|
|
|
364
385
|
const installs = [
|
|
@@ -426,3 +447,31 @@ try {
|
|
|
426
447
|
console.warn(` To install manually, add the mcp.auditor and command["audit-code"] entries to:`);
|
|
427
448
|
console.warn(` ${opencodeGlobalConfig}`);
|
|
428
449
|
}
|
|
450
|
+
|
|
451
|
+
// Install Antigravity extension (Gemini IDE slash command)
|
|
452
|
+
const antigravityExtDir = join(homedir(), '.gemini', 'extensions', 'audit-code');
|
|
453
|
+
const antigravityManifestPath = join(antigravityExtDir, 'gemini-extension.json');
|
|
454
|
+
const antigravityCommandPath = join(antigravityExtDir, 'commands', 'audit-code.toml');
|
|
455
|
+
const antigravityEnablementPath = join(homedir(), '.gemini', 'extensions', 'extension-enablement.json');
|
|
456
|
+
|
|
457
|
+
try {
|
|
458
|
+
const manifestAction = writeGeneratedFile(
|
|
459
|
+
antigravityManifestPath,
|
|
460
|
+
Buffer.from(JSON.stringify({ name: 'audit-code', version: '1.0.0' }, null, 2) + '\n'),
|
|
461
|
+
);
|
|
462
|
+
console.log(`audit-code: ${manifestAction} Antigravity extension manifest at ${antigravityManifestPath}`);
|
|
463
|
+
|
|
464
|
+
const tomlContent = renderAntigravityToml(
|
|
465
|
+
'Autonomous local loop code auditing - loads one backend-rendered audit step at a time',
|
|
466
|
+
promptBody,
|
|
467
|
+
);
|
|
468
|
+
const commandAction = writeGeneratedFile(antigravityCommandPath, Buffer.from(tomlContent));
|
|
469
|
+
console.log(`audit-code: ${commandAction} Antigravity command at ${antigravityCommandPath}`);
|
|
470
|
+
|
|
471
|
+
const enablementAction = installMergedJson(antigravityEnablementPath, (existing) =>
|
|
472
|
+
mergeExtensionEnablement(existing, 'audit-code'),
|
|
473
|
+
);
|
|
474
|
+
console.log(`audit-code: ${enablementAction} Antigravity extension enablement at ${antigravityEnablementPath}`);
|
|
475
|
+
} catch (err) {
|
|
476
|
+
console.warn(`audit-code: could not install Antigravity extension (${err.message})`);
|
|
477
|
+
}
|