asciidoc-pubkit 1.3.0 → 1.4.0
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/CHANGELOG.md +55 -1
- data/README.md +34 -4
- data/data/writing/en/criteria.md +33 -0
- data/data/writing/ja/criteria.md +189 -2
- data/docs/image-commands.md +165 -0
- data/docs/installation.md +5 -1
- data/docs/prose-evaluation.md +57 -3
- data/docs/review-workflow.md +46 -1
- data/docs/writing.md +63 -0
- data/examples/skills/review-asciidoc-manuscript/SKILL.md +5 -0
- data/lib/asciidoc_pubkit/cli.rb +9 -3
- data/lib/asciidoc_pubkit/document_commands.rb +1 -0
- data/lib/asciidoc_pubkit/image_commands.rb +364 -0
- data/lib/asciidoc_pubkit/japanese_verification.rb +70 -0
- data/lib/asciidoc_pubkit/session.rb +25 -3
- data/lib/asciidoc_pubkit.rb +3 -1
- metadata +10 -7
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module AsciidocPubkit
|
|
4
|
+
# Advisory inventories avoid guessing paragraph matches after splits/merges.
|
|
5
|
+
module JapaneseVerification
|
|
6
|
+
MARKERS = {
|
|
7
|
+
'negation' => /ません|ない|なく|ずに|禁止|不可/,
|
|
8
|
+
'condition' => /場合|とき|なら|限り|だけ|のみ|以外|ただし|除く/,
|
|
9
|
+
'certainty' => /かもしれません|かもしれない|可能性|おそれ|とされる|とみられる|必ず|保証/,
|
|
10
|
+
'capability' => /できます|できません|できる|できない|可能|不可能/,
|
|
11
|
+
'actor-topic' => /[\p{Han}\p{Katakana}A-Za-z][\p{Han}\p{Hiragana}\p{Katakana}A-Za-z]{0,29}(?:が|は)(?=[、\p{Han}\p{Hiragana}\p{Katakana}A-Za-z])/
|
|
12
|
+
}.freeze
|
|
13
|
+
|
|
14
|
+
def self.units(document, scope)
|
|
15
|
+
scope == 'headings' ? document.fetch('headings') : document.fetch('paragraphs')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.inventory(entries, pattern)
|
|
19
|
+
entries.flat_map { |entry| Rules.mask(entry.fetch('text')).scan(pattern) }.tally
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.attach(result, document, baseline, manifest, directory)
|
|
23
|
+
scope = manifest.fetch('settings').fetch('scope', 'prose')
|
|
24
|
+
old_units = units(baseline, scope).group_by { |entry| entry.fetch('file') }
|
|
25
|
+
new_units = units(document.to_h, scope).group_by { |entry| entry.fetch('file') }
|
|
26
|
+
changes = (old_units.keys | new_units.keys).filter_map do |path|
|
|
27
|
+
before = old_units.fetch(path, [])
|
|
28
|
+
after = new_units.fetch(path, [])
|
|
29
|
+
next if before.map { |e| e['text'] } == after.map { |e| e['text'] }
|
|
30
|
+
|
|
31
|
+
candidates = MARKERS.filter_map do |kind, pattern|
|
|
32
|
+
old_markers = inventory(before, pattern)
|
|
33
|
+
new_markers = inventory(after, pattern)
|
|
34
|
+
next if old_markers == new_markers
|
|
35
|
+
{ 'kind' => kind, 'before' => old_markers, 'after' => new_markers }
|
|
36
|
+
end
|
|
37
|
+
excerpt = ->(entries) { entries.map { |e| e.slice('line', 'end_line', 'text') } }
|
|
38
|
+
{ 'file' => path, 'before' => excerpt.call(before), 'after' => excerpt.call(after),
|
|
39
|
+
'review_candidates' => candidates }
|
|
40
|
+
end
|
|
41
|
+
result['japanese_change_review'] = {
|
|
42
|
+
'changes' => changes,
|
|
43
|
+
'limitations' => 'File-level selected-text inventories, not aligned sentence pairs or semantic analysis. Actor/topic cues are lexical and do not identify grammatical roles. Inspect all changes even without candidates; unchanged counts can hide changes. Protected and excluded text is outside this comparison.'
|
|
44
|
+
}
|
|
45
|
+
implementation = (Dir[File.join(__dir__, '*.rb')] + [File.expand_path('../asciidoc_pubkit.rb', __dir__)]).sort.map { |path| [File.basename(path), Digest::SHA256.file(path).hexdigest] }
|
|
46
|
+
result['verification_record'] = {
|
|
47
|
+
'format' => 'pubkit-ja-verification-v1', 'tool_version' => VERSION,
|
|
48
|
+
'implementation_sha256' => AsciidocPubkit.hash_text(JSON.generate(implementation)),
|
|
49
|
+
'manifest_sha256' => Digest::SHA256.file(File.join(directory, 'manifest.json')).hexdigest,
|
|
50
|
+
'sources' => document.sources.to_h { |path, content| [path, AsciidocPubkit.hash_text(content)] }
|
|
51
|
+
}
|
|
52
|
+
result
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def self.read_report(path)
|
|
56
|
+
report = JSON.parse(AsciidocPubkit.read_text(path))
|
|
57
|
+
record = report.is_a?(Hash) && report['verification_record']
|
|
58
|
+
valid = record.is_a?(Hash) && record['format'] == 'pubkit-ja-verification-v1' &&
|
|
59
|
+
record['tool_version'].is_a?(String) &&
|
|
60
|
+
%w[implementation_sha256 manifest_sha256].all? { |key| record[key].is_a?(String) && record[key].match?(/\A[0-9a-f]{64}\z/) } &&
|
|
61
|
+
record['sources'].is_a?(Hash) && !record['sources'].empty? &&
|
|
62
|
+
record['sources'].all? { |key, value| key.is_a?(String) && value.is_a?(String) && value.match?(/\A[0-9a-f]{64}\z/) } &&
|
|
63
|
+
report['passed'] == true && report['meaning_verified'] == false && report['issues'] == []
|
|
64
|
+
raise Error, 'Expected a successful Japanese verification report with a verification record.' unless valid
|
|
65
|
+
record
|
|
66
|
+
rescue JSON::ParserError => e
|
|
67
|
+
raise Error, "Invalid checked report: #{e.message}"
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -273,7 +273,21 @@ module AsciidocPubkit
|
|
|
273
273
|
instructions
|
|
274
274
|
end
|
|
275
275
|
|
|
276
|
-
def verify
|
|
276
|
+
def verify(checked_report: nil)
|
|
277
|
+
if checked_report && language != 'ja'
|
|
278
|
+
raise Error, '--checked-report supports Japanese sessions only.'
|
|
279
|
+
end
|
|
280
|
+
recorded = JapaneseVerification.read_report(checked_report) if checked_report
|
|
281
|
+
result = verify_current
|
|
282
|
+
if recorded && result['verification_record'] != recorded
|
|
283
|
+
result['issues'] << { 'kind' => 'checked-report-stale',
|
|
284
|
+
'message' => 'The checked report does not match the current sources, session or implementation. Save a new verification report and review it.' }
|
|
285
|
+
result['passed'] = false
|
|
286
|
+
end
|
|
287
|
+
result
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
def verify_current
|
|
277
291
|
document = Document.new(@manifest.fetch('entry'), @manifest.fetch('settings'), only: @manifest['only'])
|
|
278
292
|
issues = []
|
|
279
293
|
document.diagnostics.each { |d| issues << { 'kind' => 'parse-diagnostic', 'message' => d['message'] } }
|
|
@@ -303,11 +317,13 @@ module AsciidocPubkit
|
|
|
303
317
|
if analysis != @manifest['analysis']
|
|
304
318
|
issues << { 'kind' => 'analyzer-changed', 'message' => 'The analysis engine, version, dictionary or configuration changed. Finish verification with the original analyzer or start a new review pass.' }
|
|
305
319
|
end
|
|
306
|
-
{
|
|
320
|
+
result = {
|
|
307
321
|
'passed' => issues.empty?, 'meaning_verified' => false, 'changed_files' => changed,
|
|
308
322
|
'issues' => issues, 'notices' => notices, 'coverage' => document.coverage,
|
|
309
323
|
'analysis' => analysis, 'findings' => self.class.scan_candidates(document, @manifest['settings'], tokenizer)
|
|
310
324
|
}
|
|
325
|
+
JapaneseVerification.attach(result, document, @document, @manifest, @directory) if language == 'ja'
|
|
326
|
+
result
|
|
311
327
|
rescue Error, Errno::ENOENT => e
|
|
312
328
|
{ 'passed' => false, 'meaning_verified' => false, 'issues' => [{ 'kind' => 'verification-error', 'message' => e.message }],
|
|
313
329
|
'notices' => [], 'findings' => [], 'coverage' => [] }
|
|
@@ -454,7 +470,7 @@ module AsciidocPubkit
|
|
|
454
470
|
end
|
|
455
471
|
|
|
456
472
|
def review_process(unit, mode)
|
|
457
|
-
<<~TEXT
|
|
473
|
+
text = <<~TEXT
|
|
458
474
|
## Review decisions and completion
|
|
459
475
|
|
|
460
476
|
Keep manifest.json, document.json, findings.json, and every baseline/ snapshot immutable. Restrict editing and formatting tools to the authorized source spans; never run them over the session directory.
|
|
@@ -472,6 +488,12 @@ module AsciidocPubkit
|
|
|
472
488
|
Check related tables, figures and alternative text when terminology changes affect them. Report updates outside this session's edit scope separately; this prompt does not authorize those edits. Preserve the original baseline and phase-end verification when separately authorized synchronization follows.
|
|
473
489
|
Mechanical verification does not read or validate these decision records. Its passed result and candidate counts do not establish review completion or writing quality; meaning_verified remains false. Do not claim semantic correctness from those checks.
|
|
474
490
|
TEXT
|
|
491
|
+
if language == 'ja' && mode == 'revise'
|
|
492
|
+
text += <<~TEXT
|
|
493
|
+
For Japanese sessions, save completion verification with --output to a new report file. Read japanese_change_review before reporting completion: compare all before/after selected text, including changes without lexical review candidates. These file-level inventories do not align sentences or certify meaning. Immediately before delivery, run review verify with this session and --checked-report pointing to that saved report. If any source changes, save and inspect a new report, then repeat the comparison. Do not edit sources after the final comparison. Record execution status, lexical candidates, and human or model quality judgments separately; the report is not proof of approval or semantic review.
|
|
494
|
+
TEXT
|
|
495
|
+
end
|
|
496
|
+
text
|
|
475
497
|
end
|
|
476
498
|
|
|
477
499
|
def prompt_data(data, language)
|
data/lib/asciidoc_pubkit.rb
CHANGED
|
@@ -9,7 +9,7 @@ require 'pathname'
|
|
|
9
9
|
require 'optparse'
|
|
10
10
|
|
|
11
11
|
module AsciidocPubkit
|
|
12
|
-
VERSION = '1.
|
|
12
|
+
VERSION = '1.4.0'
|
|
13
13
|
class Error < StandardError; end
|
|
14
14
|
|
|
15
15
|
def self.hash_text(text)
|
|
@@ -33,10 +33,12 @@ require_relative 'asciidoc_pubkit/morphology'
|
|
|
33
33
|
require_relative 'asciidoc_pubkit/analysis'
|
|
34
34
|
require_relative 'asciidoc_pubkit/english'
|
|
35
35
|
require_relative 'asciidoc_pubkit/rules'
|
|
36
|
+
require_relative 'asciidoc_pubkit/japanese_verification'
|
|
36
37
|
require_relative 'asciidoc_pubkit/session'
|
|
37
38
|
require_relative 'asciidoc_pubkit/local_evaluator'
|
|
38
39
|
require_relative 'asciidoc_pubkit/score'
|
|
39
40
|
require_relative 'asciidoc_pubkit/replacement'
|
|
40
41
|
require_relative 'asciidoc_pubkit/document_commands'
|
|
41
42
|
require_relative 'asciidoc_pubkit/skill_commands'
|
|
43
|
+
require_relative 'asciidoc_pubkit/image_commands'
|
|
42
44
|
require_relative 'asciidoc_pubkit/cli'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: asciidoc-pubkit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- CyberGarage
|
|
@@ -37,11 +37,11 @@ dependencies:
|
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: '1.0'
|
|
40
|
-
description: Inspect
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
replacements.
|
|
40
|
+
description: Inspect document-referenced images and explicitly set source image display
|
|
41
|
+
widths, inspect AsciiDoc outlines, book metadata, and local cross-references, generate
|
|
42
|
+
English document-title indexes, and generate Japanese and English technical writing
|
|
43
|
+
prompts, review AsciiDoc prose, section headings, and list text separately, verify
|
|
44
|
+
protected manuscript content, and explicitly apply prose-only mechanical replacements.
|
|
45
45
|
executables:
|
|
46
46
|
- asciidoc-pubkit
|
|
47
47
|
extensions: []
|
|
@@ -70,6 +70,7 @@ files:
|
|
|
70
70
|
- docs/english-review-research.md
|
|
71
71
|
- docs/english-review.md
|
|
72
72
|
- docs/explanatory-guidance-research.md
|
|
73
|
+
- docs/image-commands.md
|
|
73
74
|
- docs/installation.md
|
|
74
75
|
- docs/list-review.md
|
|
75
76
|
- docs/outline-review.md
|
|
@@ -93,6 +94,8 @@ files:
|
|
|
93
94
|
- lib/asciidoc_pubkit/document_commands.rb
|
|
94
95
|
- lib/asciidoc_pubkit/english.rb
|
|
95
96
|
- lib/asciidoc_pubkit/heading_rules.rb
|
|
97
|
+
- lib/asciidoc_pubkit/image_commands.rb
|
|
98
|
+
- lib/asciidoc_pubkit/japanese_verification.rb
|
|
96
99
|
- lib/asciidoc_pubkit/language.rb
|
|
97
100
|
- lib/asciidoc_pubkit/local_evaluator.rb
|
|
98
101
|
- lib/asciidoc_pubkit/morphology.rb
|
|
@@ -124,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
124
127
|
- !ruby/object:Gem::Version
|
|
125
128
|
version: '0'
|
|
126
129
|
requirements: []
|
|
127
|
-
rubygems_version: 4.0.
|
|
130
|
+
rubygems_version: 4.0.23
|
|
128
131
|
specification_version: 4
|
|
129
132
|
summary: Document inspection, replacement, and Japanese/English review tools for AsciiDoc
|
|
130
133
|
books
|