@aakrit512/gatekeep 1.0.1 → 1.0.2

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.
@@ -1,4 +1,4 @@
1
- import { execFileSync, execSync } from 'child_process';
1
+ import { execFileSync } from 'child_process';
2
2
  import { createHash } from 'crypto';
3
3
  import * as fs from 'fs';
4
4
  import * as path from 'path';
@@ -1016,18 +1016,22 @@ export function executeTool(name, args) {
1016
1016
  return `Success: Wrote ${content.length} characters to ${filePath}`;
1017
1017
  }
1018
1018
  if (name === 'get_git_diff') {
1019
- // Helper: run a git command and return stdout, or '' on failure (e.g. no commits yet)
1020
- const tryGit = (cmd) => {
1019
+ // Helper: run git subcommands without shell evaluation and return stdout.
1020
+ const tryGit = (args) => {
1021
1021
  try {
1022
- return execSync(cmd, { stdio: ['pipe', 'pipe', 'pipe'] }).toString().trim();
1022
+ return execFileSync('git', args, {
1023
+ cwd: process.cwd(),
1024
+ encoding: 'utf-8',
1025
+ stdio: ['pipe', 'pipe', 'pipe'],
1026
+ }).trim();
1023
1027
  }
1024
1028
  catch {
1025
1029
  return '';
1026
1030
  }
1027
1031
  };
1028
- const working = tryGit('git diff');
1029
- const staged = tryGit('git diff --cached');
1030
- const log = tryGit('git log --oneline --stat -10');
1032
+ const working = tryGit(['diff']);
1033
+ const staged = tryGit(['diff', '--cached']);
1034
+ const log = tryGit(['log', '--oneline', '--stat', '-10']);
1031
1035
  const sections = [
1032
1036
  `## Uncommitted changes (working tree)\n${working || 'None.'}`,
1033
1037
  `## Staged changes (index)\n${staged || 'None.'}`,
package/dist/ui/server.js CHANGED
@@ -112,34 +112,12 @@ function buildConfigFromBody(body) {
112
112
  function uniqueStrings(values) {
113
113
  return [...new Set(values.map((value) => value.trim()).filter(Boolean))];
114
114
  }
115
- function modelListUrl(baseUrl) {
116
- const normalized = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`;
117
- return new URL('models', normalized).toString();
118
- }
119
115
  async function listModels(config) {
120
116
  const fallback = uniqueStrings([config.model, ...CURATED_OPENAI_MODELS]);
121
117
  if (!config.apiKey.trim()) {
122
- return { models: fallback, source: 'fallback', warning: 'Add an API key to load account models.' };
123
- }
124
- const response = await fetch(modelListUrl(config.baseUrl), {
125
- headers: {
126
- authorization: `Bearer ${config.apiKey}`,
127
- },
128
- });
129
- if (!response.ok) {
130
- return {
131
- models: fallback,
132
- source: 'fallback',
133
- warning: `Could not load models (${response.status}).`,
134
- };
118
+ return { models: fallback, source: 'static', warning: 'Add an API key to chat with the model you choose.' };
135
119
  }
136
- const body = await response.json();
137
- const available = new Set((body.data || []).map((model) => typeof model.id === 'string' ? model.id : '').filter(Boolean));
138
- const models = uniqueStrings([
139
- config.model,
140
- ...CURATED_OPENAI_MODELS.filter((model) => available.has(model)),
141
- ]);
142
- return { models: models.length ? models : fallback, source: 'api' };
120
+ return { models: fallback, source: 'static' };
143
121
  }
144
122
  function pickDirectory() {
145
123
  return new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aakrit512/gatekeep",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "A local browser-based coding agent for project review and chat.",
5
5
  "main": "./dist/cli.js",
6
6
  "bin": {