asciidoc-pubkit 0.6.2 → 0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ce6fe84fae75593d9444c1db5d7abb1f6c96823b77376f90750d9554358af76
4
- data.tar.gz: 924c12f91b714b34c1883c5a0583259d2c97989a328d412e6648d681de01984c
3
+ metadata.gz: 5e6439ccb97f49f7e31290cb8d60b1f361cf444889ac0631cdd1f9e28f8a0d9c
4
+ data.tar.gz: 484ff3e7ac4475ea693ff7d5751bc34e1537b66dda90bb7d425bb55acb467322
5
5
  SHA512:
6
- metadata.gz: b194a8c6af0423b90c41275a1287bf1bdf0b6edee930a27b99bf9cddcce15d8f348e4ea58b3008e2f0f2ef533c9b4a4d43cd74262d3cd01c00b051e96aead0ba
7
- data.tar.gz: ea6b5543a41d7f7d4780b3626f1e33797c55198d428f413295e9576894fc30e92b6ca890b7461382ac069612b7a48027250bcd8c6ef937bc59fd205bc5f58be6
6
+ metadata.gz: 9ccf0130e06770e7b12774385daab670fffde6a128e83af1d67300ada91ea6c15fc281645cfae6da6b7b009cca36d01429287ee36461c11f2d43c439d8307fe5
7
+ data.tar.gz: f70b717d0633729647ac733670604e3d6ace15354efc31167f8af8994b62531ddba1c74f6456c293ccf16bbee4833ddbd2efb655c520151edee6b6559d94ca0c
data/CHANGELOG.md CHANGED
@@ -1,6 +1,33 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 0.8.0 — 2026-10-01
4
+
5
+ - Add explicit `replace check`, `replace diff`, and `replace apply` commands for
6
+ mapped running prose using a strict subset of prh-format YAML rules. Protect
7
+ blocks and recognized inline spans, reject overlapping edits, test rule specs,
8
+ and validate staged sources before applying replacements without MeCab or AI.
9
+
10
+ ## 0.6.3 — 2026-10-01
11
+
12
+ - Summarize review and scoring features at the start of the README architecture
13
+ section, including AsciiDoc parsing, separate scopes, source-aligned static
14
+ analysis, Japanese morphology, contextual prompts and baseline verification.
15
+
16
+ - Add separate `review scan --scope headings` sessions with packaged heading
17
+ criteria and strict custom heading rules. Keep prose as the default and
18
+ scoring scope; supply the full outline and read-only body evidence in one
19
+ prompt without invoking an AI CLI. Accept mixed heading forms and leave
20
+ section-role and body-agreement judgments to the reviewer.
21
+ - Permit mapped plain ATX section title edits in heading sessions while
22
+ protecting body text, structure and section IDs. Report unsupported title
23
+ mapping, retain stale-source and artifact checks, and require fresh sessions
24
+ for schema 2. Generated section ID changes fail mechanical verification.
25
+ Use separate default output directories for prose and heading sessions and
26
+ protect physical titles reused by multiple includes.
27
+
28
+ - Introduce the review and scoring concepts before the architecture diagrams,
29
+ with a table linking prose principles, implementation mechanisms, and their
30
+ source files. Distinguish prompt guidance from mechanical guarantees.
4
31
 
5
32
  ## 0.6.2 — 2026-10-01
6
33
 
@@ -40,6 +67,8 @@
40
67
 
41
68
  ## 0.6.0 — 2026-09-30
42
69
 
70
+ Initial public release, including the earlier development work.
71
+
43
72
  - Add `writing criteria` and `writing prompt` commands backed by one packaged
44
73
  Japanese technical prose guide. Include that guide in saved review prompts.
45
74
  - Organize the CLI into `writing` and `review` groups and accept `--lang ja` on
@@ -49,8 +78,6 @@
49
78
  - Refine Japanese review questions for redundant qualifications and generic
50
79
  recaps, and document the editorial sources and contextual limits.
51
80
 
52
- ## 0.1.3 — 2026-09-29
53
-
54
81
  - Consolidate Japanese review candidates for terminology, compressed noun
55
82
  relationships, operations, and negative qualifications in the packaged rules.
56
83
  - Suppress literal candidates contained in longer matched terms, preserving
@@ -61,16 +88,11 @@
61
88
  - Add `review scan --yes` (`-y`) and `--no-input` for batch execution.
62
89
  - Preserve previous sessions until replacement scan artifacts are ready.
63
90
 
64
- ## 0.1.2 — Released
65
-
66
91
  - Package default Japanese review rules as a validated UTF-8 YAML file.
