asciidoc-pubkit 0.8.7 → 1.0.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 +27 -0
- data/README.md +85 -1404
- data/docs/architecture.md +264 -0
- data/docs/configuration.md +48 -0
- data/docs/custom-rules.md +69 -0
- data/docs/development.md +138 -0
- data/docs/document-commands.md +68 -0
- data/docs/english-review-research.md +314 -0
- data/docs/installation.md +134 -0
- data/docs/list-review.md +50 -0
- data/docs/references.md +48 -0
- data/docs/replacements.md +193 -0
- data/docs/review-workflow.md +267 -0
- data/docs/rules-and-coverage.md +158 -0
- data/docs/scoring.md +37 -0
- data/docs/writing.md +24 -0
- data/lib/asciidoc_pubkit/cli.rb +8 -1
- data/lib/asciidoc_pubkit/document_commands.rb +215 -0
- data/lib/asciidoc_pubkit.rb +2 -1
- metadata +22 -5
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Prose replacements
|
|
2
|
+
|
|
3
|
+
The replacement commands apply author-supplied mechanical replacement rules without MeCab or an AI
|
|
4
|
+
CLI. Review candidates and glossary variants remain advisory and are never
|
|
5
|
+
implicitly applied. Replacement rules are separate from review rules.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
asciidoc-pubkit replace check book.adoc --rules replacements.yml
|
|
9
|
+
asciidoc-pubkit replace diff book.adoc --rules replacements.yml
|
|
10
|
+
asciidoc-pubkit replace apply book.adoc --rules replacements.yml
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`check` reports original text, proposed text, rule IDs (`rule-1`, etc.), source
|
|
14
|
+
paths, one-based Unicode lines/columns, and a coverage-notice count. Its exit code
|
|
15
|
+
is 1 when replacements are available, 0 otherwise. `diff` previews unified diffs
|
|
16
|
+
without editing; it requires the external `diff` command. `apply` explicitly
|
|
17
|
+
authorizes source replacement without prompting. Successful diff/apply commands
|
|
18
|
+
return 0; invalid rules, conflicts, unsafe edits, and input/output failures return
|
|
19
|
+
2. Check/diff accept `--output` for a new file only; apply rejects `--output`.
|
|
20
|
+
|
|
21
|
+
Starting with version 0.8.2, invalid rule files report their original YAML file
|
|
22
|
+
and one-based line number on the first error line, followed by the existing
|
|
23
|
+
reason on the next line. Imported files and entries in pattern arrays retain
|
|
24
|
+
their own source locations. For example:
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
Error: /path/to/prh.yml:162
|
|
28
|
+
Unsupported regex flags; only optional i is supported (all matches are collected).
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Rules are validated before any manuscript is replaced. All replacement commands
|
|
32
|
+
stop with exit code 2 on invalid rules, including errors found in imported files.
|
|
33
|
+
|
|
34
|
+
All three accept `--lang ja`, `--base-dir`, `--config`, and `--only` (an included
|
|
35
|
+
source file). Normal configuration discovery and `review.base_dir`, `language`,
|
|
36
|
+
`attributes`, and `exclude` control parsing and selection. `--rules` is required;
|
|
37
|
+
`review.rules` and glossary entries do not supply replacement rules. There are
|
|
38
|
+
no built-in replacement rules and no automatic search for `prh.yml`.
|
|
39
|
+
|
|
40
|
+
### Limited prh-format rules
|
|
41
|
+
|
|
42
|
+
The supported format is a strict subset of [prh](https://github.com/prh/prh):
|
|
43
|
+
|
|
44
|
+
```yaml
|
|
45
|
+
version: 1
|
|
46
|
+
rules:
|
|
47
|
+
- expected: '®'
|
|
48
|
+
pattern: '®'
|
|
49
|
+
- expected: '($1)'
|
|
50
|
+
pattern: '/(([^()\r\n]+))/'
|
|
51
|
+
specs:
|
|
52
|
+
- from: '設定(任意)'
|
|
53
|
+
to: '設定(任意)'
|
|
54
|
+
- expected: '/'
|
|
55
|
+
patterns:
|
|
56
|
+
- '/'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The root requires `version: 1` and accepts optional `rules` and `imports` arrays.
|
|
60
|
+
Starting with version 0.8.1, omitted arrays default to empty. Version 0.8.0
|
|
61
|
+
requires `rules` and rejects `imports`. Each rule requires a string
|
|
62
|
+
`expected` (empty strings permit deletion) and exactly one of `pattern` (a
|
|
63
|
+
nonempty string or, starting with version 0.8.1, a nonempty array of nonempty
|
|
64
|
+
strings) or `patterns` (a nonempty array of nonempty strings). Array-valued
|
|
65
|
+
`pattern` is equivalent to `patterns`; specifying both keys is rejected. Optional
|
|
66
|
+
`specs` is an array of exact `from`/`to` string pairs, validated on load. Specs
|
|
67
|
+
exercise the rule on plain text, not AsciiDoc selection or inline protection.
|
|
68
|
+
|
|
69
|
+
Strings not beginning with `/` match literally. `/.../` denotes a regex; the
|
|
70
|
+
version 0.8.1 also accepts `/.../i` for Ruby case-insensitive matching.
|
|
71
|
+
Version 0.8.0 rejects all flags. All occurrences are collected. The implementation
|
|
72
|
+
uses Ruby regexes with
|
|
73
|
+
a timeout and accepts a limited common syntax: character classes, ordinary
|
|
74
|
+
captures, noncapturing groups, lookarounds, alternatives, anchors, quantifiers,
|
|
75
|
+
and the escapes `\n`, `\r`, `\t`, `\d`, `\D`, `\s`, `\S`, `\w`, `\W`
|
|
76
|
+
and escaped punctuation. Ruby regex character-class behavior applies; this is
|
|
77
|
+
not a JavaScript regex engine or a promise of full prh equivalence. Engine-specific
|
|
78
|
+
groups/escapes and flags other than a single `i` are rejected. A leading literal slash must be expressed
|
|
79
|
+
as an escaped regex, for example `/\//`. Zero-length matches are rejected.
|
|
80
|
+
|
|
81
|
+
Replacement strings support `$1` through `$99` for existing capture groups and
|
|
82
|
+
`$$` for a literal dollar sign. Unsupported dollar references are rejected when
|
|
83
|
+
matched. Missing optional captures expand to empty strings. YAML single quotes
|
|
84
|
+
are recommended to keep backslashes literal. Unknown fields, including
|
|
85
|
+
`options` and `regexpMustEmpty`, and omitted patterns are rejected rather than
|
|
86
|
+
ignored. prh's automatic pattern generation is not supported.
|
|
87
|
+
|
|
88
|
+
For example, version 0.8.1 also accepts:
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
version: 1
|
|
92
|
+
rules:
|
|
93
|
+
- expected: 'ハードウェア'
|
|
94
|
+
pattern:
|
|
95
|
+
- 'ハードウエア'
|
|
96
|
+
- 'ハードウェアー'
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Each array entry uses the same literal/regex syntax and validation as a single
|
|
100
|
+
pattern. Arrays do not change supported flags or overlap handling.
|
|
101
|
+
|
|
102
|
+
### Limited ECMAScript boundary compatibility
|
|
103
|
+
|
|
104
|
+
Version 0.8.1 translates `\b` and `\B` outside character classes into Ruby
|
|
105
|
+
lookarounds with ECMAScript word-character semantics, following prh's default
|
|
106
|
+
Unicode mode. Word characters are ASCII letters, digits, and underscore; Japanese
|
|
107
|
+
characters are non-word characters. Thus `/\bTips\b/` matches `Tips` in
|
|
108
|
+
`前Tips後`, but not in `Tips2`, `_Tips`, or `ATips`.
|
|
109
|
+
With `/i`, long s (`ſ`) and Kelvin sign (`K`) also count as word characters under
|
|
110
|
+
ECMAScript Unicode case folding. The generated assertions add no capture groups
|
|
111
|
+
and preserve original match offsets. Inside a character class, `\b` means a
|
|
112
|
+
backspace character; `\B` there is rejected. Escaped literal backslashes are
|
|
113
|
+
preserved.
|
|
114
|
+
|
|
115
|
+
Only the boundary assertions emulate ECMAScript. `/i` uses Ruby's
|
|
116
|
+
`Regexp::IGNORECASE`; Unicode case folding can differ from JavaScript (for
|
|
117
|
+
example multi-character folds). Other constructs, including whitespace classes,
|
|
118
|
+
retain Ruby semantics. This is limited prh compatibility, not full ECMAScript
|
|
119
|
+
conformance. Flags `g`, `m`, `s`, `u`, `y`, `d`, and `v` and duplicate `i` are
|
|
120
|
+
rejected; all occurrences are already collected independently of `g`.
|
|
121
|
+
|
|
122
|
+
### Importing replacement rules
|
|
123
|
+
|
|
124
|
+
Version 0.8.1 supports nested `imports`; version 0.8.0 does not. For example:
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
version: 1
|
|
128
|
+
imports:
|
|
129
|
+
- ../../rules/prh.yml
|
|
130
|
+
- path: ./terminology.yml
|
|
131
|
+
rules:
|
|
132
|
+
- expected: '®'
|
|
133
|
+
pattern: '®'
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Each entry is a nonempty local file path string or a mapping containing exactly
|
|
137
|
+
`path`. Relative paths resolve from the importing YAML file, including nested
|
|
138
|
+
imports, independently of the working directory and manuscript base directory.
|
|
139
|
+
Absolute local paths are also accepted; URL imports are rejected. An import-only
|
|
140
|
+
file may omit `rules`. A file containing only `version: 1` is also valid and
|
|
141
|
+
contributes no rules. With no imported or local rules, `check`, `diff`, and
|
|
142
|
+
`apply` succeed without changing manuscript sources, and `diff` emits no patch.
|
|
143
|
+
Starting with version 0.8.1, a bare `rules:`, `rules: null`, and `rules: ~`
|
|
144
|
+
also contribute no local rules, just like omission or `rules: []`; imported rules
|
|
145
|
+
are still loaded. Other non-array values remain invalid. This normalization
|
|
146
|
+
applies only to `rules`, not to `imports` or individual rule fields.
|
|
147
|
+
Every imported file must use version 1 and pass the same
|
|
148
|
+
strict rule validation and specs as the entry file.
|
|
149
|
+
|
|
150
|
+
Imports are loaded in listed order, recursively before each file's own rules.
|
|
151
|
+
Each physical file is loaded once per plan, including repeated paths, symlink
|
|
152
|
+
aliases, and shared dependencies. Rule IDs are assigned across the flattened
|
|
153
|
+
set. Cycles (including symlink aliases), missing files, and import chains deeper
|
|
154
|
+
than 100 files fail rather than silently omitting rules. Imported and local rules
|
|
155
|
+
are combined, not overridden: overlapping replacement candidates remain errors
|
|
156
|
+
and replacements are still calculated only against the original text.
|
|
157
|
+
|
|
158
|
+
Import options such as `ignoreRules` and `disableImports` remain unsupported and
|
|
159
|
+
are rejected. Source selection and protection are unchanged by imports.
|
|
160
|
+
|
|
161
|
+
### Selection and preservation
|
|
162
|
+
|
|
163
|
+
Only unambiguously source-mapped running prose in the existing default review
|
|
164
|
+
scope is eligible. Headings, lists, tables, quotations, listing/source, literal,
|
|
165
|
+
and passthrough blocks are excluded. Recognized inline code, quotations, URLs,
|
|
166
|
+
macros, and attribute references are protected by the existing conservative
|
|
167
|
+
inline heuristic, not a complete inline parser. A match overlapping any protected
|
|
168
|
+
span is skipped; matching is performed on the original text, never on blanked
|
|
169
|
+
placeholders. Backtick-to-bold and list-marker conversions are outside this scope.
|
|
170
|
+
|
|
171
|
+
Candidates are calculated once against the original sources; replacement results
|
|
172
|
+
are not searched again. Overlapping edits are conflicts, not resolved by rule
|
|
173
|
+
order. Matches/results containing line breaks are rejected. Source files retain
|
|
174
|
+
UTF-8 bytes, original line endings, and unrelated content; repeated include
|
|
175
|
+
occurrences must not create overlapping edits.
|
|
176
|
+
|
|
177
|
+
Before presenting a plan, the complete captured source set is copied to temporary
|
|
178
|
+
staging and reparsed. Parsing diagnostics, structural changes, new/deleted protected
|
|
179
|
+
inline tokens, and protected-content/source-membership changes reject the plan.
|
|
180
|
+
Relative includes within the base directory are supported. Absolute includes and
|
|
181
|
+
includes whose paths depend on the original filesystem may fail staged validation;
|
|
182
|
+
they are not rewritten or silently accepted. Symlink entrypoints are rejected.
|
|
183
|
+
|
|
184
|
+
Apply stages all changed files beside their destinations, checks all captured
|
|
185
|
+
source bytes against the plan, and renames the prepared files into place while
|
|
186
|
+
preserving permission bits. An ordinary installation error restores sources
|
|
187
|
+
already installed. This is not a crash-atomic transaction across multiple files;
|
|
188
|
+
keep manuscripts under version control and avoid concurrent edits during apply.
|
|
189
|
+
No review session is created or replaced. Existing sessions retain their original
|
|
190
|
+
baselines; applying replacements can make a session stale for prompt generation.
|
|
191
|
+
Mechanical validation does not establish semantic correctness.
|
|
192
|
+
|
|
193
|
+
[Back to README](../README.md)
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# Review workflow
|
|
2
|
+
|
|
3
|
+
Run the following commands from the manuscript project directory:
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
asciidoc-pubkit review scan book.adoc --output .pubkit/review
|
|
7
|
+
asciidoc-pubkit review prompt .pubkit/review --output review-prompt.md
|
|
8
|
+
# Ask your agent to read review-prompt.md and revise the referenced manuscript.
|
|
9
|
+
asciidoc-pubkit review verify .pubkit/review --output verification.json
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
All three commands leave manuscript files unchanged. Only the agent edits them.
|
|
13
|
+
`prompt` and `verify` output files must not already exist.
|
|
14
|
+
Without `--output`, `prompt` writes Markdown and `verify` writes JSON to stdout.
|
|
15
|
+
`scan` defaults to `.pubkit/review` and prints a short summary. Prose scan output
|
|
16
|
+
and prompts explicitly direct reviewers to a separate `--scope lists` session
|
|
17
|
+
for list text; the prose baseline must remain intact.
|
|
18
|
+
|
|
19
|
+
List review is optional when the assignment covers running prose only or there
|
|
20
|
+
are no list descriptions to review. It is needed when the assignment includes
|
|
21
|
+
list wording: the default prose scan does not review it. See [List review](list-review.md#list-review)
|
|
22
|
+
for examples, supported items, and coverage limits.
|
|
23
|
+
|
|
24
|
+
For a review covering all three scopes, finish and verify headings first, then
|
|
25
|
+
scan and review the current prose, then scan and review the current list text.
|
|
26
|
+
Create each session after the preceding phase's edits and verification. Preserve
|
|
27
|
+
all earlier baselines and phase-end results; later edits in another scope may
|
|
28
|
+
legitimately make an earlier session's verification fail. On re-review, choose
|
|
29
|
+
unused session paths rather than replacing the previous evidence.
|
|
30
|
+
|
|
31
|
+
### Scan
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
asciidoc-pubkit review scan book.adoc --only chapters/introduction.adoc
|
|
35
|
+
asciidoc-pubkit review scan chapter.adoc --style desu-masu
|
|
36
|
+
asciidoc-pubkit review scan book.adoc --attribute edition=print --base-dir .
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
If the session directory already exists, an interactive terminal asks
|
|
40
|
+
`Replace it? [y/N]`. Only `y` or `yes` (case-insensitive) replaces it; any other
|
|
41
|
+
answer or end of input cancels with exit status 2. Replacement resets the review
|
|
42
|
+
baseline and removes old session contents. Use a different `--output` path to
|
|
43
|
+
keep the previous review pass. The old session remains intact if scanning fails
|
|
44
|
+
before the replacement is installed.
|
|
45
|
+
|
|
46
|
+
For batch execution:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
# Answer yes automatically and replace an existing review session.
|
|
50
|
+
asciidoc-pubkit review scan book.adoc --yes # short form: -y
|
|
51
|
+
# Never ask; exit with status 2 if the output already exists.
|
|
52
|
+
asciidoc-pubkit review scan book.adoc --no-input
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Non-terminal stdin also disables prompting. `--yes --no-input` permits
|
|
56
|
+
replacement without reading stdin. These options apply to `scan` only;
|
|
57
|
+
regular files, symlinks, directories without a review session layout, and
|
|
58
|
+
sessions containing the current manuscript sources cannot be replaced.
|
|
59
|
+
|
|
60
|
+
An entrypoint or a standalone chapter can be scanned. Includes and conditionals
|
|
61
|
+
are processed by Asciidoctor. Match the publishing build's attributes and base
|
|
62
|
+
directory to review the intended edition. `--only` selects one included source
|
|
63
|
+
file while retaining the book's attributes and heading hierarchy. Its path is
|
|
64
|
+
relative to the current working directory, as are other CLI path arguments.
|
|
65
|
+
|
|
66
|
+
Asciidoctor runs in safe mode. Local includes must resolve inside the base
|
|
67
|
+
directory. Remote includes and project-specific Asciidoctor extensions are not
|
|
68
|
+
supported. In particular, custom `/shared/` include conventions must be converted
|
|
69
|
+
to ordinary local paths before using this release. Parser diagnostics cause the
|
|
70
|
+
scan to fail rather than silently accepting incomplete input.
|
|
71
|
+
|
|
72
|
+
The session contains:
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
.pubkit/review/
|
|
76
|
+
manifest.json # Schema, tool version, inputs, settings, hashes, protection data
|
|
77
|
+
findings.json # Candidate locations, rule IDs, severity, and review questions
|
|
78
|
+
document.json # Paragraphs, heading hierarchy, structure, and coverage notices
|
|
79
|
+
baseline/ # Exact copies of the participating source files
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Sessions use absolute source paths and are local working artifacts. Regenerate a
|
|
83
|
+
session after moving a project. Keep `.pubkit/` and generated prompts out of Git
|
|
84
|
+
when they contain private manuscript material. Rule settings and glossary contents
|
|
85
|
+
are frozen into the session; scan again after changing them.
|
|
86
|
+
|
|
87
|
+
### Heading review
|
|
88
|
+
|
|
89
|
+
Review headings, prose, and list text in separate sessions. The default scan scope
|
|
90
|
+
remains `prose`; `--scope headings` selects section titles and `--scope lists` selects
|
|
91
|
+
supported list text. There is no combined scope.
|
|
92
|
+
Default output directories are `.pubkit/review` for prose and `.pubkit/headings`
|
|
93
|
+
for headings, so separate scans do not replace each other by default.
|
|
94
|
+
The scope is saved at scan time; `prompt` and `verify` use that saved scope.
|
|
95
|
+
Neither scan nor prompt invokes an AI CLI or edits a manuscript. Give the generated
|
|
96
|
+
prompt to your reviewer separately.
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
asciidoc-pubkit review scan book.adoc --scope headings --output .pubkit/headings
|
|
100
|
+
asciidoc-pubkit review prompt .pubkit/headings --mode diagnose --output headings-diagnosis.md
|
|
101
|
+
# Generate a revision prompt when ready to edit:
|
|
102
|
+
asciidoc-pubkit review prompt .pubkit/headings --mode revise --output headings-review.md
|
|
103
|
+
# After the external review and edits:
|
|
104
|
+
asciidoc-pubkit review verify .pubkit/headings
|
|
105
|
+
|
|
106
|
+
# Establish a fresh prose baseline after finishing heading edits:
|
|
107
|
+
asciidoc-pubkit review scan book.adoc --scope prose --output .pubkit/prose
|
|
108
|
+
asciidoc-pubkit review prompt .pubkit/prose --output prose-review.md
|
|
109
|
+
asciidoc-pubkit review verify .pubkit/prose
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Heading prompts contain the full parsed section outline, selected headings and
|
|
113
|
+
all selected source-mapped prose paragraphs once as read-only evidence. They
|
|
114
|
+
compare parents, siblings, descendants and the corresponding body. Body content
|
|
115
|
+
outside prose coverage is not supplied; insufficient evidence must be recorded
|
|
116
|
+
as `needs-evidence`. `--only` and `review.exclude` select editable headings and
|
|
117
|
+
body evidence while retaining the full outline as context. All excerpts are data,
|
|
118
|
+
never executable reviewer instructions. Both criteria files and resolved rules
|
|
119
|
+
are frozen in the session.
|
|
120
|
+
|
|
121
|
+
Default heading rules accept term labels, noun phrases, questions, action
|
|
122
|
+
phrases, principles, conclusions and learning directions. They flag limited
|
|
123
|
+
promotional/vague phrases, glossary variants and identical sibling titles as
|
|
124
|
+
review candidates. They do not apply prose weak-predicate or sentence-ending
|
|
125
|
+
rules, require nominalization, or impose a character limit. Role and body
|
|
126
|
+
agreement are contextual reviewer judgments, not mechanically proven findings.
|
|
127
|
+
|
|
128
|
+
Only plain ATX section titles whose source cursor and original title match are
|
|
129
|
+
editable. Document titles, old-style underlined headings, attribute-expanded
|
|
130
|
+
and converted inline titles and physical title lines reused by multiple includes remain protected.
|
|
131
|
+
Unresolved section titles receive coverage notices. Verification permits only selected title text changes while
|
|
132
|
+
protecting the body, title markers, hierarchy, order, section IDs, references,
|
|
133
|
+
attributes, includes and other protected content. A title-derived section ID
|
|
134
|
+
change fails verification. Starting with version 0.8.7, heading scans preserve
|
|
135
|
+
generated IDs by default. Eligible generated headings save an exact `permitted_id_anchor` in
|
|
136
|
+
their metadata. A reviewer may insert only that
|
|
137
|
+
anchor immediately before its selected heading, for example:
|
|
138
|
+
|
|
139
|
+
```adoc
|
|
140
|
+
[#_手動圧縮の入口]
|
|
141
|
+
== 手動圧縮と拡張からの起動
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Verification allows this exact addition while requiring the same section ID,
|
|
145
|
+
hierarchy, order, and protected body. Existing explicit anchors remain protected;
|
|
146
|
+
other anchors and reference migrations are outside this permission. No additional
|
|
147
|
+
ID-preservation option is required. Previously saved permissions remain unchanged;
|
|
148
|
+
start a separate new session to obtain the default permissions, keeping the old
|
|
149
|
+
baseline intact. Scan and prompt never insert anchors or rewrite
|
|
150
|
+
manuscripts. Numeric title changes
|
|
151
|
+
are manual-review notices, and remaining candidates do not fail verification.
|
|
152
|
+
`meaning_verified` remains `false`.
|
|
153
|
+
|
|
154
|
+
Version 1.0.0 uses session schema 3 and requires the exact tool version saved in
|
|
155
|
+
the session. Preserve or finish an ongoing review with its original tool before
|
|
156
|
+
establishing a new baseline in a separate directory.
|
|
157
|
+
`review score` continues to support prose only and rejects `--scope`.
|
|
158
|
+
|
|
159
|
+
Heading rules use `--heading-rules FILE`, then configuration
|
|
160
|
+
`review.heading_rules`, then `data/heading-rules.ja.yml`. A custom file replaces
|
|
161
|
+
the entire heading rule set. Each scan loads only the rules for its selected
|
|
162
|
+
scope; an unavailable rule file for the other scope does not prevent it.
|
|
163
|
+
`--heading-rules` requires `--scope headings`;
|
|
164
|
+
prose `--rules` and `--style` cannot be passed to a heading scan.
|
|
165
|
+
|
|
166
|
+
```yaml
|
|
167
|
+
schema_version: 1
|
|
168
|
+
terms:
|
|
169
|
+
book-heading-cue:
|
|
170
|
+
terms: [シームレス]
|
|
171
|
+
question: 'Check the claimed behavior against the section evidence.'
|
|
172
|
+
fixed_titles: [はじめに, 参考文献, まとめ]
|
|
173
|
+
duplicate_siblings: true
|
|
174
|
+
style: mixed
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
All five keys are required; unknown keys, invalid types and YAML aliases are
|
|
178
|
+
rejected. `terms` maps nonempty rule names to exactly `terms` (unique nonempty
|
|
179
|
+
strings) and `question` (nonempty English guidance). `fixed_titles` contains
|
|
180
|
+
unique nonempty titles exempt from mechanical candidates; it does not expand
|
|
181
|
+
the edit scope or prove correctness. `duplicate_siblings` is boolean. `style`
|
|
182
|
+
is `mixed` (default), `nominal`, or `action`; explicit preferences generate
|
|
183
|
+
advisory ending cues rather than a complete grammatical classification. Keep
|
|
184
|
+
questions, principles and justified exceptions. Heading phrase and glossary
|
|
185
|
+
matches respect exact `review.allows` entries, protected inline masking and
|
|
186
|
+
one-based Unicode source columns. MeCab remains the default; only explicit
|
|
187
|
+
`--tokenizer literal` disables it.
|
|
188
|
+
|
|
189
|
+
### Prompt
|
|
190
|
+
|
|
191
|
+
```sh
|
|
192
|
+
asciidoc-pubkit review prompt .pubkit/review --mode revise --output review-prompt.md
|
|
193
|
+
asciidoc-pubkit review prompt .pubkit/review --mode diagnose
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
`revise` is the default and asks the agent to edit relevant prose. `diagnose` asks
|
|
197
|
+
for findings and proposed revisions without editing. Both modes require the agent
|
|
198
|
+
to distinguish **revise**, **keep**, and **needs-evidence** decisions. Each decision
|
|
199
|
+
needs a passage-specific reason. Whether a matched string remains or disappears
|
|
200
|
+
cannot determine that decision; unchanged paragraphs and remaining candidates
|
|
201
|
+
must not receive automatic `keep` records. Unreviewed items remain pending.
|
|
202
|
+
|
|
203
|
+
Version 0.8.4 prompts require the reviewer to reconcile decisions with actual
|
|
204
|
+
edits (or proposed revisions in diagnose mode), review paragraphs or headings
|
|
205
|
+
without candidates, and inspect newly detected or remaining candidates after
|
|
206
|
+
verification. They request separate reports for mechanical preservation,
|
|
207
|
+
candidate decisions, and paragraph or heading quality review, with counts and
|
|
208
|
+
unresolved items. Protected-scope concerns are separate proposals, not evidence
|
|
209
|
+
of editorial approval. Pending items make the review incomplete.
|
|
210
|
+
Version 0.8.5 further requires an individual role or claim, located
|
|
211
|
+
evidence, a considered direct alternative, and the rationale for each candidate
|
|
212
|
+
decision. A stock reason with an appended quotation is insufficient. For `入口`,
|
|
213
|
+
the shared criteria ask whether creation, invocation, configuration, reference,
|
|
214
|
+
or a learning role can be stated directly even when the referent is clear.
|
|
215
|
+
Remaining role metaphors must be checked against those individual decisions.
|
|
216
|
+
|
|
217
|
+
These are reviewer instructions: the gem does not validate a decision ledger
|
|
218
|
+
or prove that an AI or human followed the instructions. Keep session metadata
|
|
219
|
+
and baseline snapshots immutable; format only authorized manuscript spans.
|
|
220
|
+
|
|
221
|
+
The single Markdown output includes every selected paragraph once, in document
|
|
222
|
+
order, with the shared criteria saved at scan time, candidates, saved settings,
|
|
223
|
+
and preservation instructions. Paragraph
|
|
224
|
+
text uses fenced text blocks; metadata uses compact JSON. File and heading context
|
|
225
|
+
is shared by consecutive paragraphs, and candidates inherit their file and
|
|
226
|
+
paragraph ID. Adjacent entries provide neighboring context without repeating text.
|
|
227
|
+
The prompt asks the agent to read manageable ranges with neighboring paragraphs
|
|
228
|
+
at boundaries and track completed paragraph IDs and candidate decisions. It also
|
|
229
|
+
requires review of paragraphs with no machine matches. Large manuscripts can
|
|
230
|
+
still exceed a context window if the entire prompt is loaded at once. Initial
|
|
231
|
+
support is for local prose correction, not chapter reorganization.
|
|
232
|
+
|
|
233
|
+
Source hashes are checked before generating a prompt. Modified sources, modified
|
|
234
|
+
session artifacts, and incompatible session versions require a fresh scan.
|
|
235
|
+
`review scan`, `review prompt`, and `review verify` accept `--lang ja`; prompt and
|
|
236
|
+
verify check the value against the session language. A non-Japanese language in
|
|
237
|
+
`--lang`, `review.language`, or an explicit AsciiDoc `:lang:` attribute is rejected.
|
|
238
|
+
An omitted `:lang:` attribute uses the selected review language.
|
|
239
|
+
|
|
240
|
+
### Verify
|
|
241
|
+
|
|
242
|
+
```sh
|
|
243
|
+
asciidoc-pubkit review verify .pubkit/review
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
For prose sessions, verification compares the current source set, document structure, content outside
|
|
247
|
+
reviewed paragraphs, and recognized protected inline tokens with the baseline.
|
|
248
|
+
It reports remaining candidates and numeric changes separately. Existing candidates
|
|
249
|
+
do not make verification fail. Numeric changes require manual review but do not
|
|
250
|
+
by themselves fail mechanical verification.
|
|
251
|
+
|
|
252
|
+
Non-prose comparison ignores empty separator lines and trailing whitespace;
|
|
253
|
+
listing, literal, and passthrough block content is additionally compared as parsed
|
|
254
|
+
lines. Inline protection is heuristic, not a complete AsciiDoc inline parser.
|
|
255
|
+
Successful verification does not prove meaning preservation, technical accuracy,
|
|
256
|
+
or release readiness: `meaning_verified` is always `false`. Verification does
|
|
257
|
+
not read candidate decision records or certify editorial completion. A passing
|
|
258
|
+
mechanical result must be reported separately from the reviewer's quality and
|
|
259
|
+
completion assessment.
|
|
260
|
+
|
|
261
|
+
| Exit code | Meaning |
|
|
262
|
+
| --- | --- |
|
|
263
|
+
| `0` | Command completed; verification found no mechanical violations |
|
|
264
|
+
| `1` | Verification found protected-content, structure, source, or parsing issues |
|
|
265
|
+
| `2` | Invalid arguments, configuration, session, scan input, or output failure |
|
|
266
|
+
|
|
267
|
+
[Back to README](../README.md)
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Rules and coverage
|
|
2
|
+
|
|
3
|
+
| Rule | Severity | Purpose |
|
|
4
|
+
| --- | --- | --- |
|
|
5
|
+
| `abstract-reference` | hint | Ask what an abstract noun refers to |
|
|
6
|
+
| `weak-predicate` | hint | Ask whether an operation's purpose or result is clear |
|
|
7
|
+
| `contextual-phrase` | hint | Check whether a qualification changes interpretation or action; preserve necessary negation |
|
|
8
|
+
| `generic-framing` | hint | Check whether an introduction or recap adds a claim, scope, or consequence |
|
|
9
|
+
| `vague-degree` | hint | Ask what depth, level, scope, or comparison is intended |
|
|
10
|
+
| `repeated-ending` | info | Identify three consecutive sentences with the same detected ending |
|
|
11
|
+
| `glossary-variant` | warning | Identify project-specific terminology variants |
|
|
12
|
+
| `style-candidate` | hint | Check selected polite/plain endings against an explicit style |
|
|
13
|
+
|
|
14
|
+
MeCab mode matches noun and adjective tokens and dictionary forms of verbs.
|
|
15
|
+
Sahen predicates are matched as a noun followed by `する` or the potential
|
|
16
|
+
`できる`; standalone sahen nouns are not treated as verbal predicates. A configured
|
|
17
|
+
sahen predicate takes precedence over a matching standalone noun rule. Auxiliary sequences retain
|
|
18
|
+
negation, past tense, passive forms, and progressive forms in the reported surface.
|
|
19
|
+
The added reach predicate is negative-only; the existing handling predicate is
|
|
20
|
+
reviewed in both affirmative and negative forms. Glossary variants and generic
|
|
21
|
+
framing phrases continue to use literal matching. Contextual phrases suppress
|
|
22
|
+
overlapping morphological candidates. Except for the four predicate patterns
|
|
23
|
+
described below, they use literal matching. Compound
|
|
24
|
+
nouns are matched across adjacent noun tokens. Selection and narrowing verbs
|
|
25
|
+
include potential forms; predicate surfaces also preserve causative auxiliaries.
|
|
26
|
+
|
|
27
|
+
Default terms group components, actors, relationships, and resources under
|
|
28
|
+
`abstract-reference`; operations under `weak-predicate`; and compressed noun
|
|
29
|
+
relationships, referents, sufficiency, and negative qualifications under
|
|
30
|
+
`contextual-phrase`. `木` and `余白` invite a context-dependent katakana terminology
|
|
31
|
+
review, not mandatory replacement. `明示選択` and `欠落理由` invite checking whether
|
|
32
|
+
`明示的選択` and `欠落した理由` clarify the intended relationship. Shared phrases such
|
|
33
|
+
as `ではありません` cover longer qualifications without listing every sentence.
|
|
34
|
+
`generic-framing` also flags `このように` and `要するに` as possible recaps.
|
|
35
|
+
These are candidates for contextual review, not banned expressions. A necessary
|
|
36
|
+
condition, uncertainty, or distinction must survive a revision; a redundant
|
|
37
|
+
disclaimer can instead be removed or folded into a more precise main claim.
|
|
38
|
+
|
|
39
|
+
Version 0.8.5 extends the existing `入口` question and shared criteria
|
|
40
|
+
without adding another prose matcher. A known referent alone does not justify
|
|
41
|
+
vague role wording; direct alternatives are evaluated against the actual
|
|
42
|
+
operation, conditions, and technical usage. The heading `heading-vague-topic`
|
|
43
|
+
rule also includes `入口`; proposed title changes must preserve generated IDs
|
|
44
|
+
or be reported for a separate authorized migration. Lists remain excluded and
|
|
45
|
+
are not included in prose or heading body evidence. Reports about outside-scope
|
|
46
|
+
concerns cover only content actually inspected, not unreviewed excluded blocks.
|
|
47
|
+
If baseline or artifact integrity fails, preserve the evidence and stop editing;
|
|
48
|
+
never update snapshot hashes or replace the baseline to claim a successful review.
|
|
49
|
+
|
|
50
|
+
Version 0.8.3 also includes scoped candidates such as `構築入口`,
|
|
51
|
+
`エラーを回収する`, `ツールを呼ぶ`, `したりできます`, and `設計の肝`.
|
|
52
|
+
These additions use the exact surfaces listed in the YAML in both modes;
|
|
53
|
+
they do not add general inflection coverage or ban everyday verbs. Existing
|
|
54
|
+
`木`, `持つ`, `書く`, `別です`, and `ではありません` rules cover related examples.
|
|
55
|
+
The shared criteria explain context-dependent terminology, precise operations,
|
|
56
|
+
direct predicates, and objective tone. They distinguish invocation from
|
|
57
|
+
execution, configuration text from configuration changes, assumptions from
|
|
58
|
+
requirements, and collecting errors from catching them. Suggested alternatives
|
|
59
|
+
are not automatic replacement rules. Start a new review session to include
|
|
60
|
+
updated rules and criteria; existing sessions retain their saved versions.
|
|
61
|
+
|
|
62
|
+
Version 0.8.4 also configures `呼ぶ`, `読み取る`, `拾う`, and the sahen predicate
|
|
63
|
+
`回収する` as weak-predicate candidates. MeCab matches their inflections for
|
|
64
|
+
any object, including `指示と宣言を読み取ります` and `最後のdetailsを拾います`.
|
|
65
|
+
This broadens review cues, not mandatory terminology changes; everyday and
|
|
66
|
+
technically valid uses can be retained with a specific reason. Literal mode
|
|
67
|
+
matches only the selected surfaces in the YAML. Longer contextual phrases take
|
|
68
|
+
precedence. `木全体` is an explicit contextual phrase in both modes because
|
|
69
|
+
IPADIC can parse `木全` as a surname; this narrowly addresses that segmentation
|
|
70
|
+
case without treating all names or compounds containing `木` as trees.
|
|
71
|
+
|
|
72
|
+
Version 0.8.5 additionally reviews `拡張点`, `使えます`, `積み重なります`,
|
|
73
|
+
`開放しています`, `見落とします`, `扱えます`, `使っています`, and selected indirect
|
|
74
|
+
phrases. Existing tracking rules cover `追えます`. MeCab uses configured lemmas
|
|
75
|
+
for use, potential handling, accumulation, oversight, and sahen opening;
|
|
76
|
+
literal mode uses the listed surfaces. The shared examples distinguish an
|
|
77
|
+
extension point from its mechanism, layers from a stack, system detection from
|
|
78
|
+
human oversight, and processing from control. Revisions preserve actors,
|
|
79
|
+
capabilities and obligations, sequence, visibility, counts, and distribution.
|
|
80
|
+
These additions need a fresh scan and are contextual review guidance.
|
|
81
|
+
|
|
82
|
+
Metaphorical-operation candidates include limited exact surfaces of
|
|
83
|
+
`地味に効く`, `静かに壊れる`, `時間を溶かす`, and `側に倒す`, including selected polite,
|
|
84
|
+
past, and connective forms listed in the packaged YAML. They use contextual
|
|
85
|
+
phrase matching in both tokenizers; this is not complete inflection coverage or
|
|
86
|
+
syntactic analysis. Bare verbs such as `効く`, `壊れる`, `溶かす`, and `倒す` are
|
|
87
|
+
not added as general metaphor candidates. Identify the actual effect, policy,
|
|
88
|
+
work, or failure state from evidence rather than applying a fixed replacement.
|
|
89
|
+
Keep valid technical meanings and necessary negation.
|
|
90
|
+
|
|
91
|
+
Version 0.6.2 additionally matches these four phrases with MeCab/IPADIC
|
|
92
|
+
verb lemmas and adjacent predicate auxiliaries. For example, `地味に効かなかった`,
|
|
93
|
+
`静かに壊れていた`, `時間を溶かしてしまった`, and `側に倒しました` retain their
|
|
94
|
+
complete surfaces and polarity. A pattern is enabled only when its canonical
|
|
95
|
+
phrase (`地味に効く`, `静かに壊れる`, `時間を溶かす`, or `側に倒す`) is present in
|
|
96
|
+
the resolved `contextual-phrase.terms`. Removing those canonical entries from
|
|
97
|
+
custom rules disables their morphological patterns; remaining exact surfaces
|
|
98
|
+
still work. No YAML schema change is required. Allow lists accept the canonical
|
|
99
|
+
phrase or exact detected surface. The most specific overlapping phrase wins,
|
|
100
|
+
including allowed phrases. Masked inline content, unknown tokens, and paragraph
|
|
101
|
+
boundaries cannot bridge a pattern. This remains a limited contextual heuristic,
|
|
102
|
+
not a syntactic or semantic determination of metaphor. Literal mode retains
|
|
103
|
+
exact surfaces and does not acquire this inflection coverage.
|
|
104
|
+
|
|
105
|
+
In version 0.6.2, a `repeated-ending` candidate points to the ending
|
|
106
|
+
of the third sentence in the first consecutive run within each paragraph.
|
|
107
|
+
A sentence without a matching ending interrupts the run. The candidate remains
|
|
108
|
+
informational because precise technical repetition can be necessary.
|
|
109
|
+
|
|
110
|
+
The shared criteria distinguish reader instructions, actual system behavior,
|
|
111
|
+
and available capabilities. They also separate readability from checks for
|
|
112
|
+
missing information and unsupported additions. Sentence length, punctuation,
|
|
113
|
+
and list density are contextual cues, not fixed acceptance thresholds. These
|
|
114
|
+
updates are included in 0.6.2; start a new session to use updated criteria and rules.
|
|
115
|
+
|
|
116
|
+
Literal term matching suppresses matches strictly contained in a longer matched
|
|
117
|
+
term, across categories. The longer term also suppresses contained matches when
|
|
118
|
+
it is allowed; separate occurrences remain candidates. Glossary and style checks
|
|
119
|
+
are independent. In MeCab mode, predicates outside a contextual phrase can still
|
|
120
|
+
be reported separately.
|
|
121
|
+
|
|
122
|
+
Morphological candidates include `lemma`, `part_of_speech`, `negative`, and
|
|
123
|
+
`detector` alongside the original `match`, line, and column. Negation detection
|
|
124
|
+
covers common IPADIC negative auxiliaries; it is not full semantic analysis of
|
|
125
|
+
negation scope or double negatives. Unknown tokens are not guessed. Kana/kanji
|
|
126
|
+
variants of the alignment and gathering verbs have explicit canonical mappings;
|
|
127
|
+
other spelling variants are not automatically normalized.
|
|
128
|
+
|
|
129
|
+
The session records the MeCab version and dictionary file hashes. Verification
|
|
130
|
+
reports analyzer changes instead of treating results from different dictionaries
|
|
131
|
+
as directly comparable. Prompt generation uses saved evidence and does not need
|
|
132
|
+
MeCab. Changed rules or dictionary settings require a new scan.
|
|
133
|
+
|
|
134
|
+
Version 1.0.0 uses session schema 3.
|
|
135
|
+
Sessions with a different schema or tool version cannot be loaded. Keep the original baseline for
|
|
136
|
+
an ongoing review and finish it with the original version, or start a new review
|
|
137
|
+
pass in a different directory:
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
asciidoc-pubkit review scan book.adoc --output .pubkit/review-1.0.0
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Severity describes review priority, not proof of an error. There is no AI-authorship
|
|
144
|
+
score and no requirement to eliminate every match.
|
|
145
|
+
|
|
146
|
+
In the default prose scope, only source-mapped running-prose paragraphs are reviewed. Headings, list items and
|
|
147
|
+
their continuations, tables, quotations, code, and passthrough blocks are excluded
|
|
148
|
+
from prose review. Common inline literals, macros, attribute references, URLs, and
|
|
149
|
+
Japanese quotation spans are masked. Complex inline syntax can exceed the masking
|
|
150
|
+
heuristic; review its diagnostics with care.
|
|
151
|
+
|
|
152
|
+
Source locations are checked against original lines because Asciidoctor block
|
|
153
|
+
locations can be inaccurate at include boundaries. If a location cannot be matched
|
|
154
|
+
unambiguously, the paragraph is skipped with a coverage notice. Columns are
|
|
155
|
+
one-based Unicode character positions, not byte offsets or display widths.
|
|
156
|
+
An empty findings array does not establish full coverage or good prose.
|
|
157
|
+
|
|
158
|
+
[Back to README](../README.md)
|
data/docs/scoring.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Score an AsciiDoc manuscript
|
|
2
|
+
|
|
3
|
+
Pass any AsciiDoc entry file directly; no review session or gold annotations are
|
|
4
|
+
required. Output defaults to a short English report with a score out of 100.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
asciidoc-pubkit review score book.adoc
|
|
8
|
+
asciidoc-pubkit review score book.adoc --json --output score.json
|
|
9
|
+
asciidoc-pubkit review score book.adoc --agent codex
|
|
10
|
+
asciidoc-pubkit review score book.adoc --agent claude --json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Without `--agent`, the report shows a mechanical candidate-density indicator.
|
|
14
|
+
With `--agent`, it shows a model readability rating and retains the mechanical
|
|
15
|
+
score in JSON. See [How review and scoring work](architecture.md#how-review-and-scoring-work)
|
|
16
|
+
for the analysis pipeline, formulas, and interpretation of these different scores.
|
|
17
|
+
Successful scoring exits 0 regardless of the score; input, configuration,
|
|
18
|
+
analyzer, evaluator, or output failures exit 2. No scoring mode establishes
|
|
19
|
+
technical accuracy or meaning preservation; `meaning_verified` remains `false`.
|
|
20
|
+
|
|
21
|
+
Scoring uses the same configuration discovery, custom rules, glossary, allows,
|
|
22
|
+
style, language, base directory, include handling, and prose coverage as scanning.
|
|
23
|
+
It accepts `--only`, `--config`, `--rules`, `--base-dir`, `--tokenizer`, `--style`,
|
|
24
|
+
`--lang ja`, and repeated `--attribute` options. Excluded, unmapped, and protected
|
|
25
|
+
blocks are not prose-scored. Coverage notices remain important when interpreting
|
|
26
|
+
a score. MeCab/IPADIC is the default; literal mode must be selected explicitly.
|
|
27
|
+
|
|
28
|
+
AI evaluation requires an installed, authenticated Codex or Claude CLI, and may
|
|
29
|
+
send the selected paragraph text and headings to its configured provider and
|
|
30
|
+
consume account usage. It receives no candidate findings or source file paths.
|
|
31
|
+
`--model` selects the evaluator model, and `--timeout` sets the invocation timeout
|
|
32
|
+
(default 300 seconds); both require `--agent`. Temporary evaluation files are
|
|
33
|
+
removed after scoring. Use `--json --output FILE` to retain the result. Output
|
|
34
|
+
files are never overwritten, and existing output is rejected before invoking an
|
|
35
|
+
evaluator. A file with no unmasked prose is not sent to an evaluator.
|
|
36
|
+
|
|
37
|
+
[Back to README](../README.md)
|