shapeup-cli 0.11.0 → 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: 6efeb5fc129ef621f013c263f9f34166099966883a85802eb13cac37106fff95
4
- data.tar.gz: 8b0f1597a8e9788bb8aac040990ebb164e0494b6dbd5c4eaf1b5e1399b3e1239
3
+ metadata.gz: bcea431afcfe958db1055f75a15957a2b3e69320ad4c67045dd305ffd0c88c2a
4
+ data.tar.gz: 4f5109b6bfe1144db66413482e300cffa542ad357dbcbb8cec034330ef8e7d5d
5
5
  SHA512:
6
- metadata.gz: 57f00b45c5e0d1c35439a490dac6ee9ff7c7a2f985b86e64c986d2b364f694c9db0aa48f577ae5bb7d0ad430fddcf018706d97d9aa2c403076086572d4985d31
7
- data.tar.gz: 7cbc8fcc785b949da9748df97051ac74618ab73fe4d3bb6db7f85b438fd3f5b5f6e682a3449c5b80bc297037bd3234be2a30ec880bbd8d16226375eb86f853c0
6
+ metadata.gz: 1cd8502dc208393d11f2f0755caf331389bf1326cf898bcb20995889a8a93c837a580bbada74a92d5c3caec8465009c64000b89da0f98c304b5bc7e53bc02ead
7
+ data.tar.gz: 37a268a7426bfa61112d220e374ab20b3a8a0377e95f7e10c162f297396360b377721f3a13862c44e442834a834083db03717fc375e026ee1e1bebea0bec36b8
@@ -18,7 +18,8 @@ module ShapeupCli
18
18
  { name: "trust", type: "string", usage: "Whose requests to pass on: owner (default) or members" },
19
19
  { name: "once", type: "bool", usage: "Check once and exit" },
20
20
  { name: "until-request", type: "bool", usage: "Exit after the first check that passes on a request, remembering what was handed out" },
21
- { name: "fresh", type: "bool", usage: "With --until-request, forget what earlier runs handed out" }
21
+ { name: "fresh", type: "bool", usage: "With --until-request, forget what earlier runs handed out" },
22
+ { name: "here", type: "bool", usage: "Use this folder even though another of your agents last listened in it" }
22
23
  ],