67
92
  - Support custom rule files through `review scan --rules` and `review.rules`.
68
93
  - Save resolved rules in sessions for reproducible prompts and verification.
69
94
  - Add concept, distinction, and negative meaning review candidates.
70
95
  - Add a Make target for running a local checkout with arbitrary CLI arguments.
71
- - Require a new review session when upgrading from earlier tool versions.
72
-
73
- ## 0.1.1 — Released
74
96
 
75
97
  - Add contextual phrases, compound nouns, and potential and causative verb forms.
76
98
  - Add requested abstract nouns, degree adjectives, and vague predicates.
@@ -79,9 +101,6 @@
79
101
  - Record analyzer and dictionary fingerprints in review sessions.
80
102
  - Add an explicit literal mode for environments without MeCab.
81
103
  - Reject incompatible dictionaries and unavailable analyzers with setup guidance.
82
- - Require a new review session when upgrading from 0.1.0.
83
-
84
- ## 0.1.0 — Released
85
104
 
86
105
  - Add AsciiDoc running-prose extraction with checked source locations.
87
106
  - Add Japanese review candidates and configurable terminology checks.
data/README.md CHANGED
@@ -7,15 +7,21 @@
7
7
 
8
8
  A toolkit for authoring and reviewing AsciiDoc books.
9
9
 
10
- Version 0.6.2 provides shared Japanese technical writing criteria, an authoring
11
- prompt, contextual review prompts, manuscript scoring, and baseline verification
12
- for edited manuscripts.
10
+ Version 0.8.0 provides shared Japanese technical writing criteria, an authoring
11
+ prompt, separate prose and heading review prompts, manuscript scoring, and
12
+ baseline verification for edited manuscripts, plus explicit prose-only mechanical
13
+ replacements using a limited prh-format rule set.
13
14
  The CLI, diagnostics, documentation, and generated instructions are in English.
14
15
  Japanese text is retained in manuscript excerpts, rule dictionaries, and fixtures.
15
16
 
16
17
  ## Status
17
18
 
