@chrisdudek/yg 5.0.2 → 5.0.4

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.
Files changed (2) hide show
  1. package/dist/bin.js +25 -20
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -1018,10 +1018,24 @@ async function fetchOllamaModels(endpoint) {
1018
1018
  }
1019
1019
  }
1020
1020
 
1021
- // src/llm/reviewer-test.ts
1021
+ // src/utils/binary-check.ts
1022
1022
  import { execFile } from "child_process";
1023
1023
  import { promisify } from "util";
1024
1024
  var execFileAsync = promisify(execFile);
1025
+ async function binaryAvailable(binary) {
1026
+ try {
1027
+ await execFileAsync(binary, ["--version"], {
1028
+ timeout: 1e4,
1029
+ shell: process.platform === "win32"
1030
+ });
1031
+ return true;
1032
+ } catch (err) {
1033
+ debugWrite(`[binary-check] ${binary} --version: ${err.message}`);
1034
+ return false;
1035
+ }
1036
+ }
1037
+
1038
+ // src/llm/reviewer-test.ts
1025
1039
  var CLI_BINARIES = {
1026
1040
  "claude-code": "claude",
1027
1041
  "codex": "codex",
@@ -1053,14 +1067,10 @@ async function testCliProvider(provider) {
1053
1067
  if (!binary) {
1054
1068
  return { ok: false, error: `Unsupported CLI provider: ${provider}` };
1055
1069
  }
1056
- try {
1057
- await execFileAsync("which", [binary], { timeout: 5e3 });
1070
+ if (await binaryAvailable(binary)) {
1058
1071
  return { ok: true };
1059
- } catch (err) {
1060
- const msg = `'${binary}' not found on PATH`;
1061
- debugWrite(`[reviewer-test] testCliProvider(${provider}): ${err.message}`);
1062
- return { ok: false, error: msg };
1063
1072
  }
1073
+ return { ok: false, error: `'${binary}' could not be run \u2014 is it installed and on PATH?` };
1064
1074
  }
1065
1075
  async function testAnthropic(apiKey, model, endpoint) {
1066
1076
  const res = await fetch(`${endpoint}/messages`, {
@@ -8017,11 +8027,15 @@ function collectNodes(node, lines, depth, maxDepth) {
8017
8027
  import chalk6 from "chalk";
8018
8028
 
8019
8029
  // src/cli/exit-after-flush.ts
8030
+ var FORCE_EXIT_GRACE_MS = 2e3;
8020
8031
  async function exitAfterFlush(code) {
8021
8032
  if (process.stdout.writableLength > 0) {
8022
8033
  await new Promise((resolve6) => process.stdout.once("drain", resolve6));
8023
8034
  }
8024
- process.exit(code);
8035
+ process.exitCode = code;
8036
+ setTimeout(() => process.exit(code), FORCE_EXIT_GRACE_MS).unref();
8037
+ return new Promise(() => {
8038
+ });
8025
8039
  }
8026
8040
 
8027
8041
  // src/core/graph/impact-graph.ts
@@ -13224,10 +13238,7 @@ async function apiFetch(url, init2, providerName, timeoutMs = 6e4) {
13224
13238
 
13225
13239
  // src/llm/cli-base.ts
13226
13240
  import { spawn } from "child_process";
13227
- import { execFile as execFile2 } from "child_process";
13228
13241
  import { tmpdir } from "os";
13229
- import { promisify as promisify2 } from "util";
13230
- var execFileAsync2 = promisify2(execFile2);
13231
13242
  function coerceBool(v) {
13232
13243
  if (typeof v === "boolean") return v;
13233
13244
  if (typeof v === "string") {
@@ -13326,13 +13337,7 @@ var CliAgentProvider = class {
13326
13337
  this.timeout = config.timeout ?? 3e5;
13327
13338
  }
13328
13339
  async isAvailable() {
13329
- try {
13330
- await execFileAsync2("which", [this.binary], { timeout: 5e3 });
13331
- return true;
13332
- } catch (err) {
13333
- debugWrite(`[${this.binary}] isAvailable: ${err.message}`);
13334
- return false;
13335
- }
13340
+ return binaryAvailable(this.binary);
13336
13341
  }
13337
13342
  async verifyAspect(prompt) {
13338
13343
  const fallback = { satisfied: false, reason: "Reviewer unavailable", errorSource: "provider" };
@@ -16031,8 +16036,8 @@ import path51 from "path";
16031
16036
 
16032
16037
  // src/utils/git-introspect.ts
16033
16038
  import { exec } from "child_process";
16034
- import { promisify as promisify3 } from "util";
16035
- var execp = promisify3(exec);
16039
+ import { promisify as promisify2 } from "util";
16040
+ var execp = promisify2(exec);
16036
16041
  async function isMergeCommit(repoCwd, ref) {
16037
16042
  try {
16038
16043
  const { stdout } = await execp(`git rev-list --parents -n 1 ${ref}`, { cwd: repoCwd });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrisdudek/yg",
3
- "version": "5.0.2",
3
+ "version": "5.0.4",
4
4
  "description": "Architecture rules your AI coding agent can't ignore. It gets the rules for a file before it edits, and every change is checked — by a free local script or an LLM reviewer — before it moves on. Works with Claude Code, Cursor, Copilot, Codex, Cline.",
5
5
  "type": "module",
6
6
  "bin": {