-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjsonedit_spec.json
More file actions
1018 lines (1018 loc) · 29.3 KB
/
jsonedit_spec.json
File metadata and controls
1018 lines (1018 loc) · 29.3 KB
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
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"jsonedit": {
"window-title": "JSON Edit specification"
},
"program": {
"name": "json_tree_editor",
"filename": "jsonedit.py",
"title": "JSON Tree Editor",
"version": "0.1-draft",
"language": "python",
"ui-framework": "tkinter",
"programming-pragmatics": {
"pyperclip": [
"if pyperclip is available, use it for clipboard copy operations,",
"because Tk doesn't copy to the clipboard right away,",
"and clipboard writes fail when the application closes"
]
},
"purpose": "General-purpose JSON editor with synchronized node<->text views",
"development-conversations": {
"2025-12-14": [
"https://chatgpt.com/c/693f436e-44c0-832d-b95a-07812c82c548",
"https://chatgpt.com/c/693f73ec-0830-832c-883a-3bcb60ada332"
],
"2025-12-15": [
"https://chatgpt.com/c/69404b21-311c-8327-9c95-bb88bef87887"
],
"2025-12-16": [
"https://chatgpt.com/c/6941b60b-c7a8-8331-a3fe-9adc57397ecd"
]
}
},
"document-model": {
"authoritative-state": "object",
"root-type": [
"object",
"array"
],
"path-representation": "tuple",
"example-path": [
"modules",
2,
"functions",
0
],
"ordering": {
"objects": "preserved",
"arrays": "preserved",
"reordering-is": "structural",
"value-identity": "unchanged"
},
"document-state": {
"dirty-tracking": {
"enabled": false,
"planned": true,
"structural-operations-mark-dirty": true
}
},
"structural-defaults": {
"new-object-key-name": "NEW_KEY",
"new-object-value": null,
"new-array-element": null,
"ensure-unique-object-keys": true,
"dictionary-insert": {
"prompt-for-index": true,
"default-value": null
},
"array-insert": {
"prompt-for-index": false,
"default-value": null
}
},
"structural-edit-classes": {
"identity-preserving": {
"operations": [
"raise-structural-item",
"lower-structural-item"
]
},
"identity-creating": {
"operations": [
"insert-structural-item-after",
"duplicate-structural-item"
]
},
"identity-modifying": {
"operations": [
"rename-structural-key"
]
},
"identity-removing": {
"operations": [
"delete-structural-item"
]
}
},
"copy-semantics": {
"structural-duplicate": "deep-copy"
}
},
"embedded-editor-configuration": {
"purpose": "Allow a JSON document to provide optional, non-structural hints to the editor environment.",
"discovery": {
"root-object": {
"description": "If the document root is a dictionary and contains a key named 'jsonedit' whose value is a dictionary, that dictionary is treated as editor configuration."
},
"root-array": {
"description": "If the document root is a list and element 0 is a dictionary containing a key named 'jsonedit' whose value is a dictionary, that dictionary is treated as editor configuration."
},
"invalid-config": "If a discovered 'jsonedit' value is not a dictionary, it is ignored."
},
"invariants": [
"Embedded editor configuration must not modify the JSON document.",
"Embedded editor configuration must be safe to ignore.",
"Malformed or unknown configuration keys must not produce errors or status messages."
],
"keys": {
"window-title": {
"type": "string",
"status": "implemented",
"description": "Augments the application window title.",
"behavior": {
"base-title": "JSON Tree Editor",
"format": "JSON Tree Editor: <window-title>",
"default": "JSON Tree Editor"
}
},
"read-only": {
"type": "boolean",
"status": "disabled",
"description": "Requests that the document be opened in read-only mode.",
"notes": [
"When enabled, editing and structural operations would be disabled.",
"Text widget is read-only.",
"This key is specified for future use and is not currently implemented."
]
},
"initial-selection-path": {
"type": "array",
"status": "disabled",
"description": "Specifies a JSON path to select after loading the document.",
"notes": [
"The path is advisory and ignored if invalid.",
"This key is specified for future use and is not currently implemented."
]
},
"schema": {
"type": "object|string",
"status": "disabled",
"description": "Declares an associated schema for validation or annotation.",
"notes": [
"No schema processing is currently performed.",
"This key reserves namespace for future schema support."
]
},
"tree-expansion": {
"type": "object",
"status": "disabled",
"description": "Hints for initial tree expansion behavior.",
"notes": [
"Potential future use includes controlled expansion depth or frozen expansion boundaries.",
"No tree expansion behavior is currently modified by this key."
]
}
}
},
"help": {
"id": "main_help",
"title": "JSON Tree Editor — Help",
"format": "plain-text",
"invoked-by": "display_help",
"content": [
"JSON Tree Editor lets you explore and safely edit JSON documents using a tree view and a text editor side by side.",
"",
"BASIC WORKFLOW",
"",
"1. Load JSON into the program:",
" • Use File | Open to load a JSON file, or",
" • Use File | Create from Clipboard to paste JSON from the clipboard.",
"",
"2. Navigate the JSON structure:",
" • Click nodes in the tree on the left to select a portion of the JSON.",
" • The selected subtree will appear as editable text on the right.",
"",
"3. Edit JSON text:",
" • Modify the text in the editor pane on the right.",
" • You may freely edit, reformat, or replace the JSON subtree.",
"",
"4. Commit your changes:",
" • Press Ctrl+Enter, or",
" • Click the 'Update Tree' button.",
" • The tree view will refresh to reflect your changes.",
"",
"5. Export JSON:",
" • Use 'Copy Tree' to copy the entire document (pretty-printed).",
" • Use 'Copy Tree (compressed)' to copy compact JSON.",
" • Use 'Copy Node' to copy only the selected subtree.",
" • Use File | Save to write the document to disk.",
"",
"IMPORTANT WARNING",
"",
"Edits made in the text pane are NOT automatically committed.",
"Your changes are only applied when you explicitly commit them",
"using Ctrl+Enter or the 'Update Tree' button.",
"",
"If you navigate away from a node without committing,",
"your edits will be lost."
]
},
"menu": {
"menubar": {
"id": "main_menubar",
"type": "tk.Menu",
"menus": [
{
"id": "file_menu",
"label": "File",
"items": [
{
"id": "file_open",
"label": "Open",
"action": "open_file",
"accelerator": "Ctrl+O",
"enabled": true
},
{
"id": "file_save",
"label": "Save",
"action": "save_file",
"accelerator": "Ctrl+S",
"enabled": true
},
{
"type": "separator"
},
{
"id": "create_from_clipboard",
"label": "Create from Clipboard",
"action": "create_from_clipboard",
"accelerator": "Ctrl+N",
"enabled": true
},
{
"type": "separator"
},
{
"id": "file_exit",
"label": "Exit",
"action": "exit_application",
"accelerator": "Ctrl+Q",
"enabled": true
}
]
},
{
"id": "edit_menu",
"label": "Edit",
"items": [
{
"id": "edit_findkey",
"label": "Search…",
"action": "find-key",
"accelerator": "Ctrl-F",
"enabled-when": "always"
},
{
"id": "edit_repeatfindkey",
"label": "Repeat Search",
"action": "repeat-find-key",
"accelerator": "Shift-Ctrl-F",
"enabled-when": "always"
},
"-- separator --",
{
"id": "edit_raisekey",
"label": "Raise Item",
"action": "raise-structural-item",
"accelerator": "Ctrl+Up",
"enabled-when": "selected-node-is-structural"
},
{
"id": "edit_rename_key",
"label": "Rename Key",
"action": "rename-structural-key",
"accelerator": "Ctrl+R",
"enabled-when": "selected-node-is-object-key"
},
{
"id": "edit_delete_item",
"label": "Delete Item",
"action": "delete-structural-item",
"accelerator": "Delete",
"enabled-when": "selected-node-is-structural"
},
{
"id": "edit_duplicate_item",
"label": "Duplicate Item",
"action": "duplicate-structural-item",
"accelerator": "Ctrl+D",
"enabled-when": "selected-node-is-structural"
},
{
"id": "edit_insert_item_after",
"label": "Insert Item After",
"action": "insert-structural-item-after",
"accelerator": "Ctrl+Right",
"enabled-when": "selected-node-is-structural"
},
{
"id": "edit_lowerkey",
"label": "Lower Item",
"action": "lower-structural-item",
"accelerator": "Ctrl+Down",
"enabled-when": "selected-node-is-structural"
}
]
},
{
"id": "help_menu",
"label": "Help",
"action": "display_help",
"accelerator": "Ctrl+H",
"enabled": true
}
]
}
},
"ui": {
"theme": {
"default": "dark",
"supported": [
"dark"
],
"requirements": {
"background": "dark",
"text-contrast": "high",
"selection-visibility": "explicit",
"status-bar-readability": "must-be-clear"
},
"widget-notes": {
"tk.Text": "Must be explicitly styled; ignores ttk themes.",
"ttk.Treeview": "Selection colors must be defined via style.map()."
}
},
"layout": {
"type": "vertical_stack",
"grid-policy": {
"row-mapping": "regions",
"row-weight-key": "row-weight",
"default-row-weight": 0,
"collapse-unweighted-rows": true
},
"regions": [
{
"id": "editor_region",
"type": "horizontal_split",
"row-weight": 1,
"panes": [
{
"id": "tree_pane",
"position": "left",
"container": "tk.Frame",
"widget": {
"type": "ttk.Treeview",
"id": "json_tree",
"scrollbars": {
"vertical": {
"widget": "ttk.Scrollbar",
"orientation": "vertical",
"binds_to": "yview",
"controlled_by": "yscrollcommand"
},
"horizontal": {
"widget": "ttk.Scrollbar",
"orientation": "horizontal",
"binds_to": "xview",
"controlled_by": "xscrollcommand"
}
}
},
"purpose": "Structural navigation of JSON document"
},
{
"id": "text_pane",
"position": "right",
"container": "tk.Frame",
"widget": {
"type": "tk.Text",
"id": "json_text",
"scrollbars": {
"vertical": {
"widget": "tk.Scrollbar",
"orientation": "vertical",
"binds_to": "yview",
"controlled_by": "yscrollcommand"
},
"horizontal": {
"widget": "tk.Scrollbar",
"orientation": "horizontal",
"binds_to": "xview",
"controlled_by": "xscrollcommand"
}
}
},
"purpose": "Textual editing of selected JSON subtree"
}
]
},
{
"id": "action_row",
"type": "horizontal_row",
"row-weight": 0,
"container": "tk.Frame",
"buttons": [
{
"id": "copy_tree_button",
"label": "Copy Tree",
"action": "copy_entire_document",
"target": "clipboard",
"format": "JSON, indent:2",
"enabled": true
},
{
"id": "copy_tree_compressed_button",
"label": "Copy Tree (compressed)",
"action": "copy_entire_document_compressed",
"target": "clipboard",
"format": "JSON, indent:0",
"enabled": true
},
{
"id": "copy_node_button",
"label": "Copy Node",
"action": "copy_selected_subtree",
"target": "clipboard",
"format": "JSON, indent: 2",
"enabled": true
},
{
"id": "copy_node_compressed_button",
"label": "Copy Node (compressed)",
"action": "copy_selected_subtree_compressed",
"target": "clipboard",
"format": "JSON, indent: 0",
"enabled": true
},
{
"id": "update_tree_button",
"label": "Update Tree",
"action": "apply_text_to_tree",
"precondition": "valid_json",
"enabled": true,
"accelerator": "Ctrl+Enter",
"note": "after the tree is updated, it needs to expand to show the nodes that were visible before, and to select the node that was updated."
},
{
"id": "emit_filetalk_button",
"label": "Emit",
"action": "emit_selected_subtree",
"target": "filetalk",
"enabled": false,
"status": "placeholder"
}
]
}
]
},
"status_bar": {
"enabled": true,
"role": "explanatory",
"purpose": "Provides immediate, human-readable explanations of editor state changes, validation results, and suppressed actions.",
"behavior": {
"must-explain": [
"invalid-commit",
"suppressed-text-refresh",
"uncommitted-text-state",
"selection-change-effects",
"successful-commit"
],
"tone": "informational",
"verbosity": "minimal"
},
"find-key-messages": {
"progress": "Find \"<term>\": <index> of <count>",
"wrapped": "Find \"<term>\": wrapped (<index> of <count>)",
"no-matches": "Find \"<term>\": no matches",
"no-active-search": "No active search"
}
}
},
"communication-invariant": {
"explain-suppressed-actions": {
"rule": "If an explicit user action is suppressed, ignored, or rejected, the editor must provide an immediate, human-readable explanation via the status bar.",
"scope": [
"keyboard-invoked actions",
"menu-invoked actions",
"commit operations"
],
"applies-to": [
"structural operations ignored due to focus rules",
"commit operations rejected due to invalid JSON",
"operations blocked by unmet preconditions"
],
"does-not-apply-to": [
"normal consequences of successful structural operations",
"selection changes resulting from delete or insert actions"
],
"delivery": {
"mechanism": "status-bar",
"timing": "immediate",
"tone": "informational",
"verbosity": "minimal"
}
}
},
"tree-view": {
"node-types": {
"object": "{}",
"array": "[]",
"value": "leaf"
},
"display": {
"show-array-indices": true,
"show-object-keys": true,
"collapse-by-default": false
},
"selection": {
"single": true,
"selectable-nodes": [
"root",
"object",
"array",
"array-element",
"object-key"
],
"selection-behavior": {
"preserve-selection-on-structural-reorder": true
},
"selection-after-delete": {
"priority": [
"next-sibling",
"previous-sibling",
"parent"
]
}
}
},
"text-pane": {
"content-source": "selected-subtree",
"formatting": {
"indent": 2,
"sort-keys": false
},
"editing": {
"mode": "free-text",
"syntax": "json"
},
"stability-guarantees": [
"structural-operations-do-not-modify-text",
"structural-operations-do-not-trigger-text-refresh"
],
"text-pane-selection-policy": {
"on-same-node": {
"description": "Selection refers to the same logical node as before the operation.",
"text-pane": "untouched"
},
"on-new-node": {
"description": "Selection moves to a newly created node.",
"text-pane": "refresh",
"cursor": "start",
"selection": "none"
},
"on-different-existing-node": {
"description": "Selection moves to a different existing node.",
"text-pane": "refresh",
"cursor": "start",
"selection": "none"
}
},
"text-pane-focus-policy": {
"on-new-node": {
"focus": "tree"
},
"on-same-node": {
"focus": "unchanged"
},
"on-different-existing-node": {
"focus": "tree"
}
}
},
"synchronization": {
"direction": "text-to-tree",
"update-mode": "commit",
"commit-controls": {
"apply-button": true,
"keyboard-shortcut": "Ctrl-Enter",
"scope": "global",
"override-widget-defaults": true
},
"validation": {
"on-commit": true,
"parser": "json.loads",
"status-reporting": {
"validity-states": [
"valid",
"INVALID",
"(uncommitted edits)",
"saved",
"loaded",
"created",
"(no document)"
],
"error-reporting": {
"location": [
"line",
"column"
],
"message": true
}
},
"error-reporting": {
"line": true,
"column": true,
"message": true
}
},
"notes": [
"Ctrl-Enter is intentionally global and always applies the current text pane contents, regardless of focus.",
"This provides a reliable, focus-independent commit mechanism."
]
},
"operations": {
"select-node": {
"input": "tree-node",
"effect": "load subtree JSON into text pane"
},
"apply-edit": {
"input": "text-pane",
"precondition": "valid JSON",
"effect": "replace subtree at selected path"
},
"refresh-tree": {
"trigger": "successful apply-edit",
"effect": "rebuild tree view"
},
"find-key": {
"purpose": "Locate object keys in the JSON document and navigate between their occurrences.",
"search-domain": "object-keys-only",
"matching": "exact-key-name",
"session-model": {
"stateful": true,
"components": [
"term",
"match-paths",
"current-index"
],
"wrap-around": true
},
"prompt-behavior": {
"new-term": "start-new-search-session",
"same-term": "advance-to-next-match",
"empty-term": "advance-to-next-match",
"cancel": "no-op"
},
"effects": {
"tree-view": [
"expand-ancestors",
"select-matching-node"
]
},
"invariants": [
"must-not-modify-document",
"must-preserve-existing-tree-state-except-for-required-expansion"
],
"non-goals": [
"value-search",
"regex-search",
"case-insensitive-search",
"reverse-search",
"multi-highlight"
]
},
"raise-structural-item": {
"input": {
"source": "selected-node",
"requires-focus": "tree-pane"
},
"applies-to": [
"object-key",
"array-element"
],
"preconditions": [
"parent-exists",
"sibling-count-greater-than-one"
],
"behavior": {
"object": "move-key-earlier-with-wrap",
"array": "move-element-earlier-with-wrap"
},
"effects": {
"document-model": "reorder-structure",
"tree-view": "refresh",
"text-pane": "no-change"
},
"selection-after": "same-item-new-position",
"undoable": true,
"notes": [
"If the selected item is first, it wraps to the last position.",
"If the root is selected, the operation is a no-op."
]
},
"lower-structural-item": {
"input": {
"source": "selected-node",
"requires-focus": "tree-pane"
},
"applies-to": [
"object-key",
"array-element"
],
"preconditions": [
"parent-exists",
"sibling-count-greater-than-one"
],
"behavior": {
"object": "move-key-later-with-wrap",
"array": "move-element-later-with-wrap"
},
"effects": {
"document-model": "reorder-structure",
"tree-view": "refresh",
"text-pane": "no-change"
},
"selection-after": "same-item-new-position",
"undoable": true
},
"insert-structural-item-after": {
"input": {
"source": "selected-node",
"requires-focus": "tree-pane"
},
"applies-to": [
"object-key",
"array-element"
],
"preconditions": [
"parent-exists"
],
"behavior": {
"object": {
"step-1": "prompt-for-key",
"step-2": "insert-new-key-after",
"default-value": null
},
"array": {
"step-1": "insert-new-element-after",
"default-value": null
}
},
"prompts": {
"object": "new-object-key"
},
"defaults": {
"object-key": "NEW_KEY -- !FIXME! we're going to ask the user for a key",
"object-value": null,
"array-element": null
},
"effects": {
"document-model": "insert-structure",
"tree-view": "refresh",
"text-pane": "refresh"
},
"selection-after": "new-item",
"text-pane-focus": {
"focus": true,
"selection": "entire-value"
},
"undoable": true,
"notes": [
"When inserting into an object, the user is prompted to enter a key name.",
"When inserting into an array, no prompt is shown.",
"If the root is selected, the operation is a no-op."
]
},
"rename-structural-key": {
"input": {
"source": "selected-node",
"requires-focus": "tree-pane"
},
"applies-to": [
"object-key"
],
"preconditions": [
"parent-is-object"
],
"behavior": {
"step-1": "prompt-for-key",
"step-2": "rename-key-in-place"
},
"prompts": {
"object": "new-object-key"
},
"effects": {
"document-model": "rename-key",
"tree-view": "refresh",
"text-pane": "untouched"
},
"selection-after": "same-item",
"undoable": true,
"notes": [
"The value associated with the key is preserved.",
"The key remains in the same position within the object.",
"If the root is selected, the operation is a no-op."
]
},
"delete-structural-item": {
"input": {
"source": "selected-node",
"requires-focus": "tree-pane"
},
"applies-to": [
"object-key",
"array-element"
],
"preconditions": [
"parent-exists"
],
"behavior": {
"object": "delete-key",
"array": "delete-element"
},
"prompts": {
"confirm": "delete-structural-item"
},
"effects": {
"document-model": "remove-structure",
"tree-view": "refresh",
"text-pane": "follow-selection-policy"
},
"selection-after": {
"priority": [
"next-sibling",
"previous-sibling",
"parent"
],
"classification": "different-existing-node"
},
"undoable": true,
"notes": [
"If the root is selected, the operation is a no-op.",
"The text pane is not refreshed to avoid losing uncommitted edits."
]
},
"duplicate-structural-item": {
"input": {
"source": "selected-node",
"requires-focus": "tree-pane"
},
"applies-to": [
"object-key",
"array-element"
],
"preconditions": [
"parent-exists"
],
"behavior": {
"object": {
"step-1": "prompt-for-key",
"step-2": "duplicate-key-after"
},
"array": {
"step-1": "duplicate-element-after"
}
},
"prompts": {
"object": "new-object-key"
},
"effects": {
"document-model": "insert-structure-with-copy",
"tree-view": "refresh",
"text-pane": "follow-selection-policy"
},
"selection-after": {
"classification": "new-node"
},
"focus-after": "tree",
"undoable": true,
"notes": [
"The duplicated item is inserted immediately after the selected item.",
"The value is a deep copy of the original.",
"If the root is selected, the operation is a no-op."
]
},
"notes": [
"Structural operations are only valid when the tree pane has keyboard focus.",
"If invoked while focus is elsewhere, the operation is a no-op."
]
},
"undo-redo": {
"enabled": false,
"planned": true,
"granularity": "subtree",
"storage": "in-memory",
"max-depth": 100,
"supported-operations": [
"raise-structural-item",
"lower-structural-item",
"apply-edit"
]
},
"file-io": {
"open": {
"formats": [
"json",
"txt"
],
"parse-on-load": true
},
"save": {
"pretty-print": true,
"atomic-write": true
}
},
"filetalk-integration": {
"enabled": false,
"role": "placeholder",
"description": "Optional emission of selected subtree as FileTalk message",
"output-channel": {
"type": "file",
"path": null
},
"message-format": {
"path": "json-path",
"payload": "json-subtree",
"timestamp": "unix-utc"
}
},
"extension-points": {
"live-update-mode": {
"enabled": false,
"description": "Optional future feature for real-time tree updates"
},
"schema-support": {
"enabled": false,
"description": "Optional JSON Schema validation and hints"
}
},
"keyboard-policy": {
"focus-is-authority": true,
"event-consumption": {
"structural-operations": {
"consume-key-event": true,
"suppress-default-widget-behavior": true
}
},
"scoping-rules": {
"tree-pane": {
"allowed-actions": [
"structural-operations",
"navigation"
]
},
"text-pane": {
"allowed-actions": [
"text-editing",
"commit-edit"
],
"disallowed-actions": [
"structural-operations"
]
}
},
"notes": {
"focus-based-shortcut-scoping": [
"Keyboard shortcuts apply only when their associated widget has focus.",
"Structural operations must not trigger while focus is in the text pane.",
"This prevents accidental document mutation during text editing."
],
"keyboard-event-consumption": [
"Structural keyboard shortcuts must fully consume their key events.",
"Default widget navigation behavior must not occur after a structural operation.",
"This prevents unintended selection movement following structural edits."
]
}
},
"user-prompts": {
"new-object-key": {
"title": "New JSON Key",
"message": "Enter a name for the new key:",
"input-type": "string",
"validation": [
"non-empty",
"not-duplicate-in-parent"
],
"on-cancel": "abort-operation"
},
"delete-structural-item": {
"title": "Delete Item",
"message": "Delete the selected item?",