asciidoc-pubkit 1.3.0 → 1.3.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: 76657216ce0978c381ceed09efd606ad78449339d0fe5953ce08e6e8ba05c815
4
- data.tar.gz: de0607fd98535903b60eb9c2c18231bd9980281ebd0e57c4ee54d02efe45d6ea
3
+ metadata.gz: 148f636e2309b6173633bb000abea658bb7b2cc84cddfa63abbd676a64f0791e
4
+ data.tar.gz: 634fb3097253f50e28f9aa598b3d5fb472e4c177e2fd93965ff7eaebf23fb62d
5
5
  SHA512:
6
- metadata.gz: f16857753f4fbf879325bf1b44c8672d7aabf940b3b1e50a1e92b5888b9df23834a52090c833d6df7b02886e60458c33847a182dbc18e4bdeaec659afe6484d1
7
- data.tar.gz: 898fc0880b37e800a63cf921d522d8c56b98eccf710263a5e350677bc1b798b547f1f029d94c79c977f7fca73bf4810b09dd810bfcff389314ea60392858047e
6
+ metadata.gz: ca576e28ef67eb5c0714987cea20100d1aed265c90ffe6219fe172a48d7ff95f32401de47dcedebea2de9a2e2ee30d37e4e785ecd02c77c00f36ed1e6739d934
7
+ data.tar.gz: 882632de7ea08f59a53c07cc71134404a86d145caeb136e3b313dea58c0866c0f07610986db868701db806f551d830002506294af15872b7a5c96a14546599d1
data/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 1.3.1 - 2026-10-17
6
+
7
+ - Add Japanese-only selected-text before/after inventories and advisory lexical
8
+ negation, condition, certainty, capability and actor/topic change candidates
9
+ to verification. Save source/session/implementation fingerprints and compare
10
+ a successful saved report using `review verify --checked-report FILE`.
11
+ Stale records fail verification; lexical candidates do not. Preserve English
12
+ output, score formulas, baselines and `meaning_verified: false`.
13
+ - Add Japanese revision-comparison and explanation/procedure/warning guidance,
14
+ plus final-report comparison instructions for Japanese revision prompts.
15
+ Regression tests check implementation and prompt delivery; no AI editing
16
+ quality improvement or independent semantic validation is claimed.
17
+ - Sessions require their exact creating tool version. Preserve ongoing 1.3.0
18
+ baselines with 1.3.0 and create separate sessions for 1.3.1.
19
+
5
20
  ## 1.3.0 - 2026-10-17
6
21
 
7
22
  - Add 120 original English regression paragraphs split by document, exact span
data/README.md CHANGED
@@ -16,7 +16,7 @@ and books on health, exercise, and sports science published under
16
16
  The experience informs the toolkit's writing criteria, contextual review prompts,
17
17
  and checks for preserving manuscript content during revision.
18
18
 
19
- Version 1.3.0 provides document inspection, explicit prose-only mechanical
19
+ Version 1.3.1 provides document inspection, explicit prose-only mechanical
20
20
  replacements, and Japanese and English manuscript review. Inspect a book's outline,
21
21
  metadata, and local cross-references; preview and apply your replacement rules;
22
22
  then review and verify edits against a saved baseline.
@@ -51,7 +51,7 @@ is added.
51
51
 
52
52
  ## Available features
53
53
 
54
- The following commands are available in version 1.3.0.
54
+ The following commands are available in version 1.3.1.
55
55
 
56
56
  | Feature | Commands | Behavior |
57
57
  | --- | --- | --- |
