claude-inbox 0.11.1 → 0.11.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4be74e826e16c816d3589869198467177926961e11d885d7c811e6218b67fd2f
4
- data.tar.gz: b09b5adfa01af2b64b00479faba7ce3c3312a8aec82916e1c0a003e7eec8f4ba
3
+ metadata.gz: 86190c0236a4084ec5b00e5044886f6a6b5ab8b51c8e81ac56d7ee9a78619753
4
+ data.tar.gz: 763db348bacbb927ec5c5fae6344a02d449ddbf8aeb7dc4460594168e523b5dd
5
5
  SHA512:
6
- metadata.gz: 93865715d77fe8092727f66c32da8e6cdbbac67068c2ead4af429f35d488d034834c188dc74905e42b0c4ecdea8470a3770d870251c8f229a532f3006cc463b0
7
- data.tar.gz: 5334bb968b0fc31caea4249abe7b838266a70e9513c2693baa68432bc20f6c8eef3f9ff2491a14af15caa168550a27fffc0d20a2879c953904029a526206f4e1
6
+ metadata.gz: 532e078a269b17bfafd4eb6bbe83893a8be012740bd7fbac7c4625f074c9ce40df5afb9475e0cfbdd09963200265e35dc4335ecfacadfe4a653a83f78033f369
7
+ data.tar.gz: 51632f06152f27dd1708304ecdc4f9eea0ff9dfba18d8ce302f44a8e7b1d260472d56abf80151d1d48f947faf7432ea2ed47133037c43b570972cc171a4b9e24
@@ -28,11 +28,11 @@ module ClaudeInbox
28
28
  # it we stay in the inbox and poll, so the new row shows up right away
29
29
  # rather than at the next tick.
30
30
  def start_session(form, attach:)
31
- v = form.values
31
+ v, note = SessionRequest.without_stray_worktree(form.values)
32
32
  notice("starting session…")
33
33
  in_background do
34
34
  id = @client.spawn(**v)
35
- @queue << [:notice, "started #{id}"]
35
+ @queue << [:notice, ["started #{id}", note].compact.join(" — ")]
36
36
  @queue << [:form_started, form]
37
37
  @queue << [:select, id]
38
38
  attach ? @queue << [:attach, id] : @poller.soon
@@ -53,8 +53,8 @@ module ClaudeInbox
53
53
 
54
54
  # Someone at the desk may be mid-thought, so a start from another
55
55
  # device never moves the cursor, attaches or closes what is open.
56
- def remote_started(id, via)
57
- notice("started #{id} from #{via}")
56
+ def remote_started(id, via, note = nil)
57
+ notice(["started #{id} from #{via}", note].compact.join(" — "))
58
58
  @poller.soon
59
59
  end
60
60
  end
@@ -140,6 +140,7 @@ code { font: 15px ui-monospace, SFMono-Regular, Menlo, monospace; }
140
140
  <section id="done" class="card" hidden>
141
141
  <p>Started <code id="done-id"></code></p>
142
142
  <p class="muted" id="done-where"></p>
143
+ <p class="muted" id="done-note" hidden></p>
143
144
  <p class="muted" id="done-later">claude.ai/code lists it once it has registered, in a moment.</p>
144
145
  <div class="actions">
145
146
  <a class="button" id="done-url" target="_blank" rel="noopener">Open in Claude</a>
@@ -421,6 +422,8 @@ function started(session, remote) {
421
422
  $("name").value = "";
422
423
  $("done-id").textContent = session.id;
423
424
  $("done-where").textContent = [session.name, session.cwd].filter(Boolean).join(" · ");
425
+ $("done-note").textContent = session.note || "";
426
+ $("done-note").hidden = !session.note;
424
427
  const link = $("done-url");
425
428
  link.hidden = !/^https:\/\//.test(session.url || "");
426
429
  if (!link.hidden) link.href = session.url;
@@ -156,11 +156,12 @@ module ClaudeInbox
156
156
  values[:permission_mode] = capped_mode(values[:permission_mode] || defaults.permission_mode || builtin_mode)
157
157
  paths = images.each_with_index.map { |bytes, i| Images.save(bytes, dir: @images_dir, index: i + 1) }
158
158
  values[:prompt] = SessionRequest.attach(values[:prompt], paths)
159
+ values, note = SessionRequest.without_stray_worktree(values)
159
160
  @queue << [:notice, "remote: starting session…"]
160
161
  id = Http.utf8(@spawn_lock.synchronize { @client.spawn(**values) })
161
162
  url = remote_url(id, wait: values[:remote] ? @bridge_wait : 0)
162
- @queue << [:remote_started, id, via]
163
- {id: id, name: values[:name], cwd: values[:cwd], url: url}
163
+ @queue << [:remote_started, id, via, note].compact
164
+ {id: id, name: values[:name], cwd: values[:cwd], url: url}.merge(note ? {note: note} : {})
164
165
  rescue SessionRequest::Invalid => e
165
166
  raise Http::Error.new(422, e.message, field: e.field)
166
167
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "pathname"
3
4
  require_relative "agents_client"
4
5
 
5
6
  module ClaudeInbox
@@ -77,6 +78,20 @@ module ClaudeInbox
77
78
  [text, rest.join("\n")].reject(&:empty?).join("\n\n")
78
79
  end
79
80
 
81
+ # `claude --bg --worktree` outside a git repository dies before init
82
+ # (docs/cli-quirks.md). A folder above several repos is a fair place to
83
+ # start from, so there the session starts without a worktree and the
84
+ # note says so.
85
+ def self.without_stray_worktree(values)
86
+ return [values, nil] unless values[:worktree] && !inside_repo?(values[:cwd])
87
+ [values.merge(worktree: false), "not in a git repo, so no worktree"]
88
+ end
89
+
90
+ # A worktree or a submodule has a `.git` file rather than a folder.
91
+ def self.inside_repo?(dir)
92
+ Pathname(File.expand_path(dir)).ascend.any? { |d| (d + ".git").exist? }
93
+ end
94
+
80
95
  # A session's cwd may sit inside a worktree another agent is using;
81
96
  # carrying that into a new prompt would spawn the new agent there too,
82
97
  # writing over the same files. Fall back to the repo it was cut from.
data/lib/claude_inbox.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClaudeInbox
4
- VERSION = "0.11.1"
4
+ VERSION = "0.11.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claude-inbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Byron