superthread 0.8.0 → 0.8.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: eb38a8ab1c8ba081e66e8bda3bc4fabcb8aa9732e1e8cfc5ce1bdff0b14f94b2
4
- data.tar.gz: e97e7bffe8dc9bfbd86b424a6762455d1d9979b07a60651b3997ad5feaedddf5
3
+ metadata.gz: 05edf5da03e7cda08cca6e16f9813bb8f464b7847f3717a669eeb69802a67208
4
+ data.tar.gz: bdb2593ece548e526dfd602ca061e40541d09a062b633919133bf5ab6cc672c7
5
5
  SHA512:
6
- metadata.gz: b2c5dfabc604f08c7aae0eedb7a94fb8f702912c5ccc2730c9d388d6f404dbdff8aa9f3fa835288732612f84d7755e4a2a5283f1d266747b3e9727aa09fdbe5f
7
- data.tar.gz: 847b4c2868387c94b08bbbffab9db1d80dac9b4991884941258eb801347996f11257cdc1079d192848ae5208936352da2b894f95a1288914403279395b50cf61
6
+ metadata.gz: 7800b583a4a5b07062e460c1b053e593b3c344037d0a6dbf84e576097be4dfdb67594d61f021eaf46aa1bf9ec6b16b93ce5c9c31633331dfa5ef13b1742e82f6
7
+ data.tar.gz: 0d547f6b5c884715da432f8fdfa68593435f85c20cd06786c0f6594f33381ee661f30058c86912595124d3b113fd91978861146e578c3bf8513213d5cd33e269
@@ -173,7 +173,7 @@ module Superthread
173
173
  option :board, type: :string, aliases: "-b", desc: "Board (ID or name, required unless --sprint)"
174
174
  option :space, type: :string, aliases: "-s", desc: "Space (required for --sprint, helps resolve board name)"
175
175
  option :sprint, type: :string, desc: "Sprint (ID or name, required unless --board)"
176
- option :content, type: :string, desc: "Card content (HTML)"
176
+ option :content, type: :string, desc: "Card content (HTML). Use {{@Name}} to mention users"
177
177
  option :project, type: :string, desc: "Project ID"
178
178
  option :start_date, type: :numeric, desc: "Start date (Unix timestamp)"
179
179
  option :due_date, type: :numeric, desc: "Due date (Unix timestamp)"
@@ -116,7 +116,7 @@ module Superthread
116
116
 
117
117
  desc "add-item CHECKLIST", "Add item to a checklist"
118
118
  option :card, type: :string, required: true, aliases: "-c", desc: "Parent card ID"
119
- option :title, type: :string, required: true, desc: "Item title"
119
+ option :title, type: :string, required: true, desc: "Item title. Use {{@Name}} to mention users"
120
120
  option :checked, type: :boolean, default: false, desc: "Create as checked"
121
121
  # Add a new item to an existing checklist.
122
122
  #
@@ -139,7 +139,7 @@ module Superthread
139
139
  desc "update-item ITEM_ID", "Update a checklist item"
140
140
  option :card, type: :string, required: true, aliases: "-c", desc: "Parent card ID"
141
141
  option :checklist, type: :string, required: true, desc: "Parent checklist ID"
142
- option :title, type: :string, desc: "New item title"
142
+ option :title, type: :string, desc: "New item title. Use {{@Name}} to mention users"
143
143
  option :checked, type: :boolean, desc: "Mark as checked/unchecked"
144
144
  # Update the title or checked state of a checklist item.
145
145
  #
@@ -32,6 +32,8 @@ module Superthread
32
32
  PLACEHOLDER_PATTERN = /___ESCAPED_MENTION_(.+?)___END___/
33
33
  # @return [Regexp] pattern matching raw HTML mention tags that should use {{@Name}} syntax
34
34
  HTML_MENTION_PATTERN = /<(?:user-mention|mention-user)\b/i
35
+ # @return [Regexp] pattern matching plain @Word that is not inside {{@...}} delimiters
36
+ PLAIN_MENTION_PATTERN = /(?<!\{\{)@(\w+)/
35
37
 
36
38
  # @param client [Superthread::Client] the API client for fetching members
37
39
  # @param workspace_id [String] the workspace to look up members in
@@ -46,6 +48,7 @@ module Superthread
46
48
  # @return [String, nil] content with mentions converted to HTML tags
47
49
  def format(content)
48
50
  warn_html_mentions(content) if content
51
+ warn_plain_mentions(content) if content
49
52
  return content if content.nil? || !content.include?("{{@")
50
53
 
51
54
  member_map = build_member_map
@@ -99,6 +102,36 @@ module Superthread
99
102
  "(e.g., '{{@Steve Clarke}} check this')."
100
103
  end
101
104
 
105
+ # Warns when content contains plain @Name mentions that match workspace members.
106
+ # This catches the common mistake of using @Name instead of {{@Name}}.
107
+ #
108
+ # @param content [String] text to check for plain @mentions
109
+ # @return [void]
110
+ def warn_plain_mentions(content)
111
+ return if content.include?("{{@")
112
+
113
+ names = content.scan(PLAIN_MENTION_PATTERN).flatten
114
+ return if names.empty?
115
+
116
+ member_map = build_member_map
117
+ return if member_map.nil?
118
+
119
+ # Also index by first name for multi-word display names
120
+ first_name_map = {}
121
+ member_map.each_value do |info|
122
+ first = info[:name].split.first&.downcase
123
+ first_name_map[first] = info[:name] if first
124
+ end
125
+
126
+ names.each do |name|
127
+ match = member_map[name.downcase]&.fetch(:name) || first_name_map[name.downcase]
128
+ if match
129
+ warn "Warning: Found @#{name} — did you mean {{@#{match}}}? " \
130
+ "Use {{@Name}} syntax to mention users and trigger notifications."
131
+ end
132
+ end
133
+ end
134
+
102
135
  # Fetches workspace members and builds a case-insensitive lookup map.
103
136
  #
104
137
  # @return [Hash{String => Hash}, nil] map of lowercase names to {id:, name:}, or nil on failure
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Superthread
4
4
  # Current version of the Superthread gem.
5
- VERSION = "0.8.0"
5
+ VERSION = "0.8.1"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superthread
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Clarke