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.

Remove duplicate storage plumbing and finish release review

David Zhang92d036536f45
diff --git a/apps/cli/README.md b/apps/cli/README.md
index 60fa12b..db73144 100644
--- a/apps/cli/README.md
+++ b/apps/cli/README.md
@@ -68,9 +68,9 @@ These answers need neither `probabilities` nor `confidence`. A server that deman
Credentials are saved under
`$XDG_CONFIG_HOME/jevgrep/credentials.json`, or `~/.config/jevgrep/credentials.json`.
-On Windows without `XDG_CONFIG_HOME`, they are saved in `%APPDATA%\jevgrep\credentials.json`
-and the cache lives in `%LOCALAPPDATA%\jevgrep`. Windows ignores POSIX file modes, so
-these files rely on the user profile's access controls.
+On Windows, config defaults to `%APPDATA%\jevgrep` and cache to `%LOCALAPPDATA%\jevgrep`.
+`XDG_CONFIG_HOME` and `XDG_CACHE_HOME` override their respective locations independently.
+Windows ignores POSIX file modes, so these files rely on the user profile's access controls.
Existing saved records without a provider still mean Vercel, without a migration.
API-key, endpoint, and model environment overrides are ignored; users who only
configured an environment key must run auth. There is no automatic fallback or
diff --git a/apps/cli/src/auth.ts b/apps/cli/src/auth.ts
index 5fb8b83..c582f96 100644
--- a/apps/cli/src/auth.ts
+++ b/apps/cli/src/auth.ts
@@ -16,10 +16,6 @@ import {
import { storageDirectory } from "@repo/core/storage";
import { CliError } from "./errors";
-export function configDirectory() {
- return storageDirectory("config");
-}
-
function validateKey(raw: string): string {
const key = raw.trim();
if (!key || /\s/.test(key) || Buffer.byteLength(key) > 8192) {
@@ -103,7 +99,7 @@ async function promptEndpoint(signal: AbortSignal): Promise<CustomEndpoint> {
}
async function save(credentials: Credentials, signal: AbortSignal) {
- const directory = configDirectory();
+ const directory = storageDirectory("config");
signal.throwIfAborted();
await mkdir(directory, { recursive: true, mode: 0o700 });
await chmod(directory, 0o700);
@@ -178,7 +174,7 @@ export async function authenticate(options: AuthOptions, signal: AbortSignal) {
export async function loadCredentials(): Promise<Credentials> {
try {
const credentials = JSON.parse(
- await readFile(join(configDirectory(), "credentials.json"), "utf8"),
+ await readFile(join(storageDirectory("config"), "credentials.json"), "utf8"),
);
if (typeof credentials.apiKey !== "string" || !credentials.apiKey.trim()) {
throw new CliError("Invalid credentials. Run jg auth again.");
diff --git a/apps/cli/src/index.ts b/apps/cli/src/index.ts
index 07140c7..3ca6bf7 100644
--- a/apps/cli/src/index.ts
+++ b/apps/cli/src/index.ts
@@ -1,5 +1,5 @@
#!/usr/bin/env node
-import { authenticate, configDirectory, loadCredentials } from "./auth";
+import { authenticate, loadCredentials } from "./auth";
import { endpointFor } from "@repo/core/providers";
import { storageDirectory } from "@repo/core/storage";
import { help, parseCommand } from "./args";
@@ -32,10 +32,6 @@ async function write(text: string) {
});
}
-function cacheDirectory() {
- return storageDirectory("cache");
-}
-
async function main() {
const command = parseCommand(process.argv.slice(2));
switch (command.kind) {
@@ -50,7 +46,7 @@ async function main() {
return authenticate(command, controller.signal);
case "cache-clear": {
const { createEvaluationCache } = await import("@repo/core");
- const cache = createEvaluationCache({ directory: cacheDirectory() });
+ const cache = createEvaluationCache({ directory: storageDirectory("cache") });
await cache.clear();
if (cache.stats().issues.length)
throw new CliError("Could not completely clear the cache. Check its permissions.");
@@ -104,7 +100,6 @@ async function main() {
root: command.root,
policy: command.policy,
signal: controller.signal,
- protectedPaths: [configDirectory(), cacheDirectory()],
});
if (pipeClosed) return;
await write(renderInventory(result));
@@ -116,7 +111,7 @@ async function main() {
const credentials = await loadCredentials();
const { retrieve, createEvaluator, createEvaluationCache } = await import("@repo/core");
const cache = createEvaluationCache({
- directory: cacheDirectory(),
+ directory: storageDirectory("cache"),
enabled: !command.noCache,
});
const evaluator = createEvaluator({
@@ -133,7 +128,6 @@ async function main() {
query: command.query,
policy: command.policy,
signal: controller.signal,
- protectedPaths: [configDirectory(), cacheDirectory()],
},
evaluator,
);
diff --git a/scripts/RELEASING.md b/scripts/RELEASING.md
index bc79bd7..e12cca3 100644
--- a/scripts/RELEASING.md
+++ b/scripts/RELEASING.md
@@ -45,10 +45,15 @@ archive without Bun, use `node scripts/test-native.mjs --prebuilt /path/package.
The command prints the archive hash and actual Node/macOS runtime for retained
evidence. It requires Node 22 or newer; a result proves the printed version only.
+The [Windows workflow](../.github/workflows/windows.yml) builds and installs an npm
+tarball in a temporary prefix, then runs portable suites against that installed
+CLI. It checks profile storage, protected-path exclusions, and the Windows
+installer launcher on the supported Node versions. POSIX-only fixtures remain
+in the Docker suites.
+
Native installation uses temporary npm configuration, HOME, and XDG directories.
The installed process receives a PATH containing only Node, so host Python, Bun,
and compiler installations cannot satisfy runtime dependencies. All fixture
credentials are synthetic, and local commands must make no Gateway requests.
-This bounded smoke complements the Docker suites; filesystem-policy tests still
-run only in their isolated Docker environment. npm installation needs network
+This bounded smoke complements the Docker and Windows suites. npm installation needs network
access to resolve the exact runtime dependencies; search uses only loopback HTTP.
diff --git a/test/discovery.test.ts b/test/discovery.test.ts
index 667f823..0fc2745 100644
--- a/test/discovery.test.ts
+++ b/test/discovery.test.ts
@@ -4,7 +4,7 @@ import { expect } from "bun:test";
import { mkdtemp, mkdir, writeFile, rm, chmod } from "node:fs/promises";
import { join } from "node:path";
import { tmpdir } from "node:os";
-import { posix, testIfDocker, testIfDockerPosix } from "./helpers/docker";
+import { testIfDocker, testIfDockerPosix } from "./helpers/docker";
import { retrieve } from "../packages/core/src/retrieve";
import { createEvaluator, EvaluationFailure } from "../packages/core/src/evaluator";
import { renderResult } from "../apps/cli/src/render";
@@ -58,7 +58,7 @@ testIfDocker(
await rm(root, { recursive: true, force: true });
}
},
- 30_000,
+ 120_000,
);
for (const matchPath of ["match.ts", "group-0/match.ts"]) {
testIfDocker(
@@ -108,8 +108,8 @@ for (const matchPath of ["match.ts", "group-0/match.ts"]) {
await rm(root, { recursive: true, force: true });
}
},
- // This fixture creates and parses 1,800 files; Windows CI can exceed 30s.
- posix ? 30_000 : 120_000,
+ // Creating and parsing 1,800 files can exceed 30s on constrained runners.
+ 120_000,
);
}
testIfDocker("source confirmation reuses its judgments and preserves returned source", async () => {
@@ -205,7 +205,7 @@ testIfDocker(
await rm(root, { recursive: true, force: true });
}
},
- 30_000,
+ 120_000,
);
for (const outcome of ["strong", "preview", "interrupted"] as const)
@@ -291,7 +291,7 @@ for (const outcome of ["strong", "preview", "interrupted"] as const)
await rm(root, { recursive: true, force: true });
}
},
- 30_000,
+ 120_000,
);
testIfDocker("a small set of weak leads remains available", async () => {
@@ -349,7 +349,7 @@ testIfDocker(
await rm(root, { recursive: true, force: true });
}
},
- 30_000,
+ 120_000,
);
testIfDocker("shallow lookahead classifies file previews before admitting files", async () => {