18
- The CLI does not automatically rewrite manuscripts or publish books. EPUB, image,
19
+ Version 0.6.3 adds separate heading review with `review scan --scope headings`.
20
+ See [Heading review](#heading-review).
21
+
22
+ Version 0.8.0 adds explicit prose replacements with `replace apply`;
23
+ see [Prose replacements](#prose-replacements). Review and scoring do not edit
24
+ manuscripts. The CLI does not publish books. EPUB, image,
19
25
  and book scaffolding commands are planned extensions, not available features.
20
26
 
21
27
  Ruby 3.2 or later is required. Asciidoctor is installed as a gem dependency.
@@ -30,7 +36,7 @@ configured model provider. No scoring mode edits manuscripts.
30
36
 
31
37
  Version 0.1.1 added morphological analysis. Version 0.1.0 used literal matching.
32
38
 
33
- The CLI has `writing` and `review` command groups. Both default to `--lang ja`.
39
+ The CLI has `writing`, `review`, and `replace` command groups. All default to `--lang ja`.
34
40
  Language-specific criteria live under `data/writing/<language>/`; review rules
35
41
  use `data/review-rules.<language>.yml`. Writing and review have separate lists
36
42
  of supported languages, so a future writing language need not imply review
@@ -80,7 +86,7 @@ Add the gem to your project's `Gemfile` to manage its version with Bundler:
80
86
 
81
87
  ```ruby
82
88
  source 'https://rubygems.org'
83
- gem 'asciidoc-pubkit', '~> 0.6.2'
89
+ gem 'asciidoc-pubkit', '~> 0.8.0'
84
90
  ```
85
91
 
86
92
  Then install dependencies and run the CLI through Bundler:
@@ -102,7 +108,7 @@ git clone https://github.com/cybergarage/asciidoc-pubkit.git
102
108
  cd asciidoc-pubkit
103
109
  bundle install
104
110
  gem build asciidoc-pubkit.gemspec
105
- gem install ./asciidoc-pubkit-0.6.2.gem
111
+ gem install ./asciidoc-pubkit-0.8.0.gem
106
112
  asciidoc-pubkit --version
107
113
  ```
108
114
 
@@ -126,7 +132,7 @@ asciidoc-pubkit writing prompt --lang ja --output writing-prompt.md
126
132
  ```
127
133
 
128
134
  For example, `--lang en` exits with an unsupported-language error. No English
129
- review or writing criteria are shipped in 0.6.2.
135
+ review or writing criteria are shipped in 0.8.0.
130
136
 
131
137
  For a small trial, use `examples/book.adoc` as the scan input. Its Japanese
132
138
  paragraphs deliberately contain review candidates; its code block must remain
@@ -196,7 +202,7 @@ Use `ARGS` instead of `make review scan book.adoc`: Make interprets positional
196
202
  words as build targets, not CLI arguments. Avoid `make -C` when manuscript paths
197
203
  should remain relative to the current directory, because it changes directories.
198
204
 
199
- ## Install the morphological analyzer (0.1.1 and later)
205
+ ## Install the morphological analyzer
200
206
 
201
207
  On macOS with Homebrew:
202
208
 
@@ -298,6 +304,91 @@ session after moving a project. Keep `.pubkit/` and generated prompts out of Git
298
304
  when they contain private manuscript material. Rule settings and glossary contents
299
305
  are frozen into the session; scan again after changing them.
300
306
 
307
+ ### Heading review
308
+
309
+ Review headings and prose in separate sessions. The default scan scope remains
310
+ `prose`; `--scope headings` selects section titles. There is no combined scope.
311
+ Default output directories are `.pubkit/review` for prose and `.pubkit/headings`
312
+ for headings, so separate scans do not replace each other by default.
313
+ The scope is saved at scan time; `prompt` and `verify` use that saved scope.
314
+ Neither scan nor prompt invokes an AI CLI or edits a manuscript. Give the generated
315
+ prompt to your reviewer separately.
316
+
317
+ ```sh
318
+ asciidoc-pubkit review scan book.adoc --scope headings --output .pubkit/headings
319
+ asciidoc-pubkit review prompt .pubkit/headings --mode diagnose --output headings-diagnosis.md
320
+ # Generate a revision prompt when ready to edit:
321
+ asciidoc-pubkit review prompt .pubkit/headings --mode revise --output headings-review.md
322
+ # After the external review and edits:
323
+ asciidoc-pubkit review verify .pubkit/headings
324
+
325
+ # Establish a fresh prose baseline after finishing heading edits:
326
+ asciidoc-pubkit review scan book.adoc --scope prose --output .pubkit/prose
327
+ asciidoc-pubkit review prompt .pubkit/prose --output prose-review.md
328
+ asciidoc-pubkit review verify .pubkit/prose
329
+ ```
330
+
331
+ Heading prompts contain the full parsed section outline, selected headings and
332
+ all selected source-mapped prose paragraphs once as read-only evidence. They
333
+ compare parents, siblings, descendants and the corresponding body. Body content
334
+ outside prose coverage is not supplied; insufficient evidence must be recorded
335
+ as `needs-evidence`. `--only` and `review.exclude` select editable headings and
336
+ body evidence while retaining the full outline as context. All excerpts are data,
337
+ never executable reviewer instructions. Both criteria files and resolved rules
338
+ are frozen in the session.
339
+
340
+ Default heading rules accept term labels, noun phrases, questions, action
341
+ phrases, principles, conclusions and learning directions. They flag limited
342
+ promotional/vague phrases, glossary variants and identical sibling titles as
343
+ review candidates. They do not apply prose weak-predicate or sentence-ending
344
+ rules, require nominalization, or impose a character limit. Role and body
345
+ agreement are contextual reviewer judgments, not mechanically proven findings.
346
+
347
+ Only plain ATX section titles whose source cursor and original title match are
348
+ editable. Document titles, old-style underlined headings, attribute-expanded
349
+ and converted inline titles and physical title lines reused by multiple includes remain protected.
350
+ Unresolved section titles receive coverage notices. Verification permits only selected title text changes while
351
+ protecting the body, title markers, hierarchy, order, section IDs, references,
352
+ attributes, includes and other protected content. A title-derived section ID
353
+ change fails verification. Establish stable explicit IDs before scanning when
354
+ needed; this tool does not add IDs or migrate references. Numeric title changes
355
+ are manual-review notices, and remaining candidates do not fail verification.
356
+ `meaning_verified` remains `false`.
357
+
358
+ The session schema is now 2. Earlier sessions must be recreated; preserve or
359
+ finish an ongoing review with its original tool before establishing a new baseline.
360
+ `review score` continues to support prose only and rejects `--scope`.
361
+
362
+ Heading rules use `--heading-rules FILE`, then configuration
363
+ `review.heading_rules`, then `data/heading-rules.ja.yml`. A custom file replaces
364
+ the entire heading rule set. Each scan loads only the rules for its selected
365
+ scope; an unavailable rule file for the other scope does not prevent it.
366
+ `--heading-rules` requires `--scope headings`;
367
+ prose `--rules` and `--style` cannot be passed to a heading scan.
368
+
369
+ ```yaml
370
+ schema_version: 1
371
+ terms:
372
+ book-heading-cue:
373
+ terms: [シームレス]
374
+ question: 'Check the claimed behavior against the section evidence.'
375
+ fixed_titles: [はじめに, 参考文献, まとめ]
376
+ duplicate_siblings: true
377
+ style: mixed
378
+ ```
379
+
380
+ All five keys are required; unknown keys, invalid types and YAML aliases are
381
+ rejected. `terms` maps nonempty rule names to exactly `terms` (unique nonempty
382
+ strings) and `question` (nonempty English guidance). `fixed_titles` contains
383
+ unique nonempty titles exempt from mechanical candidates; it does not expand
384
+ the edit scope or prove correctness. `duplicate_siblings` is boolean. `style`
385
+ is `mixed` (default), `nominal`, or `action`; explicit preferences generate
386
+ advisory ending cues rather than a complete grammatical classification. Keep
387
+ questions, principles and justified exceptions. Heading phrase and glossary
388
+ matches respect exact `review.allows` entries, protected inline masking and
389
+ one-based Unicode source columns. MeCab remains the default; only explicit
390
+ `--tokenizer literal` disables it.
391
+
301
392
  ### Prompt
302
393
 
303
394
  ```sh
@@ -334,7 +425,7 @@ An omitted `:lang:` attribute uses the selected review language.
334
425
  asciidoc-pubkit review verify .pubkit/review
335
426
  ```
336
427
 
337
- Verification compares the current source set, document structure, content outside
428
+ For prose sessions, verification compares the current source set, document structure, content outside
338
429
  reviewed paragraphs, and recognized protected inline tokens with the baseline.
339
430
  It reports remaining candidates and numeric changes separately. Existing candidates
340
431
  do not make verification fail. Numeric changes require manual review but do not
@@ -354,6 +445,86 @@ or release readiness: `meaning_verified` is always `false`.
354
445
 
355
446
  ## How review and scoring work
356
447
 
448
+ ### Features
449
+
450
+ - **Structure-aware AsciiDoc parsing.** Asciidoctor parses local includes,
451
+ conditionals, attributes and section hierarchy before review targets are
452
+ selected. Prose selection distinguishes paragraphs from lists, tables,
453
+ quotations and code blocks; supported inline constructs are masked rather
454
+ than treated as ordinary prose.
455
+ - **Separate heading and prose review.** Each scan selects one
456
+ scope with its own rules, prompt and edit permissions. Heading review uses
457
+ the outline and body as context while protecting body text; prose review
458
+ protects headings. Mixed heading forms are accepted by default. See
459
+ [Heading review](#heading-review).
460
+ - **Source-aligned static analysis.** Candidates identify the original source
461
+ file, line and one-based Unicode column, with a rule ID and review question.
462
+ Source text is checked against parser locations; unresolved mappings produce
463
+ coverage notices instead of guessed edit targets. Matches locate passages
464
+ for review, not proven defects.
465
+ - **Japanese morphological analysis.** MeCab with UTF-8 IPADIC recognizes
466
+ configured inflected predicates and adjectives, retaining original surfaces,
467
+ dictionary forms and negative-form information in morphological prose
468
+ findings. Literal matching is available only through explicit selection.
469
+ - **Contextual review in one prompt.** A single Markdown file carries saved
470
+ criteria, settings, candidates and manuscript evidence. All selected prose
471
+ paragraphs appear once, including those without candidates, with heading and
472
+ neighboring context. The reviewer records decisions and checks meaning;
473
+ generating the prompt does not edit the manuscript or invoke a model.
474
+ - **Book-specific rules and terminology.** Strict YAML rule sets, a glossary,
475
+ allow lists and exclusions adapt candidate detection to the manuscript.
476
+ Heading rules can express a book's preferred form while allowing justified
477
+ exceptions. Resolved rules and criteria are saved with each session.
478
+ - **Baseline-based preservation checks.** Source snapshots and artifact hashes
479
+ make the review baseline reproducible and detect stale or altered evidence.
480
+ Verification checks protected content, source membership, structure and
481
+ analyzer identity after external edits. It keeps `meaning_verified: false`;
482
+ semantic correctness remains a review judgment.
483
+ - **Local analysis and distinct scoring paths.** Default analysis runs locally
484
+ without a model call. Prose scoring reports candidate density; explicit
485
+ `review score --agent` optionally invokes an installed Codex or Claude CLI
486
+ for readability ratings. Candidate density, model judgments and development
487
+ benchmark accuracy remain separate measures.
488
+
489
+ ### Concept
490
+
491
+ The goal is Japanese technical prose that readers can understand, use, and
492
+ verify, with claims bounded by evidence and technical meaning preserved.
493
+ Clarity includes a paragraph's purpose, concrete operations and referents,
494
+ actors and objects, conditions and consequences, logical connections, and its
495
+ relationship to headings, figures, tables, and code. "Who does what" is one
496
+ part of that goal. Clear prose also retains precise terminology, necessary
497
+ negation, uncertainty, and implementation constraints.
498
+
499
+ The toolkit supports that goal through shared writing criteria, contextual
500
+ review prompts, source-aligned candidate detection, baseline verification,
501
+ and distinct scoring and development evaluation paths. Mechanical rules locate
502
+ passages to inspect; the reviewer judges their meaning from context and source
503
+ evidence. The writing and review prompts guide a human or external agent in
504
+ planning and revising complete paragraphs. They do not automatically reconstruct
505
+ subjects and objects or rewrite manuscripts. Model-based readability evaluation
506
+ is available only through explicit `review score --agent`.
507
+
508
+ The table identifies both implemented mechanisms and guidance carried by the
509
+ prompts. A criterion in a prompt is a review instruction, not a guarantee that
510
+ the code can detect or verify it.
511
+
512
+ | Supported principle or behavior | How it is realized | Implementation or criteria |
513
+ | --- | --- | --- |
514
+ | Write for a technical purpose and the reader's decisions | Shared criteria ask what a paragraph explains and what an engineer can decide or verify; writing prompts include those criteria | [Paragraph purpose](data/writing/ja/criteria.md#start-with-the-paragraphs-technical-purpose), [Writing](lib/asciidoc_pubkit/writing.rb) |
515
+ | Make actors, objects, actions, conditions, and results recoverable | Review instructions ask the reviewer to resolve omitted elements from context, while allowing unambiguous omission | [Paragraph revision](data/writing/ja/criteria.md#revise-the-complete-paragraph), [Review prompt](lib/asciidoc_pubkit/session.rb) |
516
+ | Replace vague abstraction, weak predicates, and metaphors with concrete explanations | Rules locate limited terms and inflected predicates; the criteria require identifying the actual referent, operation, policy, or effect before revising | [Concrete referents](data/writing/ja/criteria.md#replace-abstraction-with-the-thing-being-discussed), [Metaphor criteria](data/writing/ja/criteria.md#explain-metaphorical-operations-from-evidence), [Rules](lib/asciidoc_pubkit/rules.rb) |
517
+ | Distinguish reader instructions, actual behavior, and available capabilities | The shared criteria preserve the difference between requests, automatic execution, and optional operations | [Instructions, behavior, and capabilities](data/writing/ja/criteria.md#distinguish-instructions-behavior-and-capabilities) |
518
+ | Connect claims into coherent paragraphs | Prompts include all selected paragraphs and neighboring context; criteria require explicit referents, comparisons, causal relationships, and complete paragraph revision | [Relationships](data/writing/ja/criteria.md#make-relationships-explicit), [Review prompt](lib/asciidoc_pubkit/session.rb) |
519
+ | Keep claims within their evidence and preserve meaning | Review guidance asks for implementation, test, or primary-source evidence and checks omissions and unsupported additions; unresolved facts remain unresolved | [Evidence and scope](data/writing/ja/criteria.md#keep-claims-within-their-evidence-and-purpose), [Paragraph revision](data/writing/ja/criteria.md#revise-the-complete-paragraph) |
520
+ | Preserve technical distinctions, terminology, and justified prose choices | Criteria protect identifiers, values, conditions, negation, and necessary repetition; glossary rules, allow lists, and contextual questions support project terminology | [Terminology](data/writing/ja/criteria.md#preserve-exact-technical-terminology), [Packaged rules](data/review-rules.ja.yml), [Settings](lib/asciidoc_pubkit/settings.rb) |
521
+ | Review generated-prose patterns without mechanical deletion | Framing, contextual phrases, style, and repeated-ending checks produce candidates; shared criteria reject fixed sentence-length targets and needless synonym changes | [Generated-prose patterns](data/writing/ja/criteria.md#remove-generated-prose-patterns-without-flattening-the-meaning), [Rules](lib/asciidoc_pubkit/rules.rb) |
522
+ | Keep headings, illustrations, tables, and code consistent with the explanation | Writing criteria address scope, comparisons, identifiers, and conceptual simplifications; review prompts constrain edits to the selected scope and protect other elements | [Headings, figures, and code](data/writing/ja/criteria.md#headings-and-the-relation-to-figures-and-code), [Review scope](lib/asciidoc_pubkit/session.rb) |
523
+ | Make detection traceable and coverage explicit | Asciidoctor source mapping, offset-preserving inline masking, and MeCab/IPADIC produce source-aligned evidence; ambiguous or excluded passages have coverage notices | [Document](lib/asciidoc_pubkit/document.rb), [Morphology](lib/asciidoc_pubkit/morphology.rb), [Rules](lib/asciidoc_pubkit/rules.rb) |
524
+ | Preserve a reproducible and safe review baseline | Sessions save source snapshots, resolved rules, criteria, and analyzer identity; integrity checks and verification protect content outside editable prose | [Session](lib/asciidoc_pubkit/session.rb), [Rule validation](lib/asciidoc_pubkit/rule_set.rb) |
525
+ | Keep manuscript indicators, readability judgments, and detector accuracy distinct | Default scoring measures candidate density; optional local CLI evaluation judges readability; annotated development benchmarks measure detection and evaluate preservation separately | [Score](lib/asciidoc_pubkit/score.rb), [Local evaluator](lib/asciidoc_pubkit/local_evaluator.rb), [Development benchmark](benchmark/prose.rb) |
526
+ | Make automation explicit and its limits visible | Default analysis runs locally with no model call; only explicit scoring requests invoke an external CLI. Manuscripts are not edited, and verification retains `meaning_verified: false` | [CLI](lib/asciidoc_pubkit/cli.rb), [Local evaluator](lib/asciidoc_pubkit/local_evaluator.rb), [Session](lib/asciidoc_pubkit/session.rb) |
527
+
357
528
  This section explains the implementation independently of command syntax.
358
529
  [Review workflow](#review-workflow) covers commands and session handling;
359
530
  [Score an AsciiDoc manuscript](#score-an-asciidoc-manuscript) covers scoring options.
@@ -547,6 +718,7 @@ review:
547
718
  language: ja
548
719
  style: desu-masu
549
720
  tokenizer: mecab
721
+ # heading_rules: heading-rules.yml # Separate heading rule set
550
722
  # Optional overrides (dictionary paths are relative to this file):
551
723
  # mecab_command: /opt/homebrew/bin/mecab
552
724
  # mecab_dictionary: /opt/homebrew/lib/mecab/dic/ipadic
@@ -581,6 +753,107 @@ Regex patterns are not interpreted in glossary or allow-list entries. Unknown
581
753
  configuration keys are rejected. A bare `mecab_command` is resolved through PATH;
582
754
  use an absolute path for an explicit executable override.
583
755
 
756
+ ## Prose replacements
757
+
758
+ Available starting with version 0.8.0.
759
+ It applies author-supplied mechanical replacement rules without MeCab or an AI
760
+ CLI. Review candidates and glossary variants remain advisory and are never
761
+ implicitly applied. Replacement rules are separate from review rules.
762
+
763
+ ```sh
764
+ asciidoc-pubkit replace check book.adoc --rules replacements.yml
765
+ asciidoc-pubkit replace diff book.adoc --rules replacements.yml
766
+ asciidoc-pubkit replace apply book.adoc --rules replacements.yml
767
+ ```
768
+
769
+ `check` reports original text, proposed text, rule IDs (`rule-1`, etc.), source
770
+ paths, one-based Unicode lines/columns, and a coverage-notice count. Its exit code
771
+ is 1 when replacements are available, 0 otherwise. `diff` previews unified diffs
772
+ without editing; it requires the external `diff` command. `apply` explicitly
773
+ authorizes source replacement without prompting. Successful diff/apply commands
774
+ return 0; invalid rules, conflicts, unsafe edits, and input/output failures return
775
+ 2. Check/diff accept `--output` for a new file only; apply rejects `--output`.
776
+
777
+ All three accept `--lang ja`, `--base-dir`, `--config`, and `--only` (an included
778
+ source file). Normal configuration discovery and `review.base_dir`, `language`,
779
+ `attributes`, and `exclude` control parsing and selection. `--rules` is required;
780
+ `review.rules` and glossary entries do not supply replacement rules. There are
781
+ no built-in replacement rules and no automatic search for `prh.yml`.
782
+
783
+ ### Limited prh-format rules
784
+
785
+ The supported format is a strict subset of [prh](https://github.com/prh/prh):
786
+
787
+ ```yaml
788
+ version: 1
789
+ rules:
790
+ - expected: '®'
791
+ pattern: '&reg;'
792
+ - expected: '($1)'
793
+ pattern: '/(([^()\r\n]+))/'
794
+ specs:
795
+ - from: '設定(任意)'
796
+ to: '設定(任意)'
797
+ - expected: '/'
798
+ patterns:
799
+ - '/'
800
+ ```
801
+
802
+ The root contains exactly `version: 1` and `rules`. Each rule requires a string
803
+ `expected` (empty strings permit deletion) and exactly one of `pattern` (a
804
+ nonempty string) or `patterns` (a nonempty array of nonempty strings). Optional
805
+ `specs` is an array of exact `from`/`to` string pairs, validated on load. Specs
806
+ exercise the rule on plain text, not AsciiDoc selection or inline protection.
807
+
808
+ Strings not beginning with `/` match literally. `/.../` denotes a regex with no
809
+ flags; all occurrences are collected. The implementation uses Ruby regexes with
810
+ a timeout and accepts a limited common syntax: character classes, ordinary
811
+ captures, noncapturing groups, lookarounds, alternatives, anchors, quantifiers,
812
+ and the escapes `\n`, `\r`, `\t`, `\d`, `\D`, `\s`, `\S`, `\w`, `\W`
813
+ and escaped punctuation. Ruby regex character-class behavior applies; this is
814
+ not a JavaScript regex engine or a promise of full prh equivalence. Engine-specific
815
+ groups/escapes and flags are rejected. A leading literal slash must be expressed
816
+ as an escaped regex, for example `/\//`. Zero-length matches are rejected.
817
+
818
+ Replacement strings support `$1` through `$99` for existing capture groups and
819
+ `$$` for a literal dollar sign. Unsupported dollar references are rejected when
820
+ matched. Missing optional captures expand to empty strings. YAML single quotes
821
+ are recommended to keep backslashes literal. Unknown fields, including `imports`,
822
+ `options`, and `regexpMustEmpty`, and omitted patterns are rejected rather than
823
+ ignored. Regex flags and prh's automatic pattern generation are not supported.
824
+
825
+ ### Selection and preservation
826
+
827
+ Only unambiguously source-mapped running prose in the existing default review
828
+ scope is eligible. Headings, lists, tables, quotations, listing/source, literal,
829
+ and passthrough blocks are excluded. Recognized inline code, quotations, URLs,
830
+ macros, and attribute references are protected by the existing conservative
831
+ inline heuristic, not a complete inline parser. A match overlapping any protected
832
+ span is skipped; matching is performed on the original text, never on blanked
833
+ placeholders. Backtick-to-bold and list-marker conversions are outside this scope.
834
+
835
+ Candidates are calculated once against the original sources; replacement results
836
+ are not searched again. Overlapping edits are conflicts, not resolved by rule
837
+ order. Matches/results containing line breaks are rejected. Source files retain
838
+ UTF-8 bytes, original line endings, and unrelated content; repeated include
839
+ occurrences must not create overlapping edits.
840
+
841
+ Before presenting a plan, the complete captured source set is copied to temporary
842
+ staging and reparsed. Parsing diagnostics, structural changes, new/deleted protected
843
+ inline tokens, and protected-content/source-membership changes reject the plan.
844
+ Relative includes within the base directory are supported. Absolute includes and
845
+ includes whose paths depend on the original filesystem may fail staged validation;
846
+ they are not rewritten or silently accepted. Symlink entrypoints are rejected.
847
+
848
+ Apply stages all changed files beside their destinations, checks all captured
849
+ source bytes against the plan, and renames the prepared files into place while
850
+ preserving permission bits. An ordinary installation error restores sources
851
+ already installed. This is not a crash-atomic transaction across multiple files;
852
+ keep manuscripts under version control and avoid concurrent edits during apply.
853
+ No review session is created or replaced. Existing sessions retain their original
854
+ baselines; applying replacements can make a session stale for prompt generation.
855
+ Mechanical validation does not establish semantic correctness.
856
+
584
857
  ## Rules and coverage
585
858
 
586
859
  | Rule | Severity | Purpose |
@@ -671,18 +944,18 @@ reports analyzer changes instead of treating results from different dictionaries
671
944
  as directly comparable. Prompt generation uses saved evidence and does not need
672
945
  MeCab. Changed rules or dictionary settings require a new scan.
673
946
 
674
- Sessions from earlier tool versions are not compatible with 0.6.2. Keep the original baseline for
947
+ Sessions from earlier tool versions are not compatible with 0.8.0 (session schema 2). Keep the original baseline for
675
948
  an ongoing review and finish it with the original version, or start a new review
676
949
  pass in a different directory:
677
950
 
678
951
  ```sh
679
- asciidoc-pubkit review scan book.adoc --output .pubkit/review-0.6.2
952
+ asciidoc-pubkit review scan book.adoc --output .pubkit/review-0.8.0
680
953
  ```
681
954
 
682
955
  Severity describes review priority, not proof of an error. There is no AI-authorship
683
956
  score and no requirement to eliminate every match.
684
957
 
685
- Only source-mapped running-prose paragraphs are reviewed. Headings, list items and
958
+ In the default prose scope, only source-mapped running-prose paragraphs are reviewed. Headings, list items and
686
959
  their continuations, tables, quotations, code, and passthrough blocks are excluded
687
960
  from prose review. Common inline literals, macros, attribute references, URLs, and
688
961
  Japanese quotation spans are masked. Complex inline syntax can exceed the masking
@@ -0,0 +1,23 @@
1
+ ---
2
+ schema_version: 1
3
+ terms:
4
+ heading-promotion:
5
+ terms:
6
+ - シームレス
7
+ - 最適
8
+ - 完全
9
+ - 究極
10
+ question: 'Check whether this evaluation or guarantee is supported by the section. Do not add stronger claims merely to polish a title; valid technical terms may be kept.'
11
+ heading-vague-topic:
12
+ terms:
13
+ - いろいろ
14
+ - さまざまなこと
15
+ question: 'Check whether the heading identifies the actual subject, operation or comparison. Use the section as evidence; do not invent missing specificity.'
16
+ fixed_titles:
17
+ - はじめに
18
+ - 本書の構成
19
+ - 参考文献
20
+ - 参照した実装ファイル
21
+ - まとめ
22
+ duplicate_siblings: true
23
+ style: mixed
@@ -0,0 +1,45 @@
1
+ # Japanese technical heading criteria
2
+
3
+ ## Identify the section's role
4
+
5
+ Determine whether the section explains a concept, structure, operation,
6
+ comparison, principle, problem, or learning direction before suggesting a title.
7
+ Term labels, noun phrases, definition questions, action phrases, principles,
8
+ conclusion statements, and reader questions are all valid heading forms.
9
+ The form alone is not a defect. A nominal action label can also describe a procedure.
10
+
11
+ ## Match the title to the evidence
12
+
13
+ Use the corresponding section body, descendants and neighboring context to
14
+ check the promised subject and scope. Do not add guarantees, implementation
15
+ mechanisms, actors, causes, superlatives, or benefits absent from the source.
16
+ Preserve conditions, negation, technical distinctions and exact terminology.
17
+ If supporting body text is missing or insufficient, record needs-evidence.
18
+ A table of contents alone cannot establish agreement with the section body.
19
+
20
+ ## Compare headings with the same role
21
+
22
+ Read the complete outline and compare parent, sibling and child headings.
23
+ Align granularity and naming for sections with the same role; do not impose one
24
+ form on every heading at the same level or throughout the book. Conceptual
25
+ sections and procedures can intentionally use different forms.
26
+ Repeated official terms and fixed section names are valid. Check duplicate
27
+ siblings for ambiguity, without treating all repetition as a defect.
28
+
29
+ ## Respect the book's format
30
+
31
+ The book owns preferred nominal or action forms, questions, fixed titles,
32
+ length expectations and numbering. The default accepts mixed forms, without a
33
+ universal character limit. Style candidates are advisory and admit exceptions.
34
+ Do not mechanically nominalize action headings or replace plain language with
35
+ abstract technical-sounding nouns. Do not reorganize, merge, split or reorder
36
+ sections during title correction.
37
+
38
+ ## Record decisions and preservation concerns
39
+
40
+ Review every selected heading, including headings without machine candidates.
41
+ Record revise, keep or needs-evidence with a reason for each heading. Compare
42
+ original and proposed titles separately for information loss and unsupported
43
+ additions. Keep source identifiers, references and protected inline syntax.
44
+ Mechanical verification does not establish agreement with the body or semantic
45
+ correctness; meaning_verified remains false.
@@ -0,0 +1,17 @@
1
+ version: 1
2
+
3
+ rules:
4
+ - expected: '®'
5
+ pattern: '&reg;'
6
+ specs:
7
+ - from: '製品&reg;'
8
+ to: '製品®'
9
+ - expected: '($1)'
10
+ pattern: '/(([^()\r\n]+))/'
11
+ specs:
12
+ - from: '設定(任意)'
13
+ to: '設定(任意)'
14
+ - expected: ' '
15
+ pattern: ' '
16
+ - expected: '/'
17
+ pattern: '/'