@safetnsr/vet 1.25.0 → 1.26.1

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/cli.js CHANGED
@@ -358,6 +358,14 @@ async function withTimeout(name, fn, timeoutMs = 30_000) {
358
358
  /** Get files changed vs main/master branch or --since ref */
359
359
  function getChangedFiles(cwd, sinceRef) {
360
360
  const base = sinceRef || (() => {
361
+ // In GitHub Actions PR context, use GITHUB_BASE_REF
362
+ const ghBase = process.env.GITHUB_BASE_REF;
363
+ if (ghBase) {
364
+ const ref = gitExec(['merge-base', 'HEAD', `origin/${ghBase}`], cwd);
365
+ if (ref)
366
+ return ref;
367
+ }
368
+ // Fallback: try merge-base with main/master
361
369
  const main = gitExec(['merge-base', 'HEAD', 'origin/main'], cwd);
362
370
  if (main)
363
371
  return main;
@@ -0,0 +1,4 @@
1
+ export declare function runUserQuery(input: string): any;
2
+ export declare function fetchExternal(url: string): Promise<any>;
3
+ export declare function renderHtml(userContent: string): void;
4
+ export declare function cloneDeep(obj: any): any;
@@ -0,0 +1,22 @@
1
+ // HACK: quick and dirty data processor
2
+ const ADMIN_TOKEN = "ghp_x8K2mNpQ4rS7tU9vW1yZ3bD5fH7jL0nR2p";
3
+ export function runUserQuery(input) {
4
+ const query = `SELECT * FROM users WHERE name = '${input}'`;
5
+ return eval(query);
6
+ }
7
+ export async function fetchExternal(url) {
8
+ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
9
+ const res = await fetch(url);
10
+ try {
11
+ return await res.json();
12
+ }
13
+ catch (e) {
14
+ // whatever
15
+ }
16
+ }
17
+ export function renderHtml(userContent) {
18
+ document.getElementById('app').innerHTML = userContent;
19
+ }
20
+ export function cloneDeep(obj) {
21
+ return new Function('return ' + JSON.stringify(obj))();
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@safetnsr/vet",
3
- "version": "1.25.0",
3
+ "version": "1.26.1",
4
4
  "description": "vet your AI-generated code — one command, one score card, one letter grade",
5
5
  "type": "module",
6
6
  "bin": {