commenter 0.2.1 → 0.2.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 +4 -4
- data/.github/workflows/release.yml +0 -1
- data/.rubocop.yml +2 -0
- data/.rubocop_todo.yml +174 -0
- data/README.adoc +439 -18
- data/commenter.gemspec +4 -0
- data/data/github_config_sample.yaml +78 -0
- data/data/github_issue_body_template.liquid +35 -0
- data/data/github_issue_title_template.liquid +1 -0
- data/exe/commenter +1 -1
- data/lib/commenter/cli.rb +137 -4
- data/lib/commenter/comment.rb +62 -3
- data/lib/commenter/comment_sheet.rb +10 -8
- data/lib/commenter/filler.rb +74 -20
- data/lib/commenter/github_integration.rb +452 -0
- data/lib/commenter/parser.rb +10 -6
- data/lib/commenter/version.rb +1 -1
- data/lib/commenter.rb +1 -0
- data/schema/iso_comment_2012-03.yaml +38 -0
- data/spec/commenter/comment_sheet_spec.rb +193 -0
- data/spec/commenter/comment_spec.rb +220 -0
- data/spec/commenter/github_integration_spec.rb +183 -0
- data/spec/commenter_spec.rb +0 -1
- metadata +66 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac1118f53d0edcb5d61c345203bdfdc20a5711c4971e68ae5bb9225744bae8b3
|
4
|
+
data.tar.gz: 309347f180dee0adbe3a51c5d75fbf5aea0f95884667048c5a12a14faae479a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b90c6ec2ee250680be18144d1e32a285d26994d760806a0b2d555c964163bae84330fea41d7531b6aeb0a95d790e7ad01436592fb60640af22bcf094a5f91cb
|
7
|
+
data.tar.gz: 93a090640a00260ca88db27683f8e8b38f71978e8040ab10f019013cc34472316729c66e19324b5fe1ce56b4f286abd8ff019c919e854cc2fc19d6212569185f
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2025-06-04 10:43:42 UTC using RuboCop version 1.75.8.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: Severity, Include.
|
11
|
+
# Include: **/*.gemspec
|
12
|
+
Gemspec/RequiredRubyVersion:
|
13
|
+
Exclude:
|
14
|
+
- 'commenter.gemspec'
|
15
|
+
|
16
|
+
# Offense count: 1
|
17
|
+
# This cop supports safe autocorrection (--autocorrect).
|
18
|
+
# Configuration parameters: EnforcedStyleAlignWith, Severity.
|
19
|
+
# SupportedStylesAlignWith: start_of_line, begin
|
20
|
+
Layout/BeginEndAlignment:
|
21
|
+
Exclude:
|
22
|
+
- 'lib/commenter/parser.rb'
|
23
|
+
|
24
|
+
# Offense count: 1
|
25
|
+
# This cop supports safe autocorrection (--autocorrect).
|
26
|
+
# Configuration parameters: EnforcedStyle.
|
27
|
+
# SupportedStyles: empty_lines, no_empty_lines
|
28
|
+
Layout/EmptyLinesAroundBlockBody:
|
29
|
+
Exclude:
|
30
|
+
- 'spec/commenter_spec.rb'
|
31
|
+
|
32
|
+
# Offense count: 2
|
33
|
+
# This cop supports safe autocorrection (--autocorrect).
|
34
|
+
# Configuration parameters: Width, AllowedPatterns.
|
35
|
+
Layout/IndentationWidth:
|
36
|
+
Exclude:
|
37
|
+
- 'lib/commenter/parser.rb'
|
38
|
+
|
39
|
+
# Offense count: 1
|
40
|
+
# This cop supports safe autocorrection (--autocorrect).
|
41
|
+
Layout/RescueEnsureAlignment:
|
42
|
+
Exclude:
|
43
|
+
- 'lib/commenter/parser.rb'
|
44
|
+
|
45
|
+
# Offense count: 1
|
46
|
+
Lint/NonLocalExitFromIterator:
|
47
|
+
Exclude:
|
48
|
+
- 'lib/commenter/filler.rb'
|
49
|
+
|
50
|
+
# Offense count: 4
|
51
|
+
# This cop supports safe autocorrection (--autocorrect).
|
52
|
+
Lint/SafeNavigationWithEmpty:
|
53
|
+
Exclude:
|
54
|
+
- 'lib/commenter/parser.rb'
|
55
|
+
|
56
|
+
# Offense count: 1
|
57
|
+
# This cop supports safe autocorrection (--autocorrect).
|
58
|
+
# Configuration parameters: AutoCorrect, IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
59
|
+
Lint/UnusedBlockArgument:
|
60
|
+
Exclude:
|
61
|
+
- 'lib/commenter/filler.rb'
|
62
|
+
|
63
|
+
# Offense count: 4
|
64
|
+
# This cop supports safe autocorrection (--autocorrect).
|
65
|
+
# Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
|
66
|
+
# NotImplementedExceptions: NotImplementedError
|
67
|
+
Lint/UnusedMethodArgument:
|
68
|
+
Exclude:
|
69
|
+
- 'lib/commenter/github_integration.rb'
|
70
|
+
|
71
|
+
# Offense count: 1
|
72
|
+
# This cop supports safe autocorrection (--autocorrect).
|
73
|
+
# Configuration parameters: AutoCorrect.
|
74
|
+
Lint/UselessAssignment:
|
75
|
+
Exclude:
|
76
|
+
- 'lib/commenter/parser.rb'
|
77
|
+
|
78
|
+
# Offense count: 15
|
79
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
80
|
+
Metrics/AbcSize:
|
81
|
+
Max: 78
|
82
|
+
|
83
|
+
# Offense count: 10
|
84
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
85
|
+
# AllowedMethods: refine
|
86
|
+
Metrics/BlockLength:
|
87
|
+
Max: 171
|
88
|
+
|
89
|
+
# Offense count: 5
|
90
|
+
# Configuration parameters: CountComments, CountAsOne.
|
91
|
+
Metrics/ClassLength:
|
92
|
+
Max: 202
|
93
|
+
|
94
|
+
# Offense count: 9
|
95
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
96
|
+
Metrics/CyclomaticComplexity:
|
97
|
+
Max: 22
|
98
|
+
|
99
|
+
# Offense count: 22
|
100
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
101
|
+
Metrics/MethodLength:
|
102
|
+
Max: 53
|
103
|
+
|
104
|
+
# Offense count: 9
|
105
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
106
|
+
Metrics/PerceivedComplexity:
|
107
|
+
Max: 22
|
108
|
+
|
109
|
+
# Offense count: 1
|
110
|
+
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
|
111
|
+
# NamePrefix: is_, has_, have_, does_
|
112
|
+
# ForbiddenPrefixes: is_, has_, have_, does_
|
113
|
+
# AllowedMethods: is_a?
|
114
|
+
# MethodDefinitionMacros: define_method, define_singleton_method
|
115
|
+
Naming/PredicateName:
|
116
|
+
Exclude:
|
117
|
+
- 'spec/**/*'
|
118
|
+
- 'lib/commenter/comment.rb'
|
119
|
+
|
120
|
+
# Offense count: 7
|
121
|
+
# Configuration parameters: AllowedConstants.
|
122
|
+
Style/Documentation:
|
123
|
+
Exclude:
|
124
|
+
- 'spec/**/*'
|
125
|
+
- 'test/**/*'
|
126
|
+
- 'lib/commenter/cli.rb'
|
127
|
+
- 'lib/commenter/comment.rb'
|
128
|
+
- 'lib/commenter/comment_sheet.rb'
|
129
|
+
- 'lib/commenter/filler.rb'
|
130
|
+
- 'lib/commenter/github_integration.rb'
|
131
|
+
- 'lib/commenter/parser.rb'
|
132
|
+
|
133
|
+
# Offense count: 1
|
134
|
+
# This cop supports safe autocorrection (--autocorrect).
|
135
|
+
# Configuration parameters: AutoCorrect, EnforcedStyle, AllowComments.
|
136
|
+
# SupportedStyles: empty, nil, both
|
137
|
+
Style/EmptyElse:
|
138
|
+
Exclude:
|
139
|
+
- 'lib/commenter/filler.rb'
|
140
|
+
|
141
|
+
# Offense count: 3
|
142
|
+
# This cop supports safe autocorrection (--autocorrect).
|
143
|
+
Style/IfUnlessModifier:
|
144
|
+
Exclude:
|
145
|
+
- 'lib/commenter/cli.rb'
|
146
|
+
- 'lib/commenter/github_integration.rb'
|
147
|
+
- 'lib/commenter/parser.rb'
|
148
|
+
|
149
|
+
# Offense count: 1
|
150
|
+
# This cop supports safe autocorrection (--autocorrect).
|
151
|
+
Style/MultilineIfModifier:
|
152
|
+
Exclude:
|
153
|
+
- 'lib/commenter/parser.rb'
|
154
|
+
|
155
|
+
# Offense count: 2
|
156
|
+
# This cop supports safe autocorrection (--autocorrect).
|
157
|
+
Style/RescueModifier:
|
158
|
+
Exclude:
|
159
|
+
- 'lib/commenter/parser.rb'
|
160
|
+
|
161
|
+
# Offense count: 2
|
162
|
+
# This cop supports safe autocorrection (--autocorrect).
|
163
|
+
# Configuration parameters: EnforcedStyle.
|
164
|
+
# SupportedStyles: implicit, explicit
|
165
|
+
Style/RescueStandardError:
|
166
|
+
Exclude:
|
167
|
+
- 'lib/commenter/parser.rb'
|
168
|
+
|
169
|
+
# Offense count: 2
|
170
|
+
# This cop supports safe autocorrection (--autocorrect).
|
171
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
172
|
+
# URISchemes: http, https
|
173
|
+
Layout/LineLength:
|
174
|
+
Max: 132
|
data/README.adoc
CHANGED
@@ -161,13 +161,280 @@ Syntax:
|
|
161
161
|
$ commenter fill comments.yaml -o filled_comments.docx
|
162
162
|
----
|
163
163
|
|
164
|
-
==== Fill
|
164
|
+
==== Fill options
|
165
165
|
|
166
166
|
Options:
|
167
167
|
|
168
168
|
`-o, --output FILE`:: Output DOCX file (default: filled_comments.docx)
|
169
169
|
`-t, --template FILE`:: Custom template file
|
170
|
-
`-s, --shading`:: Apply status-based cell shading
|
170
|
+
`-s, --shading`:: Apply status-based cell shading
|
171
|
+
|
172
|
+
=== GitHub Integration
|
173
|
+
|
174
|
+
==== Overview
|
175
|
+
|
176
|
+
The commenter gem provides comprehensive GitHub integration for collaborative comment review and tracking. The workflow consists of two main commands:
|
177
|
+
|
178
|
+
* `github-create` - Creates GitHub issues from comments and tracks them in YAML
|
179
|
+
* `github-retrieve` - Retrieves final observations from closed GitHub issues
|
180
|
+
|
181
|
+
==== Creating GitHub issues from comments
|
182
|
+
|
183
|
+
===== Basic usage
|
184
|
+
|
185
|
+
[source,shell]
|
186
|
+
----
|
187
|
+
$ commenter github-create --config github_config.yaml comments.yaml
|
188
|
+
----
|
189
|
+
|
190
|
+
This command creates GitHub issues for each comment and automatically updates the YAML file with GitHub issue information (issue numbers, URLs, status, timestamps).
|
191
|
+
|
192
|
+
==== Configuration file
|
193
|
+
|
194
|
+
Create a GitHub configuration file to specify repository, authentication, and
|
195
|
+
issue settings:
|
196
|
+
|
197
|
+
[source,yaml]
|
198
|
+
----
|
199
|
+
github:
|
200
|
+
repository: "owner/repo-name"
|
201
|
+
token: "ghp_xxxxxxxxxxxx"
|
202
|
+
milestone:
|
203
|
+
name: "ISO 80000-2 DIS Review"
|
204
|
+
default_labels: ["comment-review", "iso-standard"]
|
205
|
+
stage_labels:
|
206
|
+
WD: ["working-draft"]
|
207
|
+
DIS: ["draft-international-standard"]
|
208
|
+
----
|
209
|
+
|
210
|
+
A sample configuration file is provided at `data/github_config_sample.yaml`.
|
211
|
+
|
212
|
+
==== Issue templates
|
213
|
+
|
214
|
+
===== General
|
215
|
+
|
216
|
+
The gem uses Liquid templates to format GitHub issue titles and bodies. Default
|
217
|
+
templates are provided, but you can customize them.
|
218
|
+
|
219
|
+
===== Title template variables
|
220
|
+
|
221
|
+
The title template (`data/github_issue_title_template.liquid`) supports these variables:
|
222
|
+
|
223
|
+
* `stage` - Approval stage (WD/CD/DIS/FDIS/PRF/PUB)
|
224
|
+
* `document` - Document identifier
|
225
|
+
* `comment_id` - Comment identifier
|
226
|
+
* `brief_summary` - Generated summary combining locality and description
|
227
|
+
* `body` - Member body abbreviation
|
228
|
+
* `type` - Comment type code
|
229
|
+
* `clause`, `element`, `line_number` - Location information
|
230
|
+
|
231
|
+
===== Body template variables
|
232
|
+
|
233
|
+
The body template (`data/github_issue_body_template.liquid`) supports all title
|
234
|
+
variables plus:
|
235
|
+
|
236
|
+
* `comments` - Full comment text
|
237
|
+
* `proposed_change` - Proposed change text
|
238
|
+
* `observations` - Secretariat observations
|
239
|
+
* `has_observations` - Boolean for conditional rendering
|
240
|
+
* `has_proposed_change` - Boolean for conditional rendering
|
241
|
+
* `project` - Project name
|
242
|
+
* `date` - Comment sheet date
|
243
|
+
* `version` - Template version
|
244
|
+
* `type_full_name` - Full comment type name (General/Technical/Editorial)
|
245
|
+
* `locality_summary` - Formatted locality string
|
246
|
+
|
247
|
+
===== Custom templates
|
248
|
+
|
249
|
+
[example]
|
250
|
+
====
|
251
|
+
Create custom templates and reference them in your configuration:
|
252
|
+
|
253
|
+
[source,yaml]
|
254
|
+
----
|
255
|
+
github:
|
256
|
+
templates:
|
257
|
+
title: "custom_title.liquid"
|
258
|
+
body: "custom_body.liquid"
|
259
|
+
----
|
260
|
+
====
|
261
|
+
|
262
|
+
==== Command options
|
263
|
+
|
264
|
+
* `-c, --config FILE` - GitHub configuration YAML file (required)
|
265
|
+
* `--stage STAGE` - Override approval stage
|
266
|
+
* `--milestone NAME` - Override milestone name
|
267
|
+
* `--assignee HANDLE` - Override assignee GitHub handle
|
268
|
+
* `--title-template FILE` - Custom title template
|
269
|
+
* `--body-template FILE` - Custom body template
|
270
|
+
* `--dry-run` - Preview issues without creating them
|
271
|
+
|
272
|
+
==== Examples
|
273
|
+
|
274
|
+
[example]
|
275
|
+
====
|
276
|
+
Create issues with custom stage:
|
277
|
+
|
278
|
+
[source,shell]
|
279
|
+
----
|
280
|
+
$ commenter github-create --config github_config.yaml --stage DIS comments.yaml
|
281
|
+
----
|
282
|
+
|
283
|
+
Preview issues before creation:
|
284
|
+
|
285
|
+
[source,shell]
|
286
|
+
----
|
287
|
+
$ commenter github-create --config github_config.yaml --dry-run comments.yaml
|
288
|
+
----
|
289
|
+
====
|
290
|
+
|
291
|
+
==== Security considerations
|
292
|
+
|
293
|
+
For security reasons, it is recommended to use the `GITHUB_TOKEN` environment
|
294
|
+
variable instead of storing the token in the configuration file.
|
295
|
+
|
296
|
+
[source,shell]
|
297
|
+
----
|
298
|
+
$ export GITHUB_TOKEN=ghp_xxxxxxxxxxxx
|
299
|
+
$ commenter github comments.yaml --config github_config.yaml
|
300
|
+
----
|
301
|
+
|
302
|
+
==== Duplicate detection
|
303
|
+
|
304
|
+
The gem automatically checks for existing issues to avoid duplicates by
|
305
|
+
searching for the comment ID in issue titles. If an issue already exists, it
|
306
|
+
will be skipped.
|
307
|
+
|
308
|
+
==== Retrieving observations from GitHub issues
|
309
|
+
|
310
|
+
===== Basic usage
|
311
|
+
|
312
|
+
After GitHub issues have been created and reviewed, use the `github-retrieve` command to extract final observations from closed issues:
|
313
|
+
|
314
|
+
[source,shell]
|
315
|
+
----
|
316
|
+
$ commenter github-retrieve --config github_config.yaml comments.yaml
|
317
|
+
----
|
318
|
+
|
319
|
+
This command:
|
320
|
+
|
321
|
+
* Reads GitHub issue information from the YAML file (no searching required)
|
322
|
+
* Fetches observations from closed GitHub issues only
|
323
|
+
* Updates the same YAML file with extracted observations
|
324
|
+
* Preserves all existing comment data
|
325
|
+
|
326
|
+
===== Magic comment syntax
|
327
|
+
|
328
|
+
To provide official observations in GitHub issues, use markdown blockquotes with special markers:
|
329
|
+
|
330
|
+
[source,markdown]
|
331
|
+
----
|
332
|
+
> **OBSERVATION:**
|
333
|
+
> Accepted. The proposed change will be included in clause 5.2.1 of the next revision.
|
334
|
+
> Technical details have been reviewed and approved by the working group.
|
335
|
+
----
|
336
|
+
|
337
|
+
Alternative shorter syntax:
|
338
|
+
|
339
|
+
[source,markdown]
|
340
|
+
----
|
341
|
+
> **COMMENTER OBSERVATION:**
|
342
|
+
> Noted. This will be considered for future revisions.
|
343
|
+
----
|
344
|
+
|
345
|
+
===== Retrieval options
|
346
|
+
|
347
|
+
* `-c, --config FILE` - GitHub configuration YAML file (required)
|
348
|
+
* `-o, --output FILE` - Output YAML file (default: update original)
|
349
|
+
* `--include-open` - Include observations from open issues (not recommended)
|
350
|
+
* `--dry-run` - Preview observations without updating YAML
|
351
|
+
|
352
|
+
===== Examples
|
353
|
+
|
354
|
+
[example]
|
355
|
+
====
|
356
|
+
Preview observations before updating:
|
357
|
+
|
358
|
+
[source,shell]
|
359
|
+
----
|
360
|
+
$ commenter github-retrieve --config github_config.yaml --dry-run comments.yaml
|
361
|
+
----
|
362
|
+
|
363
|
+
Save to new file instead of updating original:
|
364
|
+
|
365
|
+
[source,shell]
|
366
|
+
----
|
367
|
+
$ commenter github-retrieve --config github_config.yaml -o final_comments.yaml comments.yaml
|
368
|
+
----
|
369
|
+
|
370
|
+
Include observations from open issues:
|
371
|
+
|
372
|
+
[source,shell]
|
373
|
+
----
|
374
|
+
$ commenter github-retrieve --config github_config.yaml --include-open comments.yaml
|
375
|
+
----
|
376
|
+
====
|
377
|
+
|
378
|
+
===== Enhanced YAML structure
|
379
|
+
|
380
|
+
After using `github-create`, your YAML file will include GitHub integration information:
|
381
|
+
|
382
|
+
[source,yaml]
|
383
|
+
----
|
384
|
+
comments:
|
385
|
+
- id: US-001
|
386
|
+
body: US
|
387
|
+
locality:
|
388
|
+
clause: "5.2.1"
|
389
|
+
element: "Table 3"
|
390
|
+
type: te
|
391
|
+
comments: "The values in Table 3 appear inconsistent..."
|
392
|
+
proposed_change: "Correct the values in column 2..."
|
393
|
+
observations: ""
|
394
|
+
github:
|
395
|
+
issue_number: 123
|
396
|
+
issue_url: "https://github.com/owner/repo/issues/123"
|
397
|
+
status: "open"
|
398
|
+
created_at: "2024-01-15T10:30:00Z"
|
399
|
+
----
|
400
|
+
|
401
|
+
After using `github-retrieve` (when the issue is closed):
|
402
|
+
|
403
|
+
[source,yaml]
|
404
|
+
----
|
405
|
+
comments:
|
406
|
+
- id: US-001
|
407
|
+
# ... other fields unchanged ...
|
408
|
+
observations: "Accepted. The proposed change will be included in clause 5.2.1."
|
409
|
+
github:
|
410
|
+
issue_number: 123
|
411
|
+
issue_url: "https://github.com/owner/repo/issues/123"
|
412
|
+
status: "closed"
|
413
|
+
created_at: "2024-01-15T10:30:00Z"
|
414
|
+
updated_at: "2024-01-20T14:45:00Z"
|
415
|
+
----
|
416
|
+
|
417
|
+
===== Configuration for retrieval
|
418
|
+
|
419
|
+
The GitHub configuration file supports retrieval-specific settings:
|
420
|
+
|
421
|
+
[source,yaml]
|
422
|
+
----
|
423
|
+
github:
|
424
|
+
repository: "owner/repo-name"
|
425
|
+
retrieval:
|
426
|
+
# Magic comment markers to look for
|
427
|
+
observation_markers:
|
428
|
+
- "**OBSERVATION:**"
|
429
|
+
- "**COMMENTER OBSERVATION:**"
|
430
|
+
|
431
|
+
# Fallback to last comment if no magic comment found
|
432
|
+
fallback_to_last_comment: true
|
433
|
+
|
434
|
+
# Only retrieve from closed issues (recommended)
|
435
|
+
closed_issues_only: true
|
436
|
+
----
|
437
|
+
|
171
438
|
|
172
439
|
=== Comment ID format
|
173
440
|
|
@@ -187,7 +454,7 @@ Where:
|
|
187
454
|
* `CC` = CalConnect
|
188
455
|
====
|
189
456
|
|
190
|
-
=== Comment
|
457
|
+
=== Comment types
|
191
458
|
|
192
459
|
The comment types are defined as follows:
|
193
460
|
|
@@ -202,22 +469,20 @@ The comment types are defined as follows:
|
|
202
469
|
flowchart LR
|
203
470
|
A[ISO Comment Sheet DOCX] --> B[commenter import]
|
204
471
|
B --> C[YAML + Schema]
|
205
|
-
C --> D[
|
206
|
-
D --> E[
|
207
|
-
E --> F[
|
208
|
-
F --> G[
|
209
|
-
G --> H[
|
472
|
+
C --> D[commenter github-create]
|
473
|
+
D --> E[YAML + GitHub Info]
|
474
|
+
E --> F[GitHub Issues + Review Process]
|
475
|
+
F --> G[commenter github-retrieve]
|
476
|
+
G --> H[YAML + Observations]
|
477
|
+
H --> I[commenter fill]
|
478
|
+
I --> J[Final DOCX]
|
479
|
+
J --> K[ISO Secretariat]
|
210
480
|
----
|
211
481
|
|
212
|
-
=== Shading
|
213
|
-
|
214
|
-
WARNING: Cell shading is not currently implemented.
|
215
|
-
|
216
|
-
The `--shading` option is accepted but will only print status information to the
|
217
|
-
console.
|
482
|
+
=== Shading rules
|
218
483
|
|
219
|
-
When the `--shading` option is used, the following status patterns
|
220
|
-
recognized:
|
484
|
+
When the `--shading` option is used, the following status patterns are
|
485
|
+
recognized and applied to the observations column:
|
221
486
|
|
222
487
|
|===
|
223
488
|
| Status Pattern | Intended Color | Hex Code | Example
|
@@ -252,6 +517,12 @@ comments: # Array of comment objects
|
|
252
517
|
comments: string # Comment text
|
253
518
|
proposed_change: string # Proposed solution
|
254
519
|
observations: string | null # Secretariat observations (optional)
|
520
|
+
github: # GitHub integration information (optional)
|
521
|
+
issue_number: integer # GitHub issue number
|
522
|
+
issue_url: string # GitHub issue URL
|
523
|
+
status: "open" | "closed" # GitHub issue status
|
524
|
+
created_at: string # ISO 8601 timestamp
|
525
|
+
updated_at: string # ISO 8601 timestamp (optional)
|
255
526
|
----
|
256
527
|
|
257
528
|
|
@@ -271,14 +542,164 @@ This enables:
|
|
271
542
|
* Inline documentation
|
272
543
|
|
273
544
|
|
545
|
+
== Development
|
546
|
+
|
547
|
+
=== Getting started
|
548
|
+
|
549
|
+
After checking out the repo, run `bin/setup` to install dependencies:
|
550
|
+
|
551
|
+
[source,shell]
|
552
|
+
----
|
553
|
+
$ git clone https://github.com/metanorma/commenter.git
|
554
|
+
$ cd commenter
|
555
|
+
$ bin/setup
|
556
|
+
----
|
557
|
+
|
558
|
+
Then, run `rake spec` to run the tests:
|
559
|
+
|
560
|
+
[source,shell]
|
561
|
+
----
|
562
|
+
$ bundle exec rake spec
|
563
|
+
----
|
564
|
+
|
565
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment:
|
566
|
+
|
567
|
+
[source,shell]
|
568
|
+
----
|
569
|
+
$ bin/console
|
570
|
+
----
|
571
|
+
|
572
|
+
=== Running tests
|
573
|
+
|
574
|
+
The gem includes comprehensive test coverage for all major components:
|
575
|
+
|
576
|
+
[source,shell]
|
577
|
+
----
|
578
|
+
# Run all tests
|
579
|
+
$ bundle exec rspec
|
580
|
+
|
581
|
+
# Run specific test files
|
582
|
+
$ bundle exec rspec spec/commenter/comment_spec.rb
|
583
|
+
$ bundle exec rspec spec/commenter/comment_sheet_spec.rb
|
584
|
+
$ bundle exec rspec spec/commenter/github_integration_spec.rb
|
585
|
+
|
586
|
+
# Run tests with coverage
|
587
|
+
$ bundle exec rspec --format documentation
|
588
|
+
----
|
589
|
+
|
590
|
+
=== Testing GitHub integration
|
591
|
+
|
592
|
+
To test the GitHub integration features:
|
593
|
+
|
594
|
+
1. Create a test repository on GitHub
|
595
|
+
2. Generate a personal access token with appropriate permissions
|
596
|
+
3. Create a test configuration file:
|
597
|
+
|
598
|
+
[source,yaml]
|
599
|
+
----
|
600
|
+
github:
|
601
|
+
repository: "your-username/test-repo"
|
602
|
+
default_labels: ["test-comment"]
|
603
|
+
default_assignee: "your-username"
|
604
|
+
----
|
605
|
+
|
606
|
+
4. Test with dry-run mode first:
|
607
|
+
|
608
|
+
[source,shell]
|
609
|
+
----
|
610
|
+
$ GITHUB_TOKEN=your_token bundle exec exe/commenter github test_comments.yaml --config test_config.yaml --dry-run
|
611
|
+
----
|
612
|
+
|
613
|
+
NOTE: For testing template rendering and dry-run functionality without a real GitHub token, you can use a dummy token:
|
614
|
+
|
615
|
+
[source,shell]
|
616
|
+
----
|
617
|
+
$ GITHUB_TOKEN=dummy_token bundle exec exe/commenter github test_comments.yaml --config test_config.yaml --dry-run
|
618
|
+
----
|
619
|
+
|
620
|
+
This allows you to test the issue preview functionality, template rendering, and configuration parsing without making actual GitHub API calls.
|
621
|
+
|
622
|
+
=== Code structure
|
623
|
+
|
624
|
+
The gem is organized into several key components:
|
625
|
+
|
626
|
+
==== Core classes
|
627
|
+
|
628
|
+
`Commenter::Comment`:: Represents individual comments with locality, type, and content
|
629
|
+
`Commenter::CommentSheet`:: Container for multiple comments with metadata
|
630
|
+
`Commenter::Parser`:: Handles DOCX parsing and YAML generation
|
631
|
+
`Commenter::Filler`:: Fills DOCX templates with comment data
|
632
|
+
`Commenter::GitHubIssueCreator`:: Creates GitHub issues from comments
|
633
|
+
|
634
|
+
==== CLI interface
|
635
|
+
|
636
|
+
`Commenter::Cli`:: Thor-based command-line interface with subcommands:
|
637
|
+
|
638
|
+
** `import` - Convert DOCX to YAML
|
639
|
+
** `fill` - Fill DOCX template from YAML
|
640
|
+
** `github-create` - Create GitHub issues from comments
|
641
|
+
** `github-retrieve` - Retrieve observations from GitHub issues
|
642
|
+
|
643
|
+
==== Templates and configuration
|
644
|
+
|
645
|
+
* `data/iso_comment_template_2012-03.docx` - Base DOCX template
|
646
|
+
* `data/github_issue_title_template.liquid` - GitHub issue title template
|
647
|
+
* `data/github_issue_body_template.liquid` - GitHub issue body template
|
648
|
+
* `data/github_config_sample.yaml` - Sample GitHub configuration
|
649
|
+
* `schema/iso_comment_2012-03.yaml` - YAML schema for validation
|
650
|
+
|
651
|
+
=== Debugging
|
652
|
+
|
653
|
+
Enable debug output for troubleshooting:
|
654
|
+
|
655
|
+
[source,shell]
|
656
|
+
----
|
657
|
+
# Enable verbose output
|
658
|
+
$ bundle exec exe/commenter import input.docx --verbose
|
659
|
+
|
660
|
+
# Debug GitHub API calls
|
661
|
+
$ OCTOKIT_DEBUG=true bundle exec exe/commenter github comments.yaml --config config.yaml --dry-run
|
662
|
+
----
|
663
|
+
|
664
|
+
=== Troubleshooting
|
665
|
+
|
666
|
+
==== Common issues
|
667
|
+
|
668
|
+
**DOCX parsing errors**::
|
669
|
+
** Ensure the DOCX file follows the ISO comment template format
|
670
|
+
** Check for corrupted or password-protected files
|
671
|
+
** Verify table structure matches expected format
|
672
|
+
|
673
|
+
**GitHub API errors**::
|
674
|
+
** Verify your GitHub token has appropriate permissions
|
675
|
+
** Check rate limiting if making many requests
|
676
|
+
** Ensure repository exists and is accessible
|
677
|
+
|
678
|
+
**Template rendering errors**::
|
679
|
+
** Validate Liquid template syntax
|
680
|
+
** Check that all referenced variables are available
|
681
|
+
** Test templates with sample data first
|
682
|
+
|
683
|
+
**Schema validation errors**::
|
684
|
+
** Ensure YAML follows the required structure
|
685
|
+
** Check for missing required fields
|
686
|
+
** Validate comment ID format
|
687
|
+
|
688
|
+
==== Getting help
|
689
|
+
|
690
|
+
* Check the issue tracker on GitHub
|
691
|
+
* Review existing test cases for usage examples
|
692
|
+
* Run commands with `--help` for detailed options
|
693
|
+
* Use `--dry-run` mode to preview operations safely
|
694
|
+
|
695
|
+
|
274
696
|
== Copyright
|
275
697
|
|
276
698
|
This gem is developed, maintained and funded by
|
277
|
-
https://www.ribose.com[Ribose
|
699
|
+
https://www.ribose.com[Ribose]
|
278
700
|
|
279
701
|
|
280
702
|
== License
|
281
703
|
|
282
704
|
The gem is available as open source under the terms of the
|
283
705
|
https://opensource.org/licenses/BSD-2-Clause[2-Clause BSD License].
|
284
|
-
|
data/commenter.gemspec
CHANGED
@@ -30,6 +30,10 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
|
+
spec.add_dependency "base64", "~> 0.1"
|
33
34
|
spec.add_dependency "docx", "~> 0.8"
|
35
|
+
spec.add_dependency "dotenv", "~> 2.8"
|
36
|
+
spec.add_dependency "liquid", "~> 5.0"
|
37
|
+
spec.add_dependency "octokit", "~> 6.0"
|
34
38
|
spec.add_dependency "thor", "~> 1.0"
|
35
39
|
end
|