@usejunior/docx-mcp 0.18.0 → 0.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/cli/commands/compare.d.ts +13 -8
- package/dist/cli/commands/compare.d.ts.map +1 -1
- package/dist/cli/commands/compare.js +29 -34
- package/dist/cli/commands/compare.js.map +1 -1
- package/dist/cli/commands/edit.d.ts.map +1 -1
- package/dist/cli/commands/edit.js +5 -18
- package/dist/cli/commands/edit.js.map +1 -1
- package/dist/cli/commands/grep.d.ts.map +1 -1
- package/dist/cli/commands/grep.js +11 -4
- package/dist/cli/commands/grep.js.map +1 -1
- package/dist/cli/flag_parser.d.ts.map +1 -1
- package/dist/cli/flag_parser.js +11 -0
- package/dist/cli/flag_parser.js.map +1 -1
- package/dist/cli/help.d.ts +1 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +35 -1
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +47 -18
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/output_option.d.ts +22 -0
- package/dist/cli/output_option.d.ts.map +1 -0
- package/dist/cli/output_option.js +67 -0
- package/dist/cli/output_option.js.map +1 -0
- package/dist/cli/tool_runner.d.ts +39 -1
- package/dist/cli/tool_runner.d.ts.map +1 -1
- package/dist/cli/tool_runner.js +79 -5
- package/dist/cli/tool_runner.js.map +1 -1
- package/dist/cli.js +8 -2
- package/dist/cli.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +28 -0
- package/dist/server.js.map +1 -1
- package/dist/session/manager.d.ts +5 -0
- package/dist/session/manager.d.ts.map +1 -1
- package/dist/session/manager.js +9 -2
- package/dist/session/manager.js.map +1 -1
- package/dist/tool_catalog.d.ts +106 -8
- package/dist/tool_catalog.d.ts.map +1 -1
- package/dist/tool_catalog.js +150 -5
- package/dist/tool_catalog.js.map +1 -1
- package/dist/tools/accept_ai_edits.d.ts.map +1 -1
- package/dist/tools/accept_ai_edits.js +4 -1
- package/dist/tools/accept_ai_edits.js.map +1 -1
- package/dist/tools/accept_changes.d.ts.map +1 -1
- package/dist/tools/accept_changes.js +4 -1
- package/dist/tools/accept_changes.js.map +1 -1
- package/dist/tools/add_comment.d.ts.map +1 -1
- package/dist/tools/add_comment.js +6 -4
- package/dist/tools/add_comment.js.map +1 -1
- package/dist/tools/add_footnote.js +2 -2
- package/dist/tools/add_footnote.js.map +1 -1
- package/dist/tools/ai_revision_guard.d.ts +49 -1
- package/dist/tools/ai_revision_guard.d.ts.map +1 -1
- package/dist/tools/ai_revision_guard.js +74 -10
- package/dist/tools/ai_revision_guard.js.map +1 -1
- package/dist/tools/batch_edit.d.ts.map +1 -1
- package/dist/tools/batch_edit.js +58 -7
- package/dist/tools/batch_edit.js.map +1 -1
- package/dist/tools/clear_formatting.d.ts.map +1 -1
- package/dist/tools/clear_formatting.js +3 -2
- package/dist/tools/clear_formatting.js.map +1 -1
- package/dist/tools/compare_documents.d.ts +2 -1
- package/dist/tools/compare_documents.d.ts.map +1 -1
- package/dist/tools/compare_documents.js +31 -36
- package/dist/tools/compare_documents.js.map +1 -1
- package/dist/tools/conformance_refusal.d.ts +13 -0
- package/dist/tools/conformance_refusal.d.ts.map +1 -0
- package/dist/tools/conformance_refusal.js +19 -0
- package/dist/tools/conformance_refusal.js.map +1 -0
- package/dist/tools/delete_comment.js +2 -2
- package/dist/tools/delete_comment.js.map +1 -1
- package/dist/tools/delete_footnote.js +2 -2
- package/dist/tools/delete_footnote.js.map +1 -1
- package/dist/tools/format_layout.js +2 -2
- package/dist/tools/format_layout.js.map +1 -1
- package/dist/tools/format_numbering.d.ts +12 -0
- package/dist/tools/format_numbering.d.ts.map +1 -0
- package/dist/tools/format_numbering.js +153 -0
- package/dist/tools/format_numbering.js.map +1 -0
- package/dist/tools/format_section.d.ts +21 -0
- package/dist/tools/format_section.d.ts.map +1 -0
- package/dist/tools/format_section.js +211 -0
- package/dist/tools/format_section.js.map +1 -0
- package/dist/tools/formatting_convention.d.ts +121 -0
- package/dist/tools/formatting_convention.d.ts.map +1 -0
- package/dist/tools/formatting_convention.js +477 -0
- package/dist/tools/formatting_convention.js.map +1 -0
- package/dist/tools/get_sections.d.ts +39 -0
- package/dist/tools/get_sections.d.ts.map +1 -0
- package/dist/tools/get_sections.js +59 -0
- package/dist/tools/get_sections.js.map +1 -0
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +18 -1
- package/dist/tools/grep.js.map +1 -1
- package/dist/tools/insert_paragraph.d.ts.map +1 -1
- package/dist/tools/insert_paragraph.js +12 -3
- package/dist/tools/insert_paragraph.js.map +1 -1
- package/dist/tools/insert_section_break.d.ts +11 -0
- package/dist/tools/insert_section_break.d.ts.map +1 -0
- package/dist/tools/insert_section_break.js +167 -0
- package/dist/tools/insert_section_break.js.map +1 -0
- package/dist/tools/open_document.d.ts.map +1 -1
- package/dist/tools/open_document.js +4 -0
- package/dist/tools/open_document.js.map +1 -1
- package/dist/tools/reject_ai_edits.d.ts.map +1 -1
- package/dist/tools/reject_ai_edits.js +4 -1
- package/dist/tools/reject_ai_edits.js.map +1 -1
- package/dist/tools/replace_text.d.ts.map +1 -1
- package/dist/tools/replace_text.js +53 -4
- package/dist/tools/replace_text.js.map +1 -1
- package/dist/tools/revision_result.d.ts +11 -0
- package/dist/tools/revision_result.d.ts.map +1 -0
- package/dist/tools/revision_result.js +18 -0
- package/dist/tools/revision_result.js.map +1 -0
- package/dist/tools/session_resolution.d.ts.map +1 -1
- package/dist/tools/session_resolution.js +13 -1
- package/dist/tools/session_resolution.js.map +1 -1
- package/dist/tools/tag_parser.d.ts.map +1 -1
- package/dist/tools/tag_parser.js +15 -5
- package/dist/tools/tag_parser.js.map +1 -1
- package/dist/tools/update_footnote.js +2 -2
- package/dist/tools/update_footnote.js.map +1 -1
- package/package.json +6 -6
- package/dist/tools/comparison_defaults.d.ts +0 -9
- package/dist/tools/comparison_defaults.d.ts.map +0 -1
- package/dist/tools/comparison_defaults.js +0 -8
- package/dist/tools/comparison_defaults.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format_section.js","sourceRoot":"","sources":["../../src/tools/format_section.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAGrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,4BAA4B,GAE7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EACL,8BAA8B,EAC9B,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAqB,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAU1D,SAAS,YAAY,CAAC,IAAkC;IACtD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,uBAAuB;YAC1B,OAAO,6DAA6D,CAAC;QACvE,KAAK,mBAAmB;YACtB,OAAO,6DAA6D,CAAC;QACvE,KAAK,wBAAwB,CAAC;QAC9B,KAAK,0BAA0B,CAAC;QAChC,KAAK,yBAAyB,CAAC;QAC/B,KAAK,yBAAyB,CAAC;QAC/B,KAAK,4BAA4B,CAAC;QAClC,KAAK,4BAA4B,CAAC;QAClC,KAAK,6BAA6B;YAChC,OAAO,wDAAwD,CAAC;QAClE,KAAK,2BAA2B;YAC9B,OAAO,mDAAmD,CAAC;QAC7D,KAAK,wBAAwB;YAC3B,OAAO,uEAAuE,CAAC;QACjF,KAAK,mBAAmB;YACtB,OAAO,iEAAiE,CAAC;QAC3E,KAAK,0BAA0B;YAC7B,OAAO,gDAAgD,CAAC;QAC1D,KAAK,sBAAsB;YACzB,OAAO,2EAA2E,CAAC;QACrF,KAAK,sBAAsB;YACzB,OAAO,0EAA0E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CAAC,CAAC,4DAA4D;gBAC9D,CAAC,CAAC,+EAA+E;SACpF,EAAE,QAAQ,CAAC,CAAC,CAAC;IAChB,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IAAI,KAAK,YAAY,oBAAoB,EAAE,CAAC;YAC1C,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,GAAG,CACR,sBAAsB,EACtB,6BAA6B,YAAY,CAAC,KAAK,CAAC,EAAE,EAClD,kDAAkD,CACnD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { DocxDocument } from '@usejunior/docx-core';
|
|
2
|
+
/** Construct classes whose formatting a document may establish a convention for. */
|
|
3
|
+
export type ConventionConstruct = 'inline_defined_term' | 'proviso_keyword';
|
|
4
|
+
/**
|
|
5
|
+
* The comparison tuple. Deliberately the three properties a drafter actually
|
|
6
|
+
* uses to mark these constructs; font, size and colour vary for reasons that
|
|
7
|
+
* have nothing to do with the construct (headings, tables, footers) and would
|
|
8
|
+
* make the mode meaningless.
|
|
9
|
+
*/
|
|
10
|
+
export type ConventionTuple = {
|
|
11
|
+
bold: boolean;
|
|
12
|
+
italic: boolean;
|
|
13
|
+
underline: boolean;
|
|
14
|
+
};
|
|
15
|
+
/** A character range inside a paragraph's visible text. */
|
|
16
|
+
type ConstructSpan = {
|
|
17
|
+
start: number;
|
|
18
|
+
end: number;
|
|
19
|
+
key: string;
|
|
20
|
+
label: string;
|
|
21
|
+
};
|
|
22
|
+
/** One divergence, structured so callers can attribute it to a step or render it. */
|
|
23
|
+
export type ConventionWarning = {
|
|
24
|
+
construct: ConventionConstruct;
|
|
25
|
+
/** The construct's own text — the defined term, or the proviso keyword. */
|
|
26
|
+
term: string;
|
|
27
|
+
/** Human-readable rendering, matching the `warnings` channel's string shape. */
|
|
28
|
+
message: string;
|
|
29
|
+
};
|
|
30
|
+
export type FormattingConventionOptions = {
|
|
31
|
+
/**
|
|
32
|
+
* The text this mutation inserts. The check is gated on this: it runs only
|
|
33
|
+
* when the inserted text itself contains a construct, and is skipped
|
|
34
|
+
* entirely otherwise. Settled on #687 (2026-07-29) — cost does not constrain
|
|
35
|
+
* the check, so the trigger is chosen for precision.
|
|
36
|
+
*/
|
|
37
|
+
insertedText: string;
|
|
38
|
+
/** `w:ins/@w:author` value identifying runs this session inserted. */
|
|
39
|
+
aiAuthor: string;
|
|
40
|
+
/**
|
|
41
|
+
* The document as it stood *before* this mutation. It supplies the
|
|
42
|
+
* convention — the standard an edit is judged against is the document the
|
|
43
|
+
* edit arrived at, never one this edit helped write — and it is differenced
|
|
44
|
+
* against the preview to tell this mutation's insertions apart from earlier
|
|
45
|
+
* ones by the same author.
|
|
46
|
+
*/
|
|
47
|
+
baselineDoc: DocxDocument;
|
|
48
|
+
/**
|
|
49
|
+
* Minimum comparable instances before a document is treated as having a
|
|
50
|
+
* convention at all. Below this, stay silent.
|
|
51
|
+
*/
|
|
52
|
+
minInstances?: number;
|
|
53
|
+
/** Share of instances the modal tuple must hold to count as a convention. */
|
|
54
|
+
dominanceThreshold?: number;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Thresholds from the #687 design comment: at least 5 comparable instances of
|
|
58
|
+
* the construct, with the modal `(bold, italic, underline)` tuple holding at
|
|
59
|
+
* least 80% of them. Evaluated over the population of *comparable constructs*,
|
|
60
|
+
* never over the document's runs at large — a naive quoted-text match hits a
|
|
61
|
+
* large share of every run in a real agreement, which would compute the mode
|
|
62
|
+
* over a polluted population.
|
|
63
|
+
*/
|
|
64
|
+
export declare const DEFAULT_MIN_INSTANCES = 5;
|
|
65
|
+
export declare const DEFAULT_DOMINANCE_THRESHOLD = 0.8;
|
|
66
|
+
export declare const FORMATTING_CONVENTION_WARNING_CODE = "FORMATTING_CONVENTION_DIVERGENCE";
|
|
67
|
+
/**
|
|
68
|
+
* Inline defined terms: quoted terms inside a parenthetical where every
|
|
69
|
+
* segment around them is definitional.
|
|
70
|
+
*
|
|
71
|
+
* The reported span covers the term text *between* the quote marks and not the
|
|
72
|
+
* marks themselves. That is not cosmetic. Measured across the two corpus
|
|
73
|
+
* agreements in `tests/test_documents`, the opening and closing quotes almost
|
|
74
|
+
* always sit in the surrounding runs — `[" (the “", plain]["Fund", bold]["”) is
|
|
75
|
+
* made on", plain]` is the typical shape — so a span including the marks reads
|
|
76
|
+
* as three disagreeing runs and the instance is discarded as incomparable.
|
|
77
|
+
* Narrowed to the term, the same instance resolves cleanly to the formatting a
|
|
78
|
+
* reader actually sees on the defined term.
|
|
79
|
+
*/
|
|
80
|
+
export declare function findInlineDefinedTermSpans(text: string): ConstructSpan[];
|
|
81
|
+
export declare function findProvisoKeywordSpans(text: string): ConstructSpan[];
|
|
82
|
+
export declare const CONVENTION_CONSTRUCTS: ConventionConstruct[];
|
|
83
|
+
export type ConventionSummary = {
|
|
84
|
+
/** Comparable instances the mode was computed over. */
|
|
85
|
+
total: number;
|
|
86
|
+
/** How many of them carry the modal tuple. */
|
|
87
|
+
modeCount: number;
|
|
88
|
+
tuple: ConventionTuple;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* The convention a document establishes for one construct class, or null when
|
|
92
|
+
* it establishes none. Exposed so a caller — or a test working against a real
|
|
93
|
+
* corpus document — can ask what a document's own standard is without running
|
|
94
|
+
* an edit through it.
|
|
95
|
+
*/
|
|
96
|
+
export declare function summarizeDocumentConvention(doc: DocxDocument, construct: ConventionConstruct, opts?: {
|
|
97
|
+
minInstances?: number;
|
|
98
|
+
dominanceThreshold?: number;
|
|
99
|
+
}): ConventionSummary | null;
|
|
100
|
+
/**
|
|
101
|
+
* Compare the constructs this mutation inserted against the document's own
|
|
102
|
+
* convention for the same construct class, and describe every divergence.
|
|
103
|
+
*
|
|
104
|
+
* An empty result means either "nothing inserted that this checks" or "no
|
|
105
|
+
* established convention" — the two are deliberately indistinguishable to the
|
|
106
|
+
* caller, because both mean the same thing operationally: say nothing.
|
|
107
|
+
*
|
|
108
|
+
* Never throws: a convention warning that could fail an edit would violate the
|
|
109
|
+
* advisory contract, so an unexpected document shape degrades to silence.
|
|
110
|
+
*
|
|
111
|
+
* @param previewDoc the document as it will be once the mutation is applied
|
|
112
|
+
*/
|
|
113
|
+
export declare function checkFormattingConvention(previewDoc: DocxDocument, options: FormattingConventionOptions): ConventionWarning[];
|
|
114
|
+
/**
|
|
115
|
+
* The construct keys present in `text`, for callers that must attribute a
|
|
116
|
+
* warning back to the step that produced it (batch_edit preflights the whole
|
|
117
|
+
* sequence at once, so the step is not otherwise recoverable).
|
|
118
|
+
*/
|
|
119
|
+
export declare function insertedConstructKeys(text: string): Map<ConventionConstruct, Set<string>>;
|
|
120
|
+
export {};
|
|
121
|
+
//# sourceMappingURL=formatting_convention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatting_convention.d.ts","sourceRoot":"","sources":["../../src/tools/formatting_convention.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAOb,MAAM,sBAAsB,CAAC;AAuC9B,oFAAoF;AACpF,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,GAAG,iBAAiB,CAAC;AAO5E;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAsBF,2DAA2D;AAC3D,KAAK,aAAa,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,qFAAqF;AACrF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,mBAAmB,CAAC;IAC/B,2EAA2E;IA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GACnC,iBAAiB,EAAE,CAyFrB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,mBAAmB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAOzF"}
|
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
import { OOXML, W, extractEffectiveRunFormatting, getFirstChild, getParagraphRuns, } from '@usejunior/docx-core';
|
|
2
|
+
/**
|
|
3
|
+
* Formatting-convention check for inserted runs (issue #687).
|
|
4
|
+
*
|
|
5
|
+
* A well-formed edit can still be visibly wrong: an inserted inline defined
|
|
6
|
+
* term rendered in plain runs inside an agreement that sets every other
|
|
7
|
+
* parenthetical definition in bold italic round-trips, extracts byte-identical
|
|
8
|
+
* text, and passes every structural validator. Nothing compares the inserted
|
|
9
|
+
* run against the document's own distribution of the same construct, so the
|
|
10
|
+
* defect is invisible to `validate_document` (well-formedness) and to
|
|
11
|
+
* `validate_ai_revisions` (revision-markup legality) alike.
|
|
12
|
+
*
|
|
13
|
+
* This module compares an inserted construct's *resolved* run formatting
|
|
14
|
+
* against the modal formatting of the same construct class elsewhere in the
|
|
15
|
+
* document. Four properties are load-bearing:
|
|
16
|
+
*
|
|
17
|
+
* 1. **Structural, never textual.** Divergence is decided on the
|
|
18
|
+
* `(bold, italic, underline)` tuple. Text is used only to *locate*
|
|
19
|
+
* instances, never to judge them.
|
|
20
|
+
* 2. **Effective, not declared, formatting.** Resolution goes through
|
|
21
|
+
* {@link extractEffectiveRunFormatting}, so a run that inherits bold italic
|
|
22
|
+
* from a character or paragraph style is not reported as divergent. That is
|
|
23
|
+
* the entire reason #684 was a prerequisite of #687.
|
|
24
|
+
* 3. **This mutation's insertions, not the session's.** "Inserted" is decided
|
|
25
|
+
* by differencing the pre-mutation document against the preview, the same
|
|
26
|
+
* multiset-consumption technique `splitIntroducedDiagnostics` uses in
|
|
27
|
+
* `ai_revision_guard.ts`. A `w:ins` an earlier edit in the same session left
|
|
28
|
+
* behind is part of the document now, not part of this edit.
|
|
29
|
+
* 4. **Advisory only.** The result is a list of warnings on the channel
|
|
30
|
+
* #686/#701 built. Nothing here can block an edit, and a document with no
|
|
31
|
+
* established convention produces silence rather than a guess.
|
|
32
|
+
*
|
|
33
|
+
* @see https://github.com/UseJunior/safe-docx/issues/687
|
|
34
|
+
*/
|
|
35
|
+
/** `w:ins` is not in the shared `W` vocabulary; `w:del` is (`W.del`). */
|
|
36
|
+
const W_INS = 'ins';
|
|
37
|
+
const CONSTRUCT_LABELS = {
|
|
38
|
+
inline_defined_term: 'inline defined term',
|
|
39
|
+
proviso_keyword: 'proviso keyword',
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Thresholds from the #687 design comment: at least 5 comparable instances of
|
|
43
|
+
* the construct, with the modal `(bold, italic, underline)` tuple holding at
|
|
44
|
+
* least 80% of them. Evaluated over the population of *comparable constructs*,
|
|
45
|
+
* never over the document's runs at large — a naive quoted-text match hits a
|
|
46
|
+
* large share of every run in a real agreement, which would compute the mode
|
|
47
|
+
* over a polluted population.
|
|
48
|
+
*/
|
|
49
|
+
export const DEFAULT_MIN_INSTANCES = 5;
|
|
50
|
+
export const DEFAULT_DOMINANCE_THRESHOLD = 0.8;
|
|
51
|
+
export const FORMATTING_CONVENTION_WARNING_CODE = 'FORMATTING_CONVENTION_DIVERGENCE';
|
|
52
|
+
// ── Construct matchers ─────────────────────────────────────────────────────
|
|
53
|
+
//
|
|
54
|
+
// Matcher precision, not throughput, decides whether this check is
|
|
55
|
+
// trustworthy. Quoted text alone is far too common to serve as the matcher, so
|
|
56
|
+
// a defined term must carry the parenthetical enclosure, definitional phrasing
|
|
57
|
+
// around every quoted term, and nothing else: `(the "Term")`,
|
|
58
|
+
// `(each, a "Term")`, `(collectively, the "Buyer" and the "Seller")`.
|
|
59
|
+
/**
|
|
60
|
+
* Double quotes only. Curly single quotes were tried and removed: `’` is also
|
|
61
|
+
* the apostrophe, so `(the ‘Company’s Assets’)` closes at the possessive and
|
|
62
|
+
* the term comes out truncated. Supporting them needs apostrophe-aware
|
|
63
|
+
* scanning, and defined terms in the corpus this targets use double quotes.
|
|
64
|
+
*/
|
|
65
|
+
const QUOTE_PAIRS = [
|
|
66
|
+
['“', '”'], // “ ”
|
|
67
|
+
['"', '"'],
|
|
68
|
+
];
|
|
69
|
+
/**
|
|
70
|
+
* Words allowed to precede the first quoted term inside the parenthetical.
|
|
71
|
+
* Anything else — `see`, `as defined in`, a citation — means this is not a
|
|
72
|
+
* definition and must not join the population.
|
|
73
|
+
*/
|
|
74
|
+
const LEAD_IN_RE = /^[\s,;]*(?:(?:each|collectively|together|individually|jointly|severally|and|or|being|such|this|these|those|herein|hereinafter|referred\s+to\s+as|known\s+as|called|defined\s+as)[\s,;]*)*(?:the|a|an)?[\s,;]*$/i;
|
|
75
|
+
/**
|
|
76
|
+
* Between two quoted terms in one parenthetical, only a conjunction may
|
|
77
|
+
* appear. Without this, `(the "Buyer" shall notify the "Seller")` — ordinary
|
|
78
|
+
* prose — donates two instances to the population and can invent or destroy
|
|
79
|
+
* the mode on its own.
|
|
80
|
+
*/
|
|
81
|
+
const INTER_QUOTE_RE = /^[\s,;]*(?:and|or)?[\s,;]*(?:the|a|an)?[\s,;]*$/i;
|
|
82
|
+
/** After the last quoted term, only closing punctuation may remain. */
|
|
83
|
+
const TRAILER_RE = /^[\s,;.]*$/;
|
|
84
|
+
/**
|
|
85
|
+
* Top-level, properly closed, non-nesting parentheticals. A regex scan accepts
|
|
86
|
+
* the inner half of `((the "Term")` and calls it an enclosure; a depth-tracking
|
|
87
|
+
* scan does not. Malformed parentheses are real in tracked-change views, so
|
|
88
|
+
* this is population hygiene rather than pedantry.
|
|
89
|
+
*/
|
|
90
|
+
function findTopLevelParentheticals(text) {
|
|
91
|
+
const out = [];
|
|
92
|
+
const stack = [];
|
|
93
|
+
for (let i = 0; i < text.length; i++) {
|
|
94
|
+
const ch = text[i];
|
|
95
|
+
if (ch === '(') {
|
|
96
|
+
if (stack.length > 0)
|
|
97
|
+
stack[stack.length - 1].nested = true;
|
|
98
|
+
stack.push({ start: i, nested: false });
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (ch !== ')')
|
|
102
|
+
continue;
|
|
103
|
+
const frame = stack.pop();
|
|
104
|
+
if (!frame)
|
|
105
|
+
continue; // stray closer: no enclosure to report
|
|
106
|
+
if (stack.length > 0)
|
|
107
|
+
continue; // a nested pair, not a top-level one
|
|
108
|
+
if (frame.nested)
|
|
109
|
+
continue; // top-level, but it contains a nested pair
|
|
110
|
+
out.push({ start: frame.start + 1, inner: text.slice(frame.start + 1, i) });
|
|
111
|
+
}
|
|
112
|
+
return out;
|
|
113
|
+
}
|
|
114
|
+
function findQuotedSpans(text) {
|
|
115
|
+
const spans = [];
|
|
116
|
+
for (let i = 0; i < text.length; i++) {
|
|
117
|
+
const pair = QUOTE_PAIRS.find(([open]) => text[i] === open);
|
|
118
|
+
if (!pair)
|
|
119
|
+
continue;
|
|
120
|
+
const close = pair[1];
|
|
121
|
+
// A straight-quote pair opens and closes with the same character, so the
|
|
122
|
+
// search for the closer must start after the opener.
|
|
123
|
+
const closeIdx = text.indexOf(close, i + 1);
|
|
124
|
+
if (closeIdx < 0)
|
|
125
|
+
continue;
|
|
126
|
+
const inner = text.slice(i + 1, closeIdx);
|
|
127
|
+
if (inner.length === 0)
|
|
128
|
+
continue;
|
|
129
|
+
spans.push({ start: i, end: closeIdx + 1, inner });
|
|
130
|
+
i = closeIdx;
|
|
131
|
+
}
|
|
132
|
+
return spans;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Inline defined terms: quoted terms inside a parenthetical where every
|
|
136
|
+
* segment around them is definitional.
|
|
137
|
+
*
|
|
138
|
+
* The reported span covers the term text *between* the quote marks and not the
|
|
139
|
+
* marks themselves. That is not cosmetic. Measured across the two corpus
|
|
140
|
+
* agreements in `tests/test_documents`, the opening and closing quotes almost
|
|
141
|
+
* always sit in the surrounding runs — `[" (the “", plain]["Fund", bold]["”) is
|
|
142
|
+
* made on", plain]` is the typical shape — so a span including the marks reads
|
|
143
|
+
* as three disagreeing runs and the instance is discarded as incomparable.
|
|
144
|
+
* Narrowed to the term, the same instance resolves cleanly to the formatting a
|
|
145
|
+
* reader actually sees on the defined term.
|
|
146
|
+
*/
|
|
147
|
+
export function findInlineDefinedTermSpans(text) {
|
|
148
|
+
const out = [];
|
|
149
|
+
for (const { start: innerStart, inner } of findTopLevelParentheticals(text)) {
|
|
150
|
+
const quoted = findQuotedSpans(inner);
|
|
151
|
+
if (quoted.length === 0)
|
|
152
|
+
continue;
|
|
153
|
+
if (!LEAD_IN_RE.test(inner.slice(0, quoted[0].start)))
|
|
154
|
+
continue;
|
|
155
|
+
if (!TRAILER_RE.test(inner.slice(quoted[quoted.length - 1].end)))
|
|
156
|
+
continue;
|
|
157
|
+
let connected = true;
|
|
158
|
+
for (let i = 1; i < quoted.length; i++) {
|
|
159
|
+
if (!INTER_QUOTE_RE.test(inner.slice(quoted[i - 1].end, quoted[i].start))) {
|
|
160
|
+
connected = false;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (!connected)
|
|
165
|
+
continue;
|
|
166
|
+
for (const q of quoted) {
|
|
167
|
+
out.push({
|
|
168
|
+
start: innerStart + q.start + 1, // skip the opening quote mark
|
|
169
|
+
end: innerStart + q.end - 1, // stop before the closing quote mark
|
|
170
|
+
key: normalizeKey(q.inner),
|
|
171
|
+
label: q.inner,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return out;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Proviso keywords: `provided` or `however` introduced by a semicolon. The
|
|
179
|
+
* span covers the keyword itself, which is what agreements underline or
|
|
180
|
+
* italicise.
|
|
181
|
+
*/
|
|
182
|
+
const PROVISO_RE = /;\s*(provided|however)\b/gi;
|
|
183
|
+
export function findProvisoKeywordSpans(text) {
|
|
184
|
+
const out = [];
|
|
185
|
+
PROVISO_RE.lastIndex = 0;
|
|
186
|
+
let match = PROVISO_RE.exec(text);
|
|
187
|
+
while (match) {
|
|
188
|
+
const keyword = match[1];
|
|
189
|
+
const start = match.index + match[0].length - keyword.length;
|
|
190
|
+
out.push({
|
|
191
|
+
start,
|
|
192
|
+
end: start + keyword.length,
|
|
193
|
+
key: normalizeKey(keyword),
|
|
194
|
+
label: keyword,
|
|
195
|
+
});
|
|
196
|
+
match = PROVISO_RE.exec(text);
|
|
197
|
+
}
|
|
198
|
+
return out;
|
|
199
|
+
}
|
|
200
|
+
const MATCHERS = {
|
|
201
|
+
inline_defined_term: findInlineDefinedTermSpans,
|
|
202
|
+
proviso_keyword: findProvisoKeywordSpans,
|
|
203
|
+
};
|
|
204
|
+
export const CONVENTION_CONSTRUCTS = Object.keys(MATCHERS);
|
|
205
|
+
function normalizeKey(value) {
|
|
206
|
+
return value.trim().replace(/\s+/g, ' ').toLowerCase();
|
|
207
|
+
}
|
|
208
|
+
// ── Document scan ──────────────────────────────────────────────────────────
|
|
209
|
+
function paragraphStyleId(pPr) {
|
|
210
|
+
if (!pPr)
|
|
211
|
+
return null;
|
|
212
|
+
const pStyle = getFirstChild(pPr, OOXML.W_NS, W.pStyle);
|
|
213
|
+
if (!pStyle)
|
|
214
|
+
return null;
|
|
215
|
+
return (pStyle.getAttributeNS(OOXML.W_NS, 'val') ??
|
|
216
|
+
pStyle.getAttribute('w:val') ??
|
|
217
|
+
pStyle.getAttribute('val'));
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* True when `run` sits inside a `w:ins` attributed to `author`, anywhere below
|
|
221
|
+
* `paragraph`. Structural: the revision wrapper and its author attribute are
|
|
222
|
+
* what identify an insertion, not the text it carries.
|
|
223
|
+
*/
|
|
224
|
+
function isInsertedByAuthor(run, paragraph, author) {
|
|
225
|
+
let cur = run.parentNode;
|
|
226
|
+
while (cur && cur !== paragraph) {
|
|
227
|
+
if (cur.namespaceURI === OOXML.W_NS && cur.localName === W_INS) {
|
|
228
|
+
const attr = cur.getAttributeNS(OOXML.W_NS, 'author') ??
|
|
229
|
+
cur.getAttribute('w:author') ??
|
|
230
|
+
cur.getAttribute('author');
|
|
231
|
+
if (attr === author)
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
cur = cur.parentNode;
|
|
235
|
+
}
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
/** True when `run` sits inside a tracked deletion or move-from wrapper. */
|
|
239
|
+
function isRemoved(run, paragraph) {
|
|
240
|
+
let cur = run.parentNode;
|
|
241
|
+
while (cur && cur !== paragraph) {
|
|
242
|
+
if (cur.namespaceURI === OOXML.W_NS &&
|
|
243
|
+
(cur.localName === W.del || cur.localName === W.moveFrom)) {
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
cur = cur.parentNode;
|
|
247
|
+
}
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Every text-bearing run overlapping `[start, end)`, in document order. A
|
|
252
|
+
* construct is routinely split — the quote marks in one run and the term in
|
|
253
|
+
* another — and judging only the largest fragment lets a divergent fragment
|
|
254
|
+
* through unreported.
|
|
255
|
+
*/
|
|
256
|
+
function overlappingRuns(runs, start, end) {
|
|
257
|
+
const out = [];
|
|
258
|
+
const seen = new Set();
|
|
259
|
+
let pos = 0;
|
|
260
|
+
for (const run of runs) {
|
|
261
|
+
const runStart = pos;
|
|
262
|
+
const runEnd = pos + run.text.length;
|
|
263
|
+
pos = runEnd;
|
|
264
|
+
if (run.text.length === 0)
|
|
265
|
+
continue;
|
|
266
|
+
if (Math.min(end, runEnd) - Math.max(start, runStart) <= 0)
|
|
267
|
+
continue;
|
|
268
|
+
if (seen.has(run.r))
|
|
269
|
+
continue;
|
|
270
|
+
seen.add(run.r);
|
|
271
|
+
out.push(run.r);
|
|
272
|
+
}
|
|
273
|
+
return out;
|
|
274
|
+
}
|
|
275
|
+
function collectInstances(doc, styles, construct, aiAuthor) {
|
|
276
|
+
const matcher = MATCHERS[construct];
|
|
277
|
+
const instances = [];
|
|
278
|
+
for (const p of doc.getParagraphs()) {
|
|
279
|
+
const runs = getParagraphRuns(p);
|
|
280
|
+
if (runs.length === 0)
|
|
281
|
+
continue;
|
|
282
|
+
const text = runs.map((run) => run.text).join('');
|
|
283
|
+
if (text.length === 0)
|
|
284
|
+
continue;
|
|
285
|
+
const spans = matcher(text);
|
|
286
|
+
if (spans.length === 0)
|
|
287
|
+
continue;
|
|
288
|
+
const pPr = getFirstChild(p, OOXML.W_NS, W.pPr);
|
|
289
|
+
const styleId = paragraphStyleId(pPr);
|
|
290
|
+
for (const span of spans) {
|
|
291
|
+
const runTuples = [];
|
|
292
|
+
const insertedRunTuples = [];
|
|
293
|
+
for (const run of overlappingRuns(runs, span.start, span.end)) {
|
|
294
|
+
if (isRemoved(run, p))
|
|
295
|
+
continue;
|
|
296
|
+
// Theme is deliberately omitted: it feeds only font and colour
|
|
297
|
+
// resolution, neither of which is in the comparison tuple.
|
|
298
|
+
const fmt = extractEffectiveRunFormatting({
|
|
299
|
+
run,
|
|
300
|
+
paragraphPPr: pPr,
|
|
301
|
+
paragraphStyleId: styleId,
|
|
302
|
+
styles,
|
|
303
|
+
});
|
|
304
|
+
const tuple = { bold: fmt.bold, italic: fmt.italic, underline: fmt.underline };
|
|
305
|
+
runTuples.push(tuple);
|
|
306
|
+
if (isInsertedByAuthor(run, p, aiAuthor))
|
|
307
|
+
insertedRunTuples.push(tuple);
|
|
308
|
+
}
|
|
309
|
+
if (runTuples.length === 0)
|
|
310
|
+
continue;
|
|
311
|
+
const first = runTuples[0];
|
|
312
|
+
const homogeneous = runTuples.every((t) => tupleKey(t) === tupleKey(first));
|
|
313
|
+
instances.push({
|
|
314
|
+
key: span.key,
|
|
315
|
+
label: span.label,
|
|
316
|
+
runTuples,
|
|
317
|
+
homogeneous,
|
|
318
|
+
tuple: first,
|
|
319
|
+
insertedRunTuples,
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return instances;
|
|
324
|
+
}
|
|
325
|
+
// ── Convention resolution ──────────────────────────────────────────────────
|
|
326
|
+
function tupleKey(tuple) {
|
|
327
|
+
return `${tuple.bold ? 1 : 0}${tuple.italic ? 1 : 0}${tuple.underline ? 1 : 0}`;
|
|
328
|
+
}
|
|
329
|
+
function describeTuple(tuple) {
|
|
330
|
+
return `bold=${tuple.bold}, italic=${tuple.italic}, underline=${tuple.underline}`;
|
|
331
|
+
}
|
|
332
|
+
/** Identity of one instance for multiset differencing: text plus every tuple. */
|
|
333
|
+
function instanceFingerprint(instance) {
|
|
334
|
+
return `${instance.key}|${instance.runTuples.map(tupleKey).join(',')}`;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* The dominant tuple, or null when the population is too small or too split to
|
|
338
|
+
* call a convention. A tie can never pass: two distinct tuples cannot each
|
|
339
|
+
* hold 80% of one population.
|
|
340
|
+
*/
|
|
341
|
+
function resolveConvention(instances, minInstances, dominanceThreshold) {
|
|
342
|
+
if (instances.length < minInstances)
|
|
343
|
+
return null;
|
|
344
|
+
const counts = new Map();
|
|
345
|
+
for (const instance of instances) {
|
|
346
|
+
const key = tupleKey(instance.tuple);
|
|
347
|
+
const entry = counts.get(key) ?? { count: 0, tuple: instance.tuple };
|
|
348
|
+
entry.count += 1;
|
|
349
|
+
counts.set(key, entry);
|
|
350
|
+
}
|
|
351
|
+
let best = null;
|
|
352
|
+
for (const entry of counts.values()) {
|
|
353
|
+
if (!best || entry.count > best.count)
|
|
354
|
+
best = entry;
|
|
355
|
+
}
|
|
356
|
+
if (!best)
|
|
357
|
+
return null;
|
|
358
|
+
if (best.count / instances.length < dominanceThreshold)
|
|
359
|
+
return null;
|
|
360
|
+
return { total: instances.length, modeCount: best.count, tuple: best.tuple };
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* The convention a document establishes for one construct class, or null when
|
|
364
|
+
* it establishes none. Exposed so a caller — or a test working against a real
|
|
365
|
+
* corpus document — can ask what a document's own standard is without running
|
|
366
|
+
* an edit through it.
|
|
367
|
+
*/
|
|
368
|
+
export function summarizeDocumentConvention(doc, construct, opts) {
|
|
369
|
+
// No author can match the empty string, so nothing is classified as inserted.
|
|
370
|
+
const instances = collectInstances(doc, doc.getStylesModel(), construct, '');
|
|
371
|
+
return resolveConvention(instances.filter((instance) => instance.homogeneous), opts?.minInstances ?? DEFAULT_MIN_INSTANCES, opts?.dominanceThreshold ?? DEFAULT_DOMINANCE_THRESHOLD);
|
|
372
|
+
}
|
|
373
|
+
// ── Entry point ────────────────────────────────────────────────────────────
|
|
374
|
+
/**
|
|
375
|
+
* Compare the constructs this mutation inserted against the document's own
|
|
376
|
+
* convention for the same construct class, and describe every divergence.
|
|
377
|
+
*
|
|
378
|
+
* An empty result means either "nothing inserted that this checks" or "no
|
|
379
|
+
* established convention" — the two are deliberately indistinguishable to the
|
|
380
|
+
* caller, because both mean the same thing operationally: say nothing.
|
|
381
|
+
*
|
|
382
|
+
* Never throws: a convention warning that could fail an edit would violate the
|
|
383
|
+
* advisory contract, so an unexpected document shape degrades to silence.
|
|
384
|
+
*
|
|
385
|
+
* @param previewDoc the document as it will be once the mutation is applied
|
|
386
|
+
*/
|
|
387
|
+
export function checkFormattingConvention(previewDoc, options) {
|
|
388
|
+
const { insertedText, aiAuthor, baselineDoc, minInstances = DEFAULT_MIN_INSTANCES, dominanceThreshold = DEFAULT_DOMINANCE_THRESHOLD, } = options;
|
|
389
|
+
if (!insertedText || !aiAuthor || !baselineDoc)
|
|
390
|
+
return [];
|
|
391
|
+
try {
|
|
392
|
+
let previewStyles = null;
|
|
393
|
+
let baselineStyles = null;
|
|
394
|
+
const warnings = [];
|
|
395
|
+
for (const construct of CONVENTION_CONSTRUCTS) {
|
|
396
|
+
// Gate: only run when the inserted text itself carries this construct.
|
|
397
|
+
const insertedSpans = MATCHERS[construct](insertedText);
|
|
398
|
+
if (insertedSpans.length === 0)
|
|
399
|
+
continue;
|
|
400
|
+
const insertedKeys = new Set(insertedSpans.map((span) => span.key));
|
|
401
|
+
baselineStyles ??= baselineDoc.getStylesModel();
|
|
402
|
+
const baseline = collectInstances(baselineDoc, baselineStyles, construct, aiAuthor);
|
|
403
|
+
// The convention is the document as this edit found it. Insertions an
|
|
404
|
+
// earlier edit in the same session left behind are part of that document
|
|
405
|
+
// and keep their vote.
|
|
406
|
+
const convention = resolveConvention(baseline.filter((instance) => instance.homogeneous), minInstances, dominanceThreshold);
|
|
407
|
+
if (!convention)
|
|
408
|
+
continue;
|
|
409
|
+
previewStyles ??= previewDoc.getStylesModel();
|
|
410
|
+
const preview = collectInstances(previewDoc, previewStyles, construct, aiAuthor);
|
|
411
|
+
// Which insertions are *this* mutation's: consume the pre-existing
|
|
412
|
+
// AI-authored instances by fingerprint, exactly as
|
|
413
|
+
// splitIntroducedDiagnostics consumes pre-existing diagnostics. What is
|
|
414
|
+
// left over did not exist before this mutation ran.
|
|
415
|
+
const remaining = new Map();
|
|
416
|
+
for (const instance of baseline) {
|
|
417
|
+
if (instance.insertedRunTuples.length === 0)
|
|
418
|
+
continue;
|
|
419
|
+
const fp = instanceFingerprint(instance);
|
|
420
|
+
remaining.set(fp, (remaining.get(fp) ?? 0) + 1);
|
|
421
|
+
}
|
|
422
|
+
const expected = tupleKey(convention.tuple);
|
|
423
|
+
const share = Math.round((convention.modeCount / convention.total) * 100);
|
|
424
|
+
const reported = new Set();
|
|
425
|
+
for (const instance of preview) {
|
|
426
|
+
if (instance.insertedRunTuples.length === 0)
|
|
427
|
+
continue;
|
|
428
|
+
if (!insertedKeys.has(instance.key))
|
|
429
|
+
continue;
|
|
430
|
+
const fp = instanceFingerprint(instance);
|
|
431
|
+
const count = remaining.get(fp) ?? 0;
|
|
432
|
+
if (count > 0) {
|
|
433
|
+
remaining.set(fp, count - 1); // pre-existing; not this mutation's doing
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
for (const tuple of instance.insertedRunTuples) {
|
|
437
|
+
const actual = tupleKey(tuple);
|
|
438
|
+
if (actual === expected)
|
|
439
|
+
continue;
|
|
440
|
+
const dedupeKey = `${instance.key}|${actual}`;
|
|
441
|
+
if (reported.has(dedupeKey))
|
|
442
|
+
continue;
|
|
443
|
+
reported.add(dedupeKey);
|
|
444
|
+
warnings.push({
|
|
445
|
+
construct,
|
|
446
|
+
term: instance.label,
|
|
447
|
+
message: `${FORMATTING_CONVENTION_WARNING_CODE}: inserted ${CONSTRUCT_LABELS[construct]} ` +
|
|
448
|
+
`"${instance.label}" is ${describeTuple(tuple)}, but ` +
|
|
449
|
+
`${convention.modeCount} of ${convention.total} (${share}%) of this document's ` +
|
|
450
|
+
`${CONSTRUCT_LABELS[construct]}s are ${describeTuple(convention.tuple)} ` +
|
|
451
|
+
`(construct=${construct})`,
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
return warnings;
|
|
457
|
+
}
|
|
458
|
+
catch {
|
|
459
|
+
// Advisory check: never let a scan failure surface as an edit failure.
|
|
460
|
+
return [];
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* The construct keys present in `text`, for callers that must attribute a
|
|
465
|
+
* warning back to the step that produced it (batch_edit preflights the whole
|
|
466
|
+
* sequence at once, so the step is not otherwise recoverable).
|
|
467
|
+
*/
|
|
468
|
+
export function insertedConstructKeys(text) {
|
|
469
|
+
const out = new Map();
|
|
470
|
+
for (const construct of CONVENTION_CONSTRUCTS) {
|
|
471
|
+
const keys = new Set(MATCHERS[construct](text).map((span) => span.key));
|
|
472
|
+
if (keys.size > 0)
|
|
473
|
+
out.set(construct, keys);
|
|
474
|
+
}
|
|
475
|
+
return out;
|
|
476
|
+
}
|
|
477
|
+
//# sourceMappingURL=formatting_convention.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatting_convention.js","sourceRoot":"","sources":["../../src/tools/formatting_convention.ts"],"names":[],"mappings":"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