superthread 0.7.3 → 0.7.4

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: 4cf0f4679210af65b63f13141b5c432b8fa2999468842808a58ba2c71d15b7f1
4
- data.tar.gz: 922afee485ffb459bb189fcedb92af8649e8422d52baf3230d19c47288cd63bf
3
+ metadata.gz: 4ff6a32a6f48d0010c39659ee7fca19ff5d136ad8ffdb236a9e44e32108b65c2
4
+ data.tar.gz: d22ea63399a42dbbb6f79e02ccbb5983ac732c981bfa38af16756a775c037185
5
5
  SHA512:
6
- metadata.gz: c0e8b5023fd60313bcd7b82cbb650ef3520f11befe1bbef9bf7427feed115003ed3afe287d63c48d5939177a3d689850f9398a3bbf9cb534ac00b021db68f7b7
7
- data.tar.gz: b9ceb55ed32d01d2f7010ff234427fbe527f54c749c27f1dc3b03bb17c24d6aed15c82cb010c6a848831c4d0977e232602c3a7c23950cbb8a201a24ab7318897
6
+ metadata.gz: da133f0ba26e4f5b4b16cac769408133f4cf143965948efb5d933d3cecf32ea478891fc9a1fa93dc590b80acc1be46d30aa3611e6d951c9c636abb5a566a59e2
7
+ data.tar.gz: c3dfc65b6e9927a9112a33194258c73b239a3238e3446dcba9b929a5b15281d06398d26c86b27dc714a9a9378ff0455280295d33154a4f119628a6a04dfa1208
data/README.md CHANGED
@@ -328,6 +328,16 @@ Common options have short forms:
328
328
  > - Use `me` as a shortcut: `suth cards assigned me`
329
329
  > - Priority levels: 1=Urgent, 2=High, 3=Medium, 4=Low
330
330
 
331
+ ### Mentions
332
+
333
+ Use `{{@Name}}` to tag workspace members in comments, replies, and checklist items:
334
+
335
+ ```bash
336
+ suth comments create -c CARD --content "{{@Stacey}} Ready for review."
337
+ ```
338
+
339
+ The name is matched case-insensitively against member display names. Unresolved mentions produce a warning.
340
+
331
341
  ## Library Usage
332
342
 
333
343
  You can also use Superthread as a Ruby gem in your code:
@@ -34,7 +34,7 @@ module Superthread
34
34
  end
35
35
 
36
36
  desc "create", "Create a comment"
37
- option :content, type: :string, required: true, desc: "Comment content (HTML)"
37
+ option :content, type: :string, required: true, desc: "Comment content (HTML). Use {{@Name}} to mention users"
38
38
  option :card, type: :string, aliases: "-c", desc: "Parent card ID (required unless --page)"
39
39
  option :page, type: :string, aliases: "-p", desc: "Parent page ID (required unless --card)"
40
40
  # Create a new comment on a card or page.
@@ -49,7 +49,7 @@ module Superthread
49
49
  end
50
50
 
51
51
  desc "update COMMENT_ID", "Update a comment"
52
- option :content, type: :string, desc: "New content"
52
+ option :content, type: :string, desc: "New content (HTML). Use {{@Name}} to mention users"
53
53
  option :status, type: :string, enum: %w[resolved open orphaned], desc: "Comment status"
54
54
  # Update an existing comment's content or status.
55
55
  #
@@ -44,7 +44,7 @@ module Superthread
44
44
 
45
45
  desc "create", "Reply to a comment"
46
46
  option :comment, type: :string, required: true, desc: "Parent comment ID"
47
- option :content, type: :string, required: true, desc: "Reply content"
47
+ option :content, type: :string, required: true, desc: "Reply content (HTML). Use {{@Name}} to mention users"
48
48
  # Add a threaded reply to an existing comment.
49
49
  #
50
50
  # @return [void]
@@ -57,7 +57,7 @@ module Superthread
57
57
 
58
58
  desc "update REPLY_ID", "Update a reply"
59
59
  option :comment, type: :string, required: true, desc: "Parent comment ID"
60
- option :content, type: :string, desc: "New content"
60
+ option :content, type: :string, desc: "New content (HTML). Use {{@Name}} to mention users"
61
61
  option :status, type: :string, enum: %w[resolved open orphaned], desc: "Status"
62
62
  # Update an existing reply's content or status.
63
63
  #
@@ -30,6 +30,8 @@ module Superthread
30
30
  ESCAPE_PATTERN = /\\\{\{@([^}]+)\}\}/
31
31
  # @return [Regexp] pattern matching placeholders used during escape processing
32
32
  PLACEHOLDER_PATTERN = /___ESCAPED_MENTION_(.+?)___END___/
33
+ # @return [Regexp] pattern matching raw HTML mention tags that should use {{@Name}} syntax
34
+ HTML_MENTION_PATTERN = /<(?:user-mention|mention-user)\b/i
33
35
 
34
36
  # @param client [Superthread::Client] the API client for fetching members
35
37
  # @param workspace_id [String] the workspace to look up members in
@@ -43,6 +45,7 @@ module Superthread
43
45
  # @param content [String, nil] text that may contain {{@Name}} patterns
44
46
  # @return [String, nil] content with mentions converted to HTML tags
45
47
  def format(content)
48
+ warn_html_mentions(content) if content
46
49
  return content if content.nil? || !content.include?("{{@")
47
50
 
48
51
  member_map = build_member_map
@@ -54,6 +57,7 @@ module Superthread
54
57
  result = content.gsub(ESCAPE_PATTERN, '___ESCAPED_MENTION_\1___END___')
55
58
 
56
59
  # Pass 2: replace {{@Name}} with HTML tags
60
+ unresolved = []
57
61
  result = result.gsub(MENTION_PATTERN) do |match|
58
62
  name = Regexp.last_match(1).strip
59
63
  member = member_map[name.downcase]
@@ -67,16 +71,34 @@ module Superthread
67
71
  "user-value=\"#{safe_name}\" " \
68
72
  'denotation-char="@"></user-mention>'
69
73
  else
74
+ unresolved << name
70
75
  match
71
76
  end
72
77
  end
73
78
 
79
+ unresolved.each do |name|
80
+ warn "Warning: Could not resolve mention: #{name}. " \
81
+ "Check the display name matches a workspace member."
82
+ end
83
+
74
84
  # Pass 3: restore escaped mentions as literal {{@Name}} text
75
85
  result.gsub(PLACEHOLDER_PATTERN, '{{@\1}}')
76
86
  end
77
87
 
78
88
  private
79
89
 
90
+ # Warns when content contains raw HTML mention tags instead of {{@Name}} syntax.
91
+ #
92
+ # @param content [String] text to check for raw HTML mention tags
93
+ # @return [void]
94
+ def warn_html_mentions(content)
95
+ return unless content.match?(HTML_MENTION_PATTERN)
96
+
97
+ warn "Warning: Raw HTML mention tags detected in content. " \
98
+ "Use {{@Name}} syntax to mention users " \
99
+ "(e.g., '{{@Steve Clarke}} check this')."
100
+ end
101
+
80
102
  # Fetches workspace members and builds a case-insensitive lookup map.
81
103
  #
82
104
  # @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.7.3"
5
+ VERSION = "0.7.4"
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.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Clarke