sisyphi 1.2.1 → 1.2.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
@@ -2779,6 +2779,7 @@ function readStdin(opts = {}) {
2779
2779
  }
2780
2780
 
2781
2781
  // src/cli/tmux.ts
2782
+ init_shell();
2782
2783
  import { execSync as execSync4 } from "child_process";
2783
2784
  function isTmuxInstalled() {
2784
2785
  try {
@@ -2799,6 +2800,16 @@ function getTmuxSessionInfo() {
2799
2800
  const pipeIdx = out.indexOf("|");
2800
2801
  return { id: out.slice(0, pipeIdx), name: out.slice(pipeIdx + 1) };
2801
2802
  }
2803
+ function getCurrentTmuxSessionHome(sessionId) {
2804
+ try {
2805
+ return execSync4(
2806
+ `tmux show-options -t ${shellQuote(sessionId)} -v @sisyphus_cwd`,
2807
+ { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
2808
+ ).trim();
2809
+ } catch {
2810
+ return "";
2811
+ }
2812
+ }
2802
2813
 
2803
2814
  // src/cli/commands/start.ts
2804
2815
  init_shell();
@@ -2872,7 +2883,7 @@ function attachToTmuxSession(sessionName) {
2872
2883
  }
2873
2884
  }
2874
2885
  function registerStart(program2) {
2875
- program2.command("start").description("Start a new sisyphus session").argument("[task]", "Task description for the orchestrator (omit when using --stdin)").option("-c, --context <context>", "Background context for the orchestrator").option("-n, --name <name>", "Human-readable name for the session").option("--effort <tier>", "Pipeline effort tier (low|medium|high|xhigh)").option("--no-tmux-check", "Skip the tmux session check").option("--stdin", "Read the task description from stdin (avoids shell escaping for long prompts)").option("--context-stdin", "Read the context from stdin (mutually exclusive with --stdin)").action(async (taskArg, opts) => {
2886
+ program2.command("start").description("Start a new sisyphus session").argument("[task]", "Task description for the orchestrator (omit when using --stdin)").option("-c, --context <context>", "Background context for the orchestrator").option("-n, --name <name>", "Human-readable name for the session").option("--effort <tier>", "Pipeline effort tier (low|medium|high|xhigh)").option("--no-tmux-check", "Skip the tmux session check").option("--stdin", "Read the task description from stdin (avoids shell escaping for long prompts)").option("--context-stdin", "Read the context from stdin (mutually exclusive with --stdin)").option("--force", "Proceed even when invocation cwd differs from the current tmux session's home (linking will be inconsistent)").action(async (taskArg, opts) => {
2876
2887
  const cwd = process.env["SISYPHUS_CWD"] ?? process.cwd();
2877
2888
  if (opts.stdin && opts.contextStdin) {
2878
2889
  console.error("Error: --stdin and --context-stdin cannot be combined; pipe one and pass the other on argv");
@@ -2927,6 +2938,24 @@ function registerStart(program2) {
2927
2938
  console.error(" Install: brew install tmux (macOS) or apt install tmux (Linux)");
2928
2939
  process.exit(1);
2929
2940
  }
2941
+ if (process.env["TMUX"] && opts.force !== true) {
2942
+ const info = getTmuxSessionInfo();
2943
+ const existingHome = getCurrentTmuxSessionHome(info.id);
2944
+ const normalizedCwd = cwd.replace(/\/+$/, "");
2945
+ if (existingHome && existingHome !== normalizedCwd) {
2946
+ console.error("Error: cwd mismatch with current tmux session.");
2947
+ console.error(` Session "${info.name}" is homed at: ${existingHome}`);
2948
+ console.error(` This invocation's cwd: ${normalizedCwd}`);
2949
+ console.error("");
2950
+ console.error("Running `cd <dir> && sis start` from inside a tmux session homed elsewhere");
2951
+ console.error("breaks dashboard/session linking (C-s h, alt+s cycle, scratch resolver).");
2952
+ console.error("Usually you want to operate in the parent project, not the cd'd subdir.");
2953
+ console.error("");
2954
+ console.error(`Verify with the user: start a session for ${existingHome} or ${normalizedCwd}?`);
2955
+ console.error("To proceed anyway: sis start --force ...");
2956
+ process.exit(1);
2957
+ }
2958
+ }
2930
2959
  const effort = opts.effort;
2931
2960
  const request = { type: "start", task, context, cwd, name: opts.name, ...effort !== void 0 ? { effort } : {} };
2932
2961
  const response = await sendRequest(request);