@@ -70,6 +70,12 @@ The following commands are available in version 1.3.0.
70
70
  | [Writing criteria and prompts](docs/writing.md#writing-commands) | `writing criteria`, `writing prompt` | Print Japanese prose criteria or generate a writing prompt without a manuscript or MeCab |
71
71
  | [Skill registration](docs/skill-commands.md) | `skill list`, `skill install`, `skill status`, `skill upgrade` | Register bundled skills for Codex or Claude and inspect or upgrade managed copies while protecting local changes |
72
72
 
73
+ Version 1.3.1: Japanese verification also shows selected text before/after edits
74
+ and advisory lexical change candidates. Save a report with `--output`, inspect
75
+ the changes, then use `--checked-report FILE` to detect subsequent source,
76
+ session or implementation changes. English behavior and scoring are unchanged.
77
+ See [Japanese verification records](docs/review-workflow.md#japanese-change-review-and-final-source-records-131).
78
+
73
79
  The 1.2.0 [sentence-ending guidance](docs/writing.md#writing-commands)
74
80
  adds contextual revision and keep examples, preserving capabilities, uncertainty,
75
81
  comparison strength, and body sentences separately from heading form. It adds
@@ -215,7 +221,7 @@ asciidoc-pubkit writing prompt --lang ja --output writing-prompt.md
215
221
 
216
222
  Existing review sessions require the exact tool version that created them.
217
223
  Before upgrading, finish ongoing reviews with that version or preserve their
218
- baselines and start a new review in a separate directory with v1.3.0. A new
224
+ baselines and start a new review in a separate directory with v1.3.1. A new
219
225
  scan cannot verify preservation relative to an earlier baseline.
220
226
 
221
227
  ## Documentation
@@ -27,11 +27,37 @@
27
27
  - Remove generated-prose patterns without flattening the meaning
28
28
  - Preserve exact technical terminology
29
29
  - Revise the complete paragraph
30
+ - Compare revisions before delivery and respect passage roles
30
31
  - Headings and the relation to figures and code
31
32
 
32
33
  Apply these criteria in context. They identify patterns that deserve inspection,
33
34
  not words that must always be removed.
34
35
 
36
+ ## Compare revisions before delivery and respect passage roles
37
+
38
+ For each proposed revision, compare the topic and claim, affirmation and negation,
39
+ actor and recipient, scope and conditions, certainty and capability, and quantities,
40
+ names and timing with the original and supported context. Include relative weight,
41
+ units, per-item versus aggregate limits, and completed versus planned actions.
42
+ If a comparison fails, reject that alternative; consider a faithful alternative
43
+ or retain the original with a passage-specific reason. Deletion must retain any
44
+ unique claim or condition elsewhere in the authorized scope. Evidence-backed
45
+ factual corrections require separate author authorization and an explicit source;
46
+ do not silently treat them as stylistic revisions.
47
+
48
+ Identify each passage's role from its content. Explanations describe actual
49
+ behavior; procedures may repeat imperative endings and numbered steps; warnings
50
+ retain prohibition and requirement strength. Do not remove necessary repetition,
51
+ merge distinct steps, or soften warnings merely to vary style. Document genre
52
+ alone does not establish the actor, authority, or required sentence ending.
53
+
54
+ Inspect all edited passages against the original, including edits with no
55
+ detector candidates. Lexical counts can stay unchanged despite a reversed
56
+ condition, exchanged actors, or an invented fact. Keep automatic preservation,
57
+ execution of the final checks, and editorial judgments separate. If supporting
58
+ material suggests a missing fact, report the proposed addition with its exact
59
+ source and scope; do not insert it as part of an unrequested prose correction.
60
+
35
61
  ## Start with the paragraph's technical purpose
36
62
 
37
63
  Before rewriting sentences, summarize each paragraph in one sentence:
@@ -1,5 +1,31 @@
1
1
  # Prose evaluation
2
2
 
3
+ ## Japanese verification workflow evaluation (1.3.1)
4
+
5
+ Japanese change-review regressions check that edits are visible without lexical
6
+ candidates, split paragraphs are not falsely paired, protected text is masked
7
+ for cues, scope boundaries remain intact, and saved verification records detect
8
+ later source/session/implementation changes. Real MeCab tests and literal-mode
9
+ tests have different coverage. They do not measure editorial improvement.
10
+
11
+ For a future explicitly authorized model trial, retain the actual source and
12
+ revision, saved session and final verification report, criteria/implementation
13
+ identities, exact model/host configuration and raw tool execution records.
14
+ Measure separately (1) whether required checks ran on the delivered source,
15
+ (2) candidate detection against independently annotated changed passages, and
16
+ (3) readability and fact retention judged from actual revisions. Include
17
+ actor additions, same-number scope changes, condition reversals and legitimate
18
+ procedure/warning repetitions, including changes without lexical cues. Compare
19
+ compatible configurations over repeated trials; adjudicate reviewer disagreements.
20
+ A fresh report, fewer candidates or a successful freshness comparison cannot
21
+ substitute for those judgments. No such model trial has been run for this change.
22
+
23
+ Design reference: [yomiyasu 2.0.1](https://github.com/nanaism/yomiyasu/tree/v2.0.1),
24
+ especially its final-source record, revision-comparison procedure and documented
25
+ limits. This implementation uses pubkit's own selected AsciiDoc scope and
26
+ preservation contracts; upstream performance and model-evaluation results are
27
+ not measurements of pubkit.
28
+
3
29
  ## Actor clarity comparisons (v1.2.3)
4
30
 
5
31
  Twelve additional calibration pairs cover conditional actor changes, user refusal
@@ -335,10 +335,55 @@ not read candidate decision records or certify editorial completion. A passing
335
335
  mechanical result must be reported separately from the reviewer's quality and
336
336
  completion assessment.
337
337
 
338
+ #### Japanese change review and final-source records (1.3.1)
339
+
340
+ Japanese sessions additionally return `japanese_change_review` before the final
341
+ `verification_record` in the JSON result. `changes` contains each changed file's
342
+ complete selected text before and after editing, with source lines on each side.
343
+ These are file-level inventories, not guessed paragraph or sentence pairs.
344
+ Prose, heading and list sessions retain their separate edit scopes. Unselected
345
+ and protected blocks are not included; inline protected tokens remain visible
346
+ in excerpts but are masked when collecting lexical cues.
347
+
348
+ Each changed file includes advisory `review_candidates` for changed inventories
349
+ of Japanese negation, condition, certainty, capability and actor/topic expressions.
350
+ `actor-topic` is a lexical cue around `は` and `が`, not grammatical subject/object
351
+ analysis. Inflections and paraphrases can be missed, legitimate rewrites can
352
+ produce candidates, and equal counts can hide changes between sentences. These
353
+ candidates do not change exit codes or certify meaning. Review all before/after
354
+ text, including changes without candidates. Numeric notices retain their existing
355
+ meaning. No score formula changes are included.
356
+
357
+ Save the completed check, inspect the change review, and compare the current
358
+ sources with that saved result immediately before delivery:
359
+
360
+ ```sh
361
+ asciidoc-pubkit review verify .pubkit/review --output verification-final.json
362
+ # Read the report and complete the editorial comparison before delivery.
363
+ asciidoc-pubkit review verify .pubkit/review --checked-report verification-final.json
364
+ ```
365
+
366
+ `--checked-report` accepts a successful Japanese report containing a
367
+ `pubkit-ja-verification-v1` record. It reruns preservation checks and compares
368
+ source hashes, the session manifest hash, tool version and Ruby implementation
369
+ fingerprint with the record. Changed sources, session or implementation produce
370
+ `checked-report-stale` and exit 1. A malformed, missing, unsuccessful or legacy
371
+ report, or use with an English session, is an input error (exit 2). The original
372
+ baseline is never reset. If sources change after checking, save a new report to
373
+ a new filename, inspect it and compare again. Do not edit after the final check.
374
+ The command never overwrites an existing output or checked report.
375
+
376
+ The record identifies the source content inspected by the checker. It is not
377
+ tamper-proof, a human approval record, proof that the report was read, or a
378
+ semantic review result. No timestamp or hook enforces delivery order. A report
379
+ can match an earlier identical source state; a newer scan cannot prove
380
+ preservation against a discarded baseline. English verification output is
381
+ unchanged. All results retain `meaning_verified: false`.
382
+
338
383
  | Exit code | Meaning |
339
384
  | --- | --- |
340
385
  | `0` | Command completed; verification found no mechanical violations |
341
- | `1` | Verification found protected-content, structure, source, or parsing issues |
386
+ | `1` | Verification found protected-content, structure, source, parsing, or checked-report freshness issues |
342
387
  | `2` | Invalid arguments, configuration, session, scan input, or output failure |
343
388
 
344
389
  [Back to README](../README.md)
@@ -97,6 +97,8 @@ module AsciidocPubkit
97
97
  elsif group == 'review' && command == 'prompt'
98
98
  opts.on('--mode MODE', 'revise (default) or diagnose') { |v| options[:mode] = v }
99
99
  opts.on('--view VIEW', 'full (default) or outline; outline requires a heading session') { |v| options[:view] = v }
100
+ elsif group == 'review' && command == 'verify'
101
+ opts.on('--checked-report FILE', 'Compare current Japanese sources and session with a saved successful verification report') { |v| options[:checked_report] = v }
100
102
  end
101
103
  opts.on('-h', '--help', 'Show command help') { options[:help] = true }
102
104
  end
@@ -168,7 +170,7 @@ module AsciidocPubkit
168
170
  output(session.prompt(options.fetch(:mode, 'revise'), view: options.fetch(:view, 'full')), options[:output], out)
169
171
  return 0
170
172
  end
171
- result = session.verify
173
+ result = session.verify(checked_report: options[:checked_report])
172
174
  output(JSON.pretty_generate(result) + "\n", options[:output], out)
173
175
  result['passed'] ? 0 : 1
174
176
  rescue Error, OptionParser::ParseError, SystemCallError, Psych::Exception, ArgumentError => e
@@ -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)
@@ -9,7 +9,7 @@ require 'pathname'
9
9
  require 'optparse'
10
10
 
11
11
  module AsciidocPubkit
12
- VERSION = '1.3.0'
12
+ VERSION = '1.3.1'
13
13
  class Error < StandardError; end
14
14
 
15
15
  def self.hash_text(text)
@@ -33,6 +33,7 @@ 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'
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.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - CyberGarage
@@ -93,6 +93,7 @@ files:
93
93
  - lib/asciidoc_pubkit/document_commands.rb
94
94
  - lib/asciidoc_pubkit/english.rb
95
95
  - lib/asciidoc_pubkit/heading_rules.rb
96
+ - lib/asciidoc_pubkit/japanese_verification.rb
96
97
  - lib/asciidoc_pubkit/language.rb
97
98
  - lib/asciidoc_pubkit/local_evaluator.rb
98
99
  - lib/asciidoc_pubkit/morphology.rb