@neriros/ralphy 2.4.0 → 2.4.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/index.js CHANGED
@@ -50818,10 +50818,29 @@ function TaskLoop({ opts }) {
50818
50818
  import { join as join9 } from "path";
50819
50819
  import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, readdirSync as readdirSync2, existsSync as existsSync4 } from "fs";
50820
50820
  import { spawnSync } from "child_process";
50821
+ var runnerCache = null;
50822
+ function resolveRunner() {
50823
+ if (runnerCache)
50824
+ return runnerCache;
50825
+ for (const candidate of ["bunx", "npx"]) {
50826
+ const probe = spawnSync(candidate, ["--version"], { encoding: "utf-8" });
50827
+ if (!probe.error) {
50828
+ runnerCache = candidate;
50829
+ return candidate;
50830
+ }
50831
+ }
50832
+ throw new Error("ralph requires `bunx` or `npx` on PATH to run `openspec`. Install bun (https://bun.sh/) or Node.js and re-run.");
50833
+ }
50834
+ function runBunx(args, options = {}) {
50835
+ const runner = resolveRunner();
50836
+ return spawnSync(runner, args, { ...options, encoding: "utf-8" });
50837
+ }
50821
50838
 
50822
50839
  class OpenSpecChangeStore {
50823
50840
  createChange(name, description) {
50824
- const result2 = spawnSync("bunx", ["openspec", "new", "change", name, "--description", description], { stdio: "inherit", encoding: "utf-8" });
50841
+ const result2 = runBunx(["openspec", "new", "change", name, "--description", description], {
50842
+ stdio: "inherit"
50843
+ });
50825
50844
  if (result2.status !== 0) {
50826
50845
  throw new Error(`openspec new change failed with exit code ${result2.status ?? "unknown"}`);
50827
50846
  }
@@ -50831,7 +50850,7 @@ class OpenSpecChangeStore {
50831
50850
  return join9("openspec", "changes", name);
50832
50851
  }
50833
50852
  listChanges() {
50834
- const result2 = spawnSync("bunx", ["openspec", "list", "--json"], { encoding: "utf-8" });
50853
+ const result2 = runBunx(["openspec", "list", "--json"]);
50835
50854
  if (result2.stdout) {
50836
50855
  try {
50837
50856
  const parsed = JSON.parse(result2.stdout);
@@ -50887,9 +50906,7 @@ ${existing.trimStart()}` : `${message}
50887
50906
  return Promise.resolve(sectionContent.trim());
50888
50907
  }
50889
50908
  validateChange(name) {
50890
- const result2 = spawnSync("bunx", ["openspec", "validate", name, "--json", "--no-interactive"], {
50891
- encoding: "utf-8"
50892
- });
50909
+ const result2 = runBunx(["openspec", "validate", name, "--json", "--no-interactive"]);
50893
50910
  if (result2.stdout) {
50894
50911
  try {
50895
50912
  const parsed = JSON.parse(result2.stdout);