shapeup-cli 0.11.0 → 0.11.1

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: aaa4bfac80b5b904dc087542495c2b208af118e757c186154decdc5f10a27202
4
+ data.tar.gz: 5807b66ff822944751b0261953465424413dec6d3017141502fc46c8090ef0ba
5
5
  SHA512:
6
- metadata.gz: 57f00b45c5e0d1c35439a490dac6ee9ff7c7a2f985b86e64c986d2b364f694c9db0aa48f577ae5bb7d0ad430fddcf018706d97d9aa2c403076086572d4985d31
7
- data.tar.gz: 7cbc8fcc785b949da9748df97051ac74618ab73fe4d3bb6db7f85b438fd3f5b5f6e682a3449c5b80bc297037bd3234be2a30ec880bbd8d16226375eb86f853c0
6
+ metadata.gz: 0cbb7d0347602e616ad0212a2e802df002b8e79e9c9732055b00a2c734a6f3b3ee7b9624ea6ff77cf7d1effaeeaf17473d33701532ef8b7c34446e2b11130c31
7
+ data.tar.gz: 1efa2c97485f0c93b655be01e04f5f2be20ba828f2bb735a33e12b93ce8074dafc94d6eddb78a2571327975da25d639437b8869394a41fae36de4249946c472c
@@ -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.1"
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
 
@@ -159,7 +159,9 @@ Give the subagent this, filled in:
159
159
  > `agent/<issue.id>-<short-slug>` from the latest default branch on the remote (for example
160
160
  > `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
161
  > session.
162
- > 4. If the ask is unclear or you are blocked, ask on the issue rather than guess.
162
+ > 4. If the ask is unclear or you are blocked, ask on the issue rather than guess. If the issue is
163
+ > clearly about a different product or codebase than this repository, say so on the issue and
164
+ > stop.
163
165
  > 5. If the work changes anything people see, compare it the way a careful reviewer would:
164
166
  > - From your diff, list the screens and states it touches, including the ones it could break.
165
167
  > - Run the main branch beside yours: check main out into a git worktree outside this
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ShapeUp