rhwp 0.9.1

HWP/HWPX document engine for Rust applications, WebAssembly, and CLI automation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
use super::{tool, tool_with_optional_args};

pub(super) fn extend(tools: &mut Vec<serde_json::Value>) {
    tools.extend([
        tool_with_optional_args(
            "hwp_delete_text",
            "[#5011] 문단 좌표에서 글자를 지운다. 주소는 search 와 같다. 코어 delete_text_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "section": { "type": "integer", "minimum": 0 },
                    "paragraph": { "type": "integer", "minimum": 0 },
                    "offset": { "type": "integer", "minimum": 0 },
                    "count": { "type": "integer", "minimum": 1 },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "count"],
            }),
            "edit",
            serde_json::json!(["edit", "delete-text", "{path}", "--count", "{count}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "paragraph", "args": ["--para", "{paragraph}"] },
                { "when": "offset", "args": ["--offset", "{offset}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "paragraph", "offset", "count", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_delete_paragraph",
            "[#5012] 지정 문단을 지운다. 구역의 마지막 문단은 코어가 거부한다. 코어 delete_paragraph_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "section": { "type": "integer", "minimum": 0 },
                    "paragraph": { "type": "integer", "minimum": 0 },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path"],
            }),
            "edit",
            serde_json::json!(["edit", "delete-paragraph", "{path}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "paragraph", "args": ["--para", "{paragraph}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "paragraph", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_insert_endnote",
            "[#5013] 문단 좌표에 미주를 끼운다. 주소는 search 와 같다. 코어 insert_endnote_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "section": { "type": "integer", "minimum": 0 },
                    "paragraph": { "type": "integer", "minimum": 0 },
                    "offset": { "type": "integer", "minimum": 0 },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path"],
            }),
            "edit",
            serde_json::json!(["edit", "insert-endnote", "{path}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "paragraph", "args": ["--para", "{paragraph}"] },
                { "when": "offset", "args": ["--offset", "{offset}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "paragraph", "offset", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_merge_paragraph",
            "[#5018] 지정 문단을 바로 앞 문단에 합친다. para 는 합쳐질 문단(1 이상). 코어 merge_paragraph_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "section": { "type": "integer", "minimum": 0 },
                    "paragraph": { "type": "integer", "minimum": 1 },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path"],
            }),
            "edit",
            serde_json::json!(["edit", "merge-paragraph", "{path}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "paragraph", "args": ["--para", "{paragraph}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "paragraph", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_delete_footnote",
            "[#5017] 본문 각주/미주 컨트롤을 지운다. section/para/ctrl 은 0 기준. 코어 delete_footnote_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "section": { "type": "integer", "minimum": 0 },
                    "paragraph": { "type": "integer", "minimum": 0 },
                    "ctrl": { "type": "integer", "minimum": 0, "description": "문단 안 컨트롤 인덱스 (0부터)" },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "section", "paragraph", "ctrl"],
            }),
            "edit",
            serde_json::json!(["edit", "delete-footnote", "{path}", "--section", "{section}", "--para", "{paragraph}", "--ctrl", "{ctrl}", "--json"]),
            serde_json::json!([
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "paragraph", "ctrl", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_delete_text_in_footnote",
            "각주/미주 문단에서 글자를 지운다. section/para/ctrl/fnPara/offset 은 0 기준. 코어 delete_text_in_footnote_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "section": { "type": "integer", "minimum": 0 },
                    "paragraph": { "type": "integer", "minimum": 0 },
                    "ctrl": { "type": "integer", "minimum": 0, "description": "문단 안 각주/미주 컨트롤 인덱스 (0부터)" },
                    "fnPara": { "type": "integer", "minimum": 0, "description": "각주/미주 안 문단 인덱스 (0부터)" },
                    "offset": { "type": "integer", "minimum": 0 },
                    "count": { "type": "integer", "minimum": 1, "description": "지울 글자 수 (1 이상)" },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "count"],
            }),
            "edit",
            serde_json::json!(["edit", "delete-text-in-footnote", "{path}", "--count", "{count}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "paragraph", "args": ["--para", "{paragraph}"] },
                { "when": "ctrl", "args": ["--ctrl", "{ctrl}"] },
                { "when": "fnPara", "args": ["--fn-para", "{fnPara}"] },
                { "when": "offset", "args": ["--offset", "{offset}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "paragraph", "ctrl", "fnPara", "offset", "count", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_group_shapes",
            "같은 구역의 도형/그림을 묶는다. targets 는 \"para,ctrl;para,ctrl\" (2개 이상). 코어 group_shapes_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "targets": { "type": "string", "description": "para,ctrl;para,ctrl 형식의 도형 좌표 목록" },
                    "section": { "type": "integer", "minimum": 0 },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "targets"],
            }),
            "edit",
            serde_json::json!(["edit", "group-shapes", "{path}", "--targets", "{targets}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "paragraph", "ctrl", "count", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_set_page_def",
            "구역의 용지 설정(PageDef)을 바꾼다. --props 는 width/height/marginLeft 등 HWPUNIT JSON. 코어 set_page_def_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "section": { "type": "integer", "minimum": 0 },
                    "props": { "type": "string", "description": "용지 설정 JSON (HWPUNIT)" },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "props"],
            }),
            "edit",
            serde_json::json!(["edit", "set-page-def", "{path}", "--props", "{props}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "props", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_set_section_def",
            "구역 정의(SectionDef)를 바꾼다. --props 는 hideHeader/columnSpacing/pageNum 등 JSON. 코어 set_section_def_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "section": { "type": "integer", "minimum": 0 },
                    "props": { "type": "string", "description": "구역 정의 JSON (예: {\"hideHeader\":true})" },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "props"],
            }),
            "edit",
            serde_json::json!(["edit", "set-section-def", "{path}", "--props", "{props}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "props", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_add_bookmark",
            "[#5026] 지정 좌표에 책갈피를 넣는다. 같은 이름은 거부. 코어 add_bookmark_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "name": {
                        "type": "string",
                        "pattern": r".*\S.*",
                        "description": "책갈피 이름 (공백만으로 구성할 수 없음)"
                    },
                    "section": { "type": "integer", "minimum": 0 },
                    "paragraph": { "type": "integer", "minimum": 0 },
                    "offset": { "type": "integer", "minimum": 0 },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "name"],
            }),
            "edit",
            serde_json::json!(["edit", "add-bookmark", "{path}", "--name", "{name}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "paragraph", "args": ["--para", "{paragraph}"] },
                { "when": "offset", "args": ["--offset", "{offset}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "paragraph", "offset", "name", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_delete_bookmark",
            "[#5027] 책갈피 컨트롤을 지운다. section/para/ctrl 은 0 기준. 코어 delete_bookmark_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "section": { "type": "integer", "minimum": 0 },
                    "paragraph": { "type": "integer", "minimum": 0 },
                    "ctrl": { "type": "integer", "minimum": 0 },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "section", "paragraph", "ctrl"],
            }),
            "edit",
            serde_json::json!(["edit", "delete-bookmark", "{path}", "--section", "{section}", "--para", "{paragraph}", "--ctrl", "{ctrl}", "--json"]),
            serde_json::json!([
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "paragraph", "ctrl", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_rename_bookmark",
            "[#5033] 책갈피 이름을 바꾼다. section/para/ctrl 은 0 기준. 코어 rename_bookmark_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "section": { "type": "integer", "minimum": 0 },
                    "paragraph": { "type": "integer", "minimum": 0 },
                    "ctrl": { "type": "integer", "minimum": 0 },
                    "name": { "type": "string", "description": "새 책갈피 이름 (빈 문자열 불가)" },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "section", "paragraph", "ctrl", "name"],
            }),
            "edit",
            serde_json::json!(["edit", "rename-bookmark", "{path}", "--section", "{section}", "--para", "{paragraph}", "--ctrl", "{ctrl}", "--name", "{name}", "--json"]),
            serde_json::json!([
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "paragraph", "ctrl", "name", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_delete_header_footer",
            "[#5039] 머리말/꼬리말 컨트롤을 지운다. --header 또는 --footer 필수. applyTo 는 0 양쪽·1 짝수·2 홀수. 코어 delete_header_footer_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "section": { "type": "integer", "minimum": 0 },
                    "header": { "type": "boolean" },
                    "footer": { "type": "boolean" },
                    "applyTo": { "type": "integer", "minimum": 0, "maximum": 2, "description": "0 양쪽 / 1 짝수 / 2 홀수" },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path"],
            }),
            "edit",
            serde_json::json!(["edit", "delete-header-footer", "{path}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "header", "args": ["--header"] },
                { "when": "footer", "args": ["--footer"] },
                { "when": "applyTo", "args": ["--apply-to", "{applyTo}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "isHeader", "applyTo", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_set_header_footer_text",
            "기존 머리말/꼬리말 문단 텍스트를 통째로 바꾼다. --header 또는 --footer 필수. applyTo 는 0 양쪽·1 짝수·2 홀수. 코어 delete_text_in_header_footer_native + insert_text_in_header_footer_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "text": { "type": "string", "description": "바꿀 문자열 (빈 문자열 불가)" },
                    "section": { "type": "integer", "minimum": 0 },
                    "header": { "type": "boolean" },
                    "footer": { "type": "boolean" },
                    "applyTo": { "type": "integer", "minimum": 0, "maximum": 2, "description": "0 양쪽 / 1 짝수 / 2 홀수" },
                    "paragraph": { "type": "integer", "minimum": 0, "description": "머리말/꼬리말 안 문단 인덱스 (0부터)" },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "text"],
            }),
            "edit",
            serde_json::json!(["edit", "set-header-footer-text", "{path}", "--text", "{text}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "header", "args": ["--header"] },
                { "when": "footer", "args": ["--footer"] },
                { "when": "applyTo", "args": ["--apply-to", "{applyTo}"] },
                { "when": "paragraph", "args": ["--para", "{paragraph}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "isHeader", "applyTo", "paragraph", "text", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_delete_table",
            "[#5028] 본문 최상위 표를 지운다. 좌표는 export-tables 의 index. 코어 delete_table_control_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "table": { "type": "integer", "minimum": 0 },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "table"],
            }),
            "edit",
            serde_json::json!(["edit", "delete-table", "{path}", "--table", "{table}", "--json"]),
            serde_json::json!([
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "table", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_insert_header_footer_text",
            "기존 머리말/꼬리말 문단에 텍스트를 끼운다. --header 또는 --footer 필수. applyTo 는 0 양쪽·1 짝수·2 홀수. 코어 insert_text_in_header_footer_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "text": { "type": "string", "description": "넣을 문자열 (빈 문자열 불가)" },
                    "section": { "type": "integer", "minimum": 0 },
                    "header": { "type": "boolean" },
                    "footer": { "type": "boolean" },
                    "applyTo": { "type": "integer", "minimum": 0, "maximum": 2, "description": "0 양쪽 / 1 짝수 / 2 홀수" },
                    "paragraph": { "type": "integer", "minimum": 0, "description": "머리말/꼬리말 안 문단 인덱스 (0부터)" },
                    "offset": { "type": "integer", "minimum": 0, "description": "문단 안 문자 오프셋 (0부터)" },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "text"],
            }),
            "edit",
            serde_json::json!(["edit", "insert-header-footer-text", "{path}", "--text", "{text}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "header", "args": ["--header"] },
                { "when": "footer", "args": ["--footer"] },
                { "when": "applyTo", "args": ["--apply-to", "{applyTo}"] },
                { "when": "paragraph", "args": ["--para", "{paragraph}"] },
                { "when": "offset", "args": ["--offset", "{offset}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "isHeader", "applyTo", "paragraph", "offset", "text", "insertedChars", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_insert_header_footer",
            "[#5036] 머리말/꼬리말을 만든다. 같은 applyTo 가 있으면 거부. 코어 create_header_footer_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "header": { "type": "boolean", "description": "머리말을 만든다 (footer 와 동시에 쓰지 않는다)" },
                    "footer": { "type": "boolean", "description": "꼬리말을 만든다 (header 와 동시에 쓰지 않는다)" },
                    "section": { "type": "integer", "minimum": 0 },
                    "applyTo": { "type": "integer", "minimum": 0, "maximum": 2, "description": "0 양쪽, 1 짝수, 2 홀수" },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path"],
                "oneOf": [
                    {
                        "properties": {
                            "header": { "const": true },
                            "footer": { "not": { "const": true } }
                        },
                        "required": ["header"]
                    },
                    {
                        "properties": {
                            "header": { "not": { "const": true } },
                            "footer": { "const": true }
                        },
                        "required": ["footer"]
                    }
                ],
            }),
            "edit",
            serde_json::json!(["edit", "insert-header-footer", "{path}", "--json"]),
            serde_json::json!([
                { "when": "header", "args": ["--header"] },
                { "when": "footer", "args": ["--footer"] },
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "applyTo", "args": ["--apply-to", "{applyTo}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "isHeader", "applyTo", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_insert_field_in_hf",
            "기존 머리말/꼬리말 문단에 필드 마커를 넣는다. --header 또는 --footer 필수. fieldType 1 쪽번호 / 2 총쪽수 / 3 파일이름. 코어 insert_field_in_hf_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "header": { "type": "boolean", "description": "머리말에 삽입 (footer 와 동시에 쓰지 않는다)" },
                    "footer": { "type": "boolean", "description": "꼬리말에 삽입 (header 와 동시에 쓰지 않는다)" },
                    "fieldType": { "type": "integer", "minimum": 1, "maximum": 3, "description": "1 쪽번호 / 2 총쪽수 / 3 파일이름" },
                    "section": { "type": "integer", "minimum": 0 },
                    "applyTo": { "type": "integer", "minimum": 0, "maximum": 2, "description": "0 양쪽 / 1 짝수 / 2 홀수" },
                    "paragraph": { "type": "integer", "minimum": 0 },
                    "offset": { "type": "integer", "minimum": 0 },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "fieldType"],
            }),
            "edit",
            serde_json::json!(["edit", "insert-field-in-hf", "{path}", "--field-type", "{fieldType}", "--json"]),
            serde_json::json!([
                { "when": "header", "args": ["--header"] },
                { "when": "footer", "args": ["--footer"] },
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "applyTo", "args": ["--apply-to", "{applyTo}"] },
                { "when": "paragraph", "args": ["--para", "{paragraph}"] },
                { "when": "offset", "args": ["--offset", "{offset}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "isHeader", "applyTo", "paragraph", "offset", "fieldType", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_set_column_def",
            "[#5081] 구역의 단(다단) 정의를 바꾼다. count 는 단 수. type 0 일반 / 1 배분 / 2 평행. 코어 set_column_def_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "count": { "type": "integer", "minimum": 1, "description": "단 수" },
                    "section": { "type": "integer", "minimum": 0 },
                    "columnType": { "type": "integer", "minimum": 0, "maximum": 2, "description": "0 일반 / 1 배분 / 2 평행" },
                    "sameWidth": { "type": "boolean", "description": "단 너비 동일 (기본 true)" },
                    "spacing": { "type": "integer", "description": "단 간격 (HWPUNIT)" },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "count"],
            }),
            "edit",
            serde_json::json!(["edit", "set-column-def", "{path}", "--count", "{count}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "columnType", "args": ["--type", "{columnType}"] },
                { "when": "sameWidth", "args": ["--same-width"] },
                { "when": "spacing", "args": ["--spacing", "{spacing}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "columnCount", "columnType", "sameWidth", "spacing", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_delete_hf_text",
            "기존 머리말/꼬리말 문단에서 글자를 지운다. --header 또는 --footer 와 --count 필수. applyTo 는 0 양쪽·1 짝수·2 홀수. 코어 delete_text_in_header_footer_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "count": { "type": "integer", "minimum": 1, "description": "지울 글자 수 (1 이상)" },
                    "section": { "type": "integer", "minimum": 0 },
                    "header": { "type": "boolean" },
                    "footer": { "type": "boolean" },
                    "applyTo": { "type": "integer", "minimum": 0, "maximum": 2, "description": "0 양쪽 / 1 짝수 / 2 홀수" },
                    "paragraph": { "type": "integer", "minimum": 0, "description": "머리말/꼬리말 안 문단 인덱스 (0부터)" },
                    "offset": { "type": "integer", "minimum": 0, "description": "문단 안 문자 오프셋 (0부터)" },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "count"],
            }),
            "edit",
            serde_json::json!(["edit", "delete-hf-text", "{path}", "--count", "{count}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "header", "args": ["--header"] },
                { "when": "footer", "args": ["--footer"] },
                { "when": "applyTo", "args": ["--apply-to", "{applyTo}"] },
                { "when": "paragraph", "args": ["--para", "{paragraph}"] },
                { "when": "offset", "args": ["--offset", "{offset}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "isHeader", "applyTo", "paragraph", "offset", "count", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_split_paragraph_in_hf",
            "기존 머리말/꼬리말 문단을 오프셋에서 나눈다. --header 또는 --footer 필수. applyTo 는 0 양쪽·1 짝수·2 홀수. 코어 split_paragraph_in_header_footer_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "section": { "type": "integer", "minimum": 0 },
                    "header": { "type": "boolean" },
                    "footer": { "type": "boolean" },
                    "applyTo": { "type": "integer", "minimum": 0, "maximum": 2, "description": "0 양쪽 / 1 짝수 / 2 홀수" },
                    "paragraph": { "type": "integer", "minimum": 0, "description": "머리말/꼬리말 안 문단 인덱스 (0부터)" },
                    "offset": { "type": "integer", "minimum": 0, "description": "문단 안 문자 오프셋 (0부터)" },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path"],
            }),
            "edit",
            serde_json::json!(["edit", "split-paragraph-in-hf", "{path}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "header", "args": ["--header"] },
                { "when": "footer", "args": ["--footer"] },
                { "when": "applyTo", "args": ["--apply-to", "{applyTo}"] },
                { "when": "paragraph", "args": ["--para", "{paragraph}"] },
                { "when": "offset", "args": ["--offset", "{offset}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "isHeader", "applyTo", "paragraph", "offset", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_merge_paragraph_in_hf",
            "머리말/꼬리말 문단을 바로 앞 문단과 합친다. --header 또는 --footer 필수. --para 는 합쳐질 문단(1 이상). applyTo 는 0 양쪽·1 짝수·2 홀수. 코어 merge_paragraph_in_header_footer_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "section": { "type": "integer", "minimum": 0 },
                    "header": { "type": "boolean" },
                    "footer": { "type": "boolean" },
                    "applyTo": { "type": "integer", "minimum": 0, "maximum": 2, "description": "0 양쪽 / 1 짝수 / 2 홀수" },
                    "paragraph": { "type": "integer", "minimum": 1, "description": "합쳐질 머리말/꼬리말 문단 인덱스 (1부터)" },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path"],
            }),
            "edit",
            serde_json::json!(["edit", "merge-paragraph-in-hf", "{path}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "header", "args": ["--header"] },
                { "when": "footer", "args": ["--footer"] },
                { "when": "applyTo", "args": ["--apply-to", "{applyTo}"] },
                { "when": "paragraph", "args": ["--para", "{paragraph}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "isHeader", "applyTo", "paragraph", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_split_paragraph_in_cell",
            "표 셀 문단을 오프셋에서 나눈다. export-tables 격자와 같은 --table/--row/--col. 코어 split_paragraph_in_cell_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "table": { "type": "integer", "minimum": 0 },
                    "row": { "type": "integer", "minimum": 0 },
                    "col": { "type": "integer", "minimum": 0 },
                    "cellPara": { "type": "integer", "minimum": 0 },
                    "offset": { "type": "integer", "minimum": 0 },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "table", "row", "col"],
            }),
            "edit",
            serde_json::json!(["edit", "split-paragraph-in-cell", "{path}", "--table", "{table}", "--row", "{row}", "--col", "{col}", "--json"]),
            serde_json::json!([
                { "when": "cellPara", "args": ["--cell-para", "{cellPara}"] },
                { "when": "offset", "args": ["--offset", "{offset}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "table", "row", "col", "paragraph", "offset", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_merge_paragraph_in_cell",
            "표 셀 문단을 바로 앞 문단과 합친다. --cell-para 는 합쳐질 문단(1 이상). export-tables 격자와 같은 --table/--row/--col. 코어 merge_paragraph_in_cell_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "table": { "type": "integer", "minimum": 0 },
                    "row": { "type": "integer", "minimum": 0 },
                    "col": { "type": "integer", "minimum": 0 },
                    "cellPara": { "type": "integer", "minimum": 1 },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "table", "row", "col"],
            }),
            "edit",
            serde_json::json!(["edit", "merge-paragraph-in-cell", "{path}", "--table", "{table}", "--row", "{row}", "--col", "{col}", "--json"]),
            serde_json::json!([
                { "when": "cellPara", "args": ["--cell-para", "{cellPara}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "table", "row", "col", "paragraph", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_split_paragraph",
            "[#5082] 본문 문단을 지정 오프셋에서 가른다. 주소는 search 와 같다. 코어 split_paragraph_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "section": { "type": "integer", "minimum": 0 },
                    "paragraph": { "type": "integer", "minimum": 0 },
                    "offset": { "type": "integer", "minimum": 0 },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path"],
            }),
            "edit",
            serde_json::json!(["edit", "split-paragraph", "{path}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "paragraph", "args": ["--para", "{paragraph}"] },
                { "when": "offset", "args": ["--offset", "{offset}"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "paragraph", "offset", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_set_page_hide",
            "[#5083] 문단에 쪽 감추기(PageHide) 컨트롤을 넣거나 갱신한다. 플래그를 모두 끄면 제거. 코어 set_page_hide_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "section": { "type": "integer", "minimum": 0 },
                    "paragraph": { "type": "integer", "minimum": 0 },
                    "hideHeader": { "type": "boolean" },
                    "hideFooter": { "type": "boolean" },
                    "hideMasterPage": { "type": "boolean" },
                    "hideBorder": { "type": "boolean" },
                    "hideFill": { "type": "boolean" },
                    "hidePageNum": { "type": "boolean" },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path"],
            }),
            "edit",
            serde_json::json!(["edit", "set-page-hide", "{path}", "--json"]),
            serde_json::json!([
                { "when": "section", "args": ["--section", "{section}"] },
                { "when": "paragraph", "args": ["--para", "{paragraph}"] },
                { "when": "hideHeader", "args": ["--hide-header"] },
                { "when": "hideFooter", "args": ["--hide-footer"] },
                { "when": "hideMasterPage", "args": ["--hide-master"] },
                { "when": "hideBorder", "args": ["--hide-border"] },
                { "when": "hideFill", "args": ["--hide-fill"] },
                { "when": "hidePageNum", "args": ["--hide-page-num"] },
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "section", "paragraph", "hideHeader", "hideFooter", "hideMasterPage", "hideBorder", "hideFill", "hidePageNum", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
        tool_with_optional_args(
            "hwp_transpose_table",
            "[#5108] 본문 최상위 표의 행/열을 제자리에서 바꾼다. 병합 셀이 있으면 거부. 좌표는 export-tables 의 index. 코어 transpose_table_cells_in_place_native 배선.",
            serde_json::json!({
                "type": "object",
                "properties": {
                    "path": { "type": "string" },
                    "table": { "type": "integer", "minimum": 0 },
                    "output": { "type": "string" },
                    "dryRun": { "type": "boolean" }
                },
                "required": ["path", "table"],
            }),
            "edit",
            serde_json::json!(["edit", "transpose-table", "{path}", "--table", "{table}", "--json"]),
            serde_json::json!([
                { "when": "output", "args": ["-o", "{output}"] },
                { "when": "dryRun", "args": ["--dry-run"] }
            ]),
            &["schemaVersion", "source", "table", "section", "paragraph", "ctrl", "sourceRows", "sourceCols", "targetRows", "targetCols", "dryRun", "changedPages", "output", "outputFormat", "verify"],
        ),
    ]);
}