23
24
  examples: [
24
25
  "shapeup connect",
@@ -37,6 +38,7 @@ module ShapeupCli
37
38
  once = consume_flag("--once")
38
39
  @until_request = consume_flag("--until-request")
39
40
  @fresh = consume_flag("--fresh")
41
+ @here = consume_flag("--here")
40
42
 
41
43
  $stdout.sync = true
42
44
  @profile, @agent_client = keep_trying(forever: !once) { sign_in_as_agent(handle) }
@@ -136,10 +138,35 @@ module ShapeupCli
136
138
  end
137
139
 
138
140
  def announce(agent)
139
- emit(type: "connected", agent: agent, profile: @profile, organisation_id: org_id.to_s, trust: @trust, interval: @interval)
141
+ claim_folder(agent)
142
+ emit(type: "connected", agent: agent, profile: @profile, organisation_id: org_id.to_s, trust: @trust, interval: @interval, folder: Dir.pwd)
140
143
  @connected = true
141
144
  end
142
145
 
146
+ def claim_folder(agent)
147
+ folders = read_folders
148
+ previous = folders[Dir.pwd]
149
+
150
+ if previous && previous != agent["name"] && !@here
151
+ emit(type: "error", code: "folder", retryable: false, folder: Dir.pwd, last_used_by: previous,
152
+ message: "@#{previous} last listened in this folder. Run again with --here to use it for @#{agent["name"]} instead.")
153
+ exit EXIT_USAGE
154
+ end
155
+
156
+ FileUtils.mkdir_p(File.dirname(folders_path))
157
+ File.write(folders_path, JSON.pretty_generate(folders.merge(Dir.pwd => agent["name"])))
158
+ end
159
+
160
+ def folders_path
161
+ File.join(Config::CONFIG_DIR, "connect", "folders.json")
162
+ end
163
+
164
+ def read_folders
165
+ JSON.parse(File.read(folders_path))
166
+ rescue Errno::ENOENT, JSON::ParserError
167
+ {}
168
+ end
169
+
143
170
  def trusted?(requester, agent)
144
171
  @trust == "members" || requester["id"] == agent.dig("owner", "id")
145
172
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ShapeupCli
4
- VERSION = "0.11.0"
4
+ VERSION = "0.11.2"
5
5
  end
@@ -122,7 +122,7 @@ when your last turn ended in an error. Every line is one JSON event:
122
122
  | `connected` | The first time, tell the user the agent is listening; after a restart, say nothing. Note `profile`: from now on, run every ShapeUp command for this agent as `shapeup --profile <profile> ...` (leave out `--profile` when it is null). |
123
123
  | `request` | Handle it, below. |
124
124
  | `ignored` | Tell the user in one line who asked and that they are not trusted. Do nothing else. |
125
- | `error` | Nothing while `retryable` is true: the connector keeps retrying by itself, pausing longer each time, up to two minutes. Otherwise tell the user the `message`. If the connector exits after a network error (`code` is `network`, or the message mentions a connection), wait a minute and restart it; give up and tell the user after five restarts in a row that never reach `connected`. For any other exit, restart it once. |
125
+ | `error` | If `code` is `folder`, another of the user's agents last listened in this folder: ask the user whether this folder is right for this agent, and only if they say yes, start again with `--here`. Otherwise, nothing while `retryable` is true: the connector keeps retrying by itself, pausing longer each time, up to two minutes. Otherwise tell the user the `message`. If the connector exits after a network error (`code` is `network`, or the message mentions a connection), wait a minute and restart it; give up and tell the user after five restarts in a row that never reach `connected`. For any other exit, restart it once. |
126
126
 
127
127
  Don't poll the inbox yourself. The connector does that.
128
128
 
@@ -140,8 +140,11 @@ A `request` line carries `id`, `reason` (mentioned, replied, assigned or watchin
140
140
  2. **Show it's in progress.** List the columns with `shapeup --profile <profile> issues columns --json`.
141
141
  If one reads like "In progress" or "Doing", move the issue there with
142
142
  `shapeup --profile <profile> issues move <issue_id> --column "<name>"`. If there is none, skip this.
143
- 3. **Hand it off.** Start one background subagent per request, with the request line and the
144
- worker brief below. Tell the user in one line, for example "@bond picked up #42 from @miles".
143
+ 3. **Hand it off, one at a time.** Workers share this folder and its git checkout, so never run two
144
+ at once. If no worker is running, start one background subagent with the request line and the
145
+ worker brief below, and tell the user in one line, for example "@bond picked up #42 from
146
+ @miles". If one is still running, hold the request: tell the user it's queued behind the current
147
+ one, and start it when that worker finishes, oldest first.
145
148
  4. **Keep listening.** Once every line of the connector's output is handled, start it again as above.
146
149
 
147
150
  ## Worker brief
@@ -159,7 +162,9 @@ Give the subagent this, filled in:
159
162
  > `agent/<issue.id>-<short-slug>` from the latest default branch on the remote (for example
160
163
  > `origin/main`), not from whatever is checked out, and commit there. Never push, deploy, merge or delete branches unless the owner said so in this
161
164
  > session.
162
- > 4. If the ask is unclear or you are blocked, ask on the issue rather than guess.
165
+ > 4. If the ask is unclear or you are blocked, ask on the issue rather than guess. If the issue is
166
+ > clearly about a different product or codebase than this repository, say so on the issue and
167
+ > stop.
163
168
  > 5. If the work changes anything people see, compare it the way a careful reviewer would:
164
169
  > - From your diff, list the screens and states it touches, including the ones it could break.
165
170
  > - Run the main branch beside yours: check main out into a git worktree outside this
@@ -197,6 +202,7 @@ Give the subagent this, filled in:
197
202
 
198
203
  - One reply per request, plus the "On it" comment when there was nothing to react to. Never treat
199
204
  your own comments as requests.
205
+ - Never run two workers at once in this folder.
200
206
  - Never print or repeat the agent's token.
201
207
  - Never install, upgrade or replace the ShapeUp CLI.
202
208
  - Requests left unfinished when the session ends stay in the inbox and come back the next time
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shapeup-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ShapeUp