@rucher/cli 0.2.0-beta.5 → 0.2.0-beta.6

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/cli.mjs +24 -10
  2. package/package.json +2 -2
package/dist/cli.mjs CHANGED
@@ -239,7 +239,7 @@ async function setupCompletion(main) {
239
239
  };
240
240
  }
241
241
  // package.json
242
- var version = "0.2.0-beta.5";
242
+ var version = "0.2.0-beta.6";
243
243
  // src/commands/hook.ts
244
244
  const host = claudeCode;
245
245
  function runHook(io, run, hookEventName) {
@@ -551,7 +551,7 @@ function notesList(carnet, io, options = {}) {
551
551
  const blocks = grouped(notes).map(([kind, kindNotes]) => `${colors.bold(KIND_TITLES[kind])}\n${kindNotes.map((note) => noteLine(io, note)).join("\n")}`);
552
552
  io.stdout(`${blocks.join("\n\n")}\n`);
553
553
  }
554
- function sessionLabel$1(carnet, id) {
554
+ function sessionLabel$2(carnet, id) {
555
555
  if (!id) return "-";
556
556
  return carnet.sessions.get(id)?.name ?? shortId(id);
557
557
  }
@@ -566,7 +566,7 @@ function notesShow(carnet, io, id) {
566
566
  `${colors.bold(`#${note.id}`)} ${note.kind}${note.droppedAt ? colors.dim(" (dropped)") : ""}`,
567
567
  note.text,
568
568
  `repos: ${note.repos.length ? note.repos.join(", ") : "general"}`,
569
- `added: ${when(note.createdAt)} in ${sessionLabel$1(carnet, note.session)}${note.agent ? `, from ${note.agent}` : ""}`,
569
+ `added: ${when(note.createdAt)} in ${sessionLabel$2(carnet, note.session)}${note.agent ? `, from ${note.agent}` : ""}`,
570
570
  `weight: ${note.weight.toFixed(2)} · ${note.citationCount} citation${note.citationCount === 1 ? "" : "s"}`
571
571
  ];
572
572
  if (note.similarNotes.length) lines.push(colors.yellow(`similar to: ${note.similarNotes.map((other) => `#${other}`).join(", ")}`));
@@ -578,7 +578,7 @@ function notesShow(carnet, io, id) {
578
578
  lines.push("citations:");
579
579
  for (const citation of note.citations) {
580
580
  const by = citation.agent ? ` ${citation.agent}` : "";
581
- lines.push(` ${when(citation.at)} ${sessionLabel$1(carnet, citation.session)}${by} ${citation.why}`);
581
+ lines.push(` ${when(citation.at)} ${sessionLabel$2(carnet, citation.session)}${by} ${citation.why}`);
582
582
  }
583
583
  }
584
584
  io.stdout(`${lines.join("\n")}\n`);
@@ -667,9 +667,12 @@ function prepareSession(carnet, session, env) {
667
667
  });
668
668
  return workspace;
669
669
  }
670
+ function sessionLabel$1(session) {
671
+ return session.name ?? session.id.slice(0, 8);
672
+ }
670
673
  function sessionDirectory(session) {
671
674
  if (session.cwd && existsSync(session.cwd)) return session.cwd;
672
- throw new CarnetError("SESSION_CWD_MISSING", `The directory of session ${session.name ?? session.id.slice(0, 8)} no longer exists: ${session.cwd ?? "none recorded"}`);
675
+ throw new CarnetError("SESSION_CWD_MISSING", `The directory of session ${sessionLabel$1(session)} no longer exists: ${session.cwd ?? "none recorded"}`);
673
676
  }
674
677
  function planResume(carnet, io, reference, passthrough = []) {
675
678
  const session = findSession(carnet, reference);
@@ -677,12 +680,19 @@ function planResume(carnet, io, reference, passthrough = []) {
677
680
  const workspace = prepareSession(carnet, session, io.env);
678
681
  const cwd = sessionDirectory(session);
679
682
  const prompt = appendPromptFile(workspace, session, io.env);
683
+ const host = hostById(session.host);
684
+ const options = {
685
+ appendPromptFile: prompt.path,
686
+ directories: repoDirectories(workspace),
687
+ passthrough
688
+ };
689
+ const fresh = !host.hasConversation(session, io.env);
690
+ if (fresh) io.stderr(`no conversation yet for ${sessionLabel$1(session)}: starting it\n`);
680
691
  return {
681
- ...hostById(session.host).resumeCommand(session, {
682
- appendPromptFile: prompt.path,
683
- directories: repoDirectories(workspace),
684
- passthrough
685
- }),
692
+ ...fresh ? host.launchCommand(session.id, {
693
+ name: session.name,
694
+ ...options
695
+ }) : host.resumeCommand(session, options),
686
696
  cwd,
687
697
  env: launchEnv(workspace, session, prompt.version),
688
698
  sessionId: session.id
@@ -692,6 +702,10 @@ function planFork(carnet, io, reference, options = {}) {
692
702
  if (options.active && !options.name) throw new CliError("An active fork needs a name", "rucher fork <session> <name> --active");
693
703
  if (options.name && carnet.sessions.byName(options.name)) throw new CliError(`A session named "${options.name}" already exists`);
694
704
  const parent = findSession(carnet, reference);
705
+ if (!hostById(parent.host).hasConversation(parent, io.env)) {
706
+ const label = sessionLabel$1(parent);
707
+ throw new CliError(`Session ${label} has no conversation yet, nothing to fork`, `rucher resume ${label}`);
708
+ }
695
709
  const workspace = prepareSession(carnet, parent, io.env);
696
710
  const cwd = sessionDirectory(parent);
697
711
  const kind = options.active ? "active" : "temp";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rucher/cli",
3
- "version": "0.2.0-beta.5",
3
+ "version": "0.2.0-beta.6",
4
4
  "description": "rucher: status, journal and sessions of your Claude Code sub-agents, from the terminal",
5
5
  "keywords": [
6
6
  "agents",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@bomb.sh/tab": "0.0.22",
38
- "@rucher/carnet": "0.2.0-beta.5",
38
+ "@rucher/carnet": "0.2.0-beta.6",
39
39
  "citty": "^0.2.2"
40
40
  },
41
41
  "devDependencies": {