whipped 0.1.0 → 0.1.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.
package/dist/cli.js CHANGED
@@ -8991,7 +8991,6 @@ var require_tree_kill = __commonJS({
8991
8991
  });
8992
8992
 
8993
8993
  // src/cli.ts
8994
- import { spawnSync as spawnSync11 } from "node:child_process";
8995
8994
  import { createServer as createServer2 } from "node:net";
8996
8995
 
8997
8996
  // node_modules/.pnpm/commander@14.0.3/node_modules/commander/esm.mjs
@@ -18967,6 +18966,7 @@ function isCommandAvailable(args) {
18967
18966
  stdio: ["ignore", "pipe", "ignore"],
18968
18967
  timeout: 5e3
18969
18968
  });
18969
+ if (result.error) return result.error.code !== "ENOENT";
18970
18970
  return result.status === 0 || result.status === null;
18971
18971
  }
18972
18972
  function getAvailableAgents() {
@@ -26832,8 +26832,8 @@ import { z as z9 } from "zod";
26832
26832
  // src/api/services/projects-service.ts
26833
26833
  init_runtime_config();
26834
26834
  init_api_contract();
26835
- init_logger();
26836
26835
  import { spawnSync as spawnSync9 } from "node:child_process";
26836
+ init_logger();
26837
26837
 
26838
26838
  // src/state/projects-layout.ts
26839
26839
  init_db();
@@ -26889,14 +26889,31 @@ var saveProjectsLayoutData = (layout) => {
26889
26889
  return { ok: true };
26890
26890
  };
26891
26891
  var checkProjectPath = async (repoPath) => {
26892
- if (!repoPath.trim()) return { valid: false, isGitRepo: false, error: null, name: null, branch: null, remote: null };
26892
+ if (!repoPath.trim())
26893
+ return { valid: false, isGitRepo: false, error: null, name: null, branch: null, remote: null, branches: [] };
26893
26894
  const { statSync: statSync2 } = await import("node:fs");
26894
26895
  try {
26895
26896
  const stat2 = statSync2(repoPath);
26896
26897
  if (!stat2.isDirectory())
26897
- return { valid: false, isGitRepo: false, error: "Not a directory", name: null, branch: null, remote: null };
26898
+ return {
26899
+ valid: false,
26900
+ isGitRepo: false,
26901
+ error: "Not a directory",
26902
+ name: null,
26903
+ branch: null,
26904
+ remote: null,
26905
+ branches: []
26906
+ };
26898
26907
  } catch {
26899
- return { valid: false, isGitRepo: false, error: "Path does not exist", name: null, branch: null, remote: null };
26908
+ return {
26909
+ valid: false,
26910
+ isGitRepo: false,
26911
+ error: "Path does not exist",
26912
+ name: null,
26913
+ branch: null,
26914
+ remote: null,
26915
+ branches: []
26916
+ };
26900
26917
  }
26901
26918
  const r = spawnSync9("git", ["rev-parse", "--git-dir"], {
26902
26919
  cwd: repoPath,
@@ -26911,7 +26928,8 @@ var checkProjectPath = async (repoPath) => {
26911
26928
  error: "Not a git repository",
26912
26929
  name: null,
26913
26930
  branch: null,
26914
- remote: null
26931
+ remote: null,
26932
+ branches: []
26915
26933
  };
26916
26934
  const branchR = spawnSync9("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
26917
26935
  cwd: repoPath,
@@ -26927,7 +26945,7 @@ var checkProjectPath = async (repoPath) => {
26927
26945
  const branch = branchR.status === 0 ? branchR.stdout.trim() : null;
26928
26946
  const rawRemote = remoteR.status === 0 ? remoteR.stdout.trim() : null;
26929
26947
  const remote = rawRemote ? rawRemote.replace(/^https?:\/\//, "").replace(/^git@([^:]+):/, "$1/").replace(/\.git$/, "") : null;
26930
- return { valid: true, isGitRepo: true, error: null, name, branch, remote };
26948
+ return { valid: true, isGitRepo: true, error: null, name, branch, remote, branches: listLocalBranches(repoPath) };
26931
26949
  };
26932
26950
  var addProject = async (repoPath, initialConfig) => {
26933
26951
  const { statSync: statSync2 } = await import("node:fs");
@@ -28546,15 +28564,7 @@ process.on("uncaughtException", (err) => {
28546
28564
  if (err.code === "EPIPE" || err.code === "ECONNRESET") return;
28547
28565
  throw err;
28548
28566
  });
28549
- var VERSION9 = true ? "0.1.0" : "0.0.0-dev";
28550
- function hasGitRepository(path2) {
28551
- const result = spawnSync11("git", ["rev-parse", "--is-inside-work-tree"], {
28552
- cwd: path2,
28553
- encoding: "utf8",
28554
- stdio: ["ignore", "pipe", "ignore"]
28555
- });
28556
- return result.status === 0 && result.stdout.trim() === "true";
28557
- }
28567
+ var VERSION9 = true ? "0.1.2" : "0.0.0-dev";
28558
28568
  async function isPortAvailable(port, host) {
28559
28569
  return new Promise((resolve5) => {
28560
28570
  const probe = createServer2();
@@ -28565,10 +28575,6 @@ async function isPortAvailable(port, host) {
28565
28575
  async function runServerForeground(options) {
28566
28576
  const { port, host } = options;
28567
28577
  const repoPath = process.cwd();
28568
- if (!hasGitRepository(repoPath)) {
28569
- logger.error("Error: whipped must be run inside a git repository.");
28570
- process.exit(1);
28571
- }
28572
28578
  const portAvailable = await isPortAvailable(port, host);
28573
28579
  if (!portAvailable) {
28574
28580
  logger.error(`Error: port ${port} is already in use. Use --port to specify a different port.`);