Skip to content

Find code by asking what it does. A CLI for coding agents that uses Jev to discover relevant files and source context.

Verify installed Windows CLI and fix remaining launcher and fixture gaps

David Zhang756b6b188b4f
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
new file mode 100644
index 0000000..3081f87
--- /dev/null
+++ b/.github/workflows/windows.yml
@@ -0,0 +1,48 @@
+name: Windows
+
+on:
+ pull_request:
+ push:
+ branches: [main]
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+jobs:
+ windows:
+ runs-on: windows-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ node: [22, 24]
+ steps:
+ - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
+ with:
+ bun-version: 1.3.14
+ - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
+ with:
+ node-version: ${{ matrix.node }}
+ - run: bun install --frozen-lockfile
+ - run: bun run check-types
+ - run: bun run lint
+ - run: bun run build
+ - name: Install the packed npm package in a temporary prefix
+ shell: pwsh
+ run: |
+ $packed = npm pack ./apps/cli --json --ignore-scripts --pack-destination $env:RUNNER_TEMP | ConvertFrom-Json
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+ $tarball = Join-Path $env:RUNNER_TEMP $packed[0].filename
+ $prefix = Join-Path $env:RUNNER_TEMP 'jevgrep install'
+ npm install --global --prefix $prefix --ignore-scripts --no-audit --no-fund $tarball
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+ & (Join-Path $prefix 'jg.cmd') --version
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+ "JEVGREP_TEST_CLI=$(Join-Path $prefix 'node_modules/@dzhng/jevgrep/dist/bin/index.js')" >> $env:GITHUB_ENV
+ - name: Run portable suites against the installed CLI
+ env:
+ JEVGREP_TEST_IN_DOCKER: "1"
+ run: bun test --timeout 30000 ./apps/cli/test ./packages/core/test ./test/discovery.test.ts ./test/evaluator.test.ts ./test/retrieval.test.ts ./test/retrieval-freshness.test.ts
+ - run: node --test packages/core/test-node/provider-protocol.mjs
+ - run: node --test test/skill.test.mjs
diff --git a/apps/cli/src/skill.ts b/apps/cli/src/skill.ts
index 83b89a7..ba690a4 100644
--- a/apps/cli/src/skill.ts
+++ b/apps/cli/src/skill.ts
@@ -12,10 +12,12 @@ export async function installSkill(
if (command.yes) args.push("--yes");
signal.throwIfAborted();
return new Promise((resolve, reject) => {
- const child = spawn("npx", args, {
+ const windows = process.platform === "win32";
+ // Windows needs a shell for npx.cmd. Agent names are restricted by parseCommand.
+ const child = spawn(windows ? `npx ${args.join(" ")}` : "npx", windows ? [] : args, {
// Preserve installer prompts while keeping all CLI output on stdout.
stdio: ["inherit", process.stdout, process.stdout],
- shell: process.platform === "win32",
+ shell: windows,
signal,
killSignal: "SIGINT",
});
diff --git a/apps/cli/test/auth.test.ts b/apps/cli/test/auth.test.ts
index 64e2328..a9faed5 100644
--- a/apps/cli/test/auth.test.ts
+++ b/apps/cli/test/auth.test.ts
@@ -3,6 +3,51 @@ import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { posix, testInDocker, withCli } from "./cli";
+if (!posix)
+ testInDocker(
+ "Windows profile storage is used by auth and always excluded from inventory",
+ async () => {
+ await withCli(async ({ home, run }) => {
+ const env = {
+ XDG_CONFIG_HOME: "",
+ XDG_CACHE_HOME: "",
+ APPDATA: join(home, "roaming"),
+ LOCALAPPDATA: join(home, "local"),
+ };
+ const auth = await run(
+ ["auth", "--provider", "vercel", "--stdin"],
+ "profile-secret\n",
+ env,
+ );
+ expect(auth).toMatchObject({ code: 0, stderr: "" });
+ expect(
+ JSON.parse(await readFile(join(env.APPDATA, "jevgrep/credentials.json"), "utf8")),
+ ).toEqual({
+ provider: "vercel",
+ apiKey: "profile-secret",
+ });
+ await mkdir(join(env.LOCALAPPDATA, "jevgrep"), { recursive: true });
+ await writeFile(join(env.LOCALAPPDATA, "jevgrep/answer.json"), "cached answer");
+ await writeFile(join(home, "visible.py"), "def visible(): pass\n");
+ const inventory = await run(
+ [
+ "files",
+ ".",
+ "--hidden",
+ "--no-ignore",
+ "--include-dependencies",
+ "--include-sensitive",
+ ],
+ "",
+ env,
+ );
+ expect(inventory).toMatchObject({ code: 0, stderr: "" });
+ expect(inventory.stdout).toContain("Jevgrep files: 1 file eligible");
+ expect(inventory.stdout).toContain('"protected" 2');
+ });
+ },
+ );
+
testInDocker("installed auth saves privately, bounds stdin, and never echoes keys", async () => {
await withCli(async ({ home, run }) => {
const saved = await run(["auth", "--provider", "vercel", "--stdin"], "test-gateway-secret\n");
diff --git a/apps/cli/test/package.test.ts b/apps/cli/test/package.test.ts
index 58b6334..d1a6826 100644
--- a/apps/cli/test/package.test.ts
+++ b/apps/cli/test/package.test.ts
@@ -5,7 +5,7 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import { promisify } from "node:util";
import { fileURLToPath } from "node:url";
-import { testInDocker } from "./cli";
+import { posix, testInDocker } from "./cli";
const execute = promisify(execFile);
@@ -24,15 +24,25 @@ testInDocker(
NODE_PATH: "",
npm_config_cache: npmCache,
};
- try {
- const { stdout } = await execute(
- "npm",
- ["pack", "--ignore-scripts", "--json", "--pack-destination", scratch],
+ // npm.cmd needs cmd.exe; all arguments here are fixed options or fixture paths.
+ const npm = (args: string[]) =>
+ execute(
+ posix ? "npm" : "cmd.exe",
+ posix ? args : ["/d", "/s", "/c", `npm ${args.map((arg) => `"${arg}"`).join(" ")}`],
{
cwd: fileURLToPath(new URL("../", import.meta.url)),
env,
+ timeout: 120000,
},
);
+ try {
+ const { stdout } = await npm([
+ "pack",
+ "--ignore-scripts",
+ "--json",
+ "--pack-destination",
+ scratch,
+ ]);
const packed = JSON.parse(stdout)[0];
const filenames = packed.files.map((file: { path: string }) => file.path);
expect(filenames).toContain("dist/bin/index.js");
@@ -45,21 +55,17 @@ testInDocker(
false,
);
const prefix = join(scratch, "install");
- await execute(
- "npm",
- [
- "install",
- "--prefix",
- prefix,
- "--ignore-scripts",
- "--no-audit",
- "--no-fund",
- join(scratch, packed.filename),
- ],
- { cwd: scratch, env, timeout: 120000 },
- );
- const binary = join(prefix, "node_modules/.bin/jg");
- const help = await execute(binary, ["--help"], { cwd: scratch, env });
+ await npm([
+ "install",
+ "--prefix",
+ prefix,
+ "--ignore-scripts",
+ "--no-audit",
+ "--no-fund",
+ join(scratch, packed.filename),
+ ]);
+ const binary = join(prefix, "node_modules/@dzhng/jevgrep/dist/bin/index.js");
+ const help = await execute("node", [binary, "--help"], { cwd: scratch, env });
expect(help.stderr).toBe("");
expect(help.stdout).toContain('Usage: jg "question" [root]');
expect(
diff --git a/packages/core/src/cache.ts b/packages/core/src/cache.ts
index ffc9e33..ea766dc 100644
--- a/packages/core/src/cache.ts
+++ b/packages/core/src/cache.ts
@@ -17,7 +17,7 @@ export type CacheInput = {
export type CacheAnswers = Record<string, number>;
export type CacheIssue = "cache_unavailable" | "cache_corrupt" | "cache_limit";
export type CacheOptions = {
- /** CLI owns XDG resolution; this directory contains only Jevgrep cache data. */
+ /** Caller supplies the storage location; this directory contains only Jevgrep cache data. */
directory: string;
enabled?: boolean;
ttlMs?: number;
diff --git a/packages/core/src/filesystem.ts b/packages/core/src/filesystem.ts
index 3db698b..014b431 100644
--- a/packages/core/src/filesystem.ts
+++ b/packages/core/src/filesystem.ts
@@ -71,7 +71,7 @@ export const filesystemDefaults = Object.freeze({
export type FilesystemOptions = {
root: string;
policy?: FilesystemPolicy;
- /** Absolute credential/cache locations beyond the default XDG locations. Always excluded. */
+ /** Additional absolute credential/cache locations. Always excluded. */
protectedPaths?: readonly string[];
limits?: Partial<
Pick<
diff --git a/packages/core/test/cache.test.ts b/packages/core/test/cache.test.ts
index f6eeb6c..2230103 100644
--- a/packages/core/test/cache.test.ts
+++ b/packages/core/test/cache.test.ts
@@ -204,7 +204,7 @@ test("unavailable or symlinked cache locations never throw or modify the target"
await mkdir(target, { recursive: true });
await writeFile(join(target, "sentinel"), "DO_NOT_TOUCH");
const alias = await directory();
- await symlink(target, alias);
+ await symlink(target, alias, "junction");
const cache = createEvaluationCache({ directory: alias });
expect(await cache.get(input)).toBeUndefined();
await cache.put(input, { question1: 1 });
diff --git a/packages/core/test/filesystem.test.ts b/packages/core/test/filesystem.test.ts
index 3f163f8..d821e50 100644
--- a/packages/core/test/filesystem.test.ts
+++ b/packages/core/test/filesystem.test.ts
@@ -382,7 +382,7 @@ test("one reader observes same-size ignore edits with restored timestamps and re
test("protected storage remains excluded when explicit root resolves through its alias", async () => {
const store = await fixture({ credential: "NEVER_UPLOAD" });
const root = await fixture({});
- await symlink(store, join(root, "alias"));
+ await symlink(store, join(root, "alias"), "junction");
const reader = await createFilesystem({
root: store,
protectedPaths: [join(root, "alias")],
diff --git a/packages/core/test/repository-context.test.ts b/packages/core/test/repository-context.test.ts
index b752cf9..e698acc 100644
--- a/packages/core/test/repository-context.test.ts
+++ b/packages/core/test/repository-context.test.ts
@@ -2,7 +2,7 @@ import { expect } from "bun:test";
import { mkdtemp, mkdir, writeFile, rm, symlink } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
-import { testIfDocker as test } from "../../../test/helpers/docker";
+import { posix, testIfDocker as test } from "../../../test/helpers/docker";
import { createFilesystem } from "../src/filesystem";
import { repositoryContext } from "../src/repository-context";
import type { FileEvidence } from "../src/types";
@@ -34,8 +34,14 @@ test("repository context reports scoped guidance and marks excluded instructions
instructionFiles: ["AGENTS.md", "a/b/AGENTS.md", "a/AGENTS.md"],
instructionLookupIncomplete: false,
});
- await rm(join(root, "a/b/AGENTS.md"));
- await symlink(join(root, "unrelated/AGENTS.md"), join(root, "a/b/AGENTS.md"));
+ if (posix) {
+ await rm(join(root, "a/b/AGENTS.md"));
+ await symlink(join(root, "unrelated/AGENTS.md"), join(root, "a/b/AGENTS.md"));
+ } else {
+ // Junctions exercise excluded guidance without requiring file-symlink privilege.
+ await rm(join(root, "a/b"), { recursive: true });
+ await symlink(join(root, "unrelated"), join(root, "a/b"), "junction");
+ }
const unsafe = await repositoryContext(reader, [file]);
expect(unsafe.instructionFiles).toEqual(["AGENTS.md", "a/AGENTS.md"]);
expect(unsafe.instructionLookupIncomplete).toBe(true);
diff --git a/scripts/test-suite.sh b/scripts/test-suite.sh
index 65267a0..64cd1e7 100644
--- a/scripts/test-suite.sh
+++ b/scripts/test-suite.sh
@@ -2,6 +2,7 @@
set -euo pipefail
bun test --timeout 30000 ./apps/cli/test ./packages/core/test ./test/discovery.test.ts ./test/evaluator.test.ts ./test/retrieval.test.ts ./test/retrieval-freshness.test.ts
node --test packages/core/test-node/provider-protocol.mjs
+node --test test/skill.test.mjs
node --experimental-strip-types --test test/parser/*.test.ts
node --test test/release.test.mjs
python3 -B -m unittest discover -s evals/implementation/swebench -p test_installed.py
diff --git a/test/skill.test.mjs b/test/skill.test.mjs
new file mode 100644
index 0000000..3004396
--- /dev/null
+++ b/test/skill.test.mjs
@@ -0,0 +1,63 @@
+import assert from "node:assert/strict";
+import { execFile } from "node:child_process";
+import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { delimiter, dirname, join } from "node:path";
+import { test } from "node:test";
+import { fileURLToPath } from "node:url";
+import { promisify } from "node:util";
+
+test("skill installer forwards arguments and exit status through the platform launcher", async (t) => {
+ const home = await mkdtemp(join(tmpdir(), "jevgrep-skill-"));
+ t.after(() => rm(home, { recursive: true, force: true }));
+ const bin = join(home, "installer with spaces");
+ await mkdir(bin);
+ const fixture = fileURLToPath(new URL("./fixtures/skill-installer.mjs", import.meta.url));
+ const windows = process.platform === "win32";
+ await writeFile(
+ join(bin, windows ? "npx.cmd" : "npx"),
+ windows
+ ? `@echo off\r\n"${process.execPath}" "${fixture}" %*\r\n`
+ : `#!/bin/sh\nexec "${process.execPath}" "${fixture}" "$@"\n`,
+ { mode: 0o755 },
+ );
+ const cli =
+ process.env.JEVGREP_TEST_CLI ??
+ fileURLToPath(new URL("../apps/cli/dist/bin/index.js", import.meta.url));
+ const result = await promisify(execFile)(
+ process.execPath,
+ [cli, "skill", "--agent", "claude-code", "--agent", "codex", "--global", "--yes"],
+ {
+ cwd: home,
+ env: {
+ ...process.env,
+ HOME: home,
+ XDG_CONFIG_HOME: home,
+ XDG_CACHE_HOME: join(home, "cache"),
+ PATH: [bin, dirname(process.execPath), process.env.PATH].join(delimiter),
+ JEVGREP_INSTALLER_EXIT: "7",
+ },
+ timeout: 10000,
+ },
+ ).then(
+ () => assert.fail("The installer exit status must reach the CLI"),
+ (error) => error,
+ );
+ assert.equal(result.code, 7);
+ assert.equal(result.stdout, "Installer completed.\n");
+ assert.equal(result.stderr, "");
+ assert.deepEqual(JSON.parse(await readFile(join(home, "installed-skill.json"), "utf8")), [
+ "--yes",
+ "skills",
+ "add",
+ "dzhng/jevgrep",
+ "--skill",
+ "jevgrep",
+ "--agent",
+ "claude-code",
+ "--agent",
+ "codex",
+ "--global",
+ "--yes",
+ ]);
+});