shortcutxl 0.2.12 → 0.2.13

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.
Files changed (110) hide show
  1. package/README.md +26 -26
  2. package/agent-docs/README.md +397 -397
  3. package/agent-docs/docs/compaction.md +390 -390
  4. package/agent-docs/docs/custom-provider.md +580 -580
  5. package/agent-docs/docs/extensions.md +1971 -1971
  6. package/agent-docs/docs/packages.md +209 -209
  7. package/agent-docs/docs/rpc.md +1317 -1317
  8. package/agent-docs/docs/sdk.md +962 -962
  9. package/agent-docs/docs/session.md +412 -412
  10. package/agent-docs/docs/termux.md +127 -127
  11. package/agent-docs/docs/tui.md +887 -887
  12. package/agent-docs/examples/README.md +25 -25
  13. package/agent-docs/examples/extensions/README.md +205 -205
  14. package/agent-docs/examples/extensions/antigravity-image-gen.ts +447 -447
  15. package/agent-docs/examples/extensions/auto-commit-on-exit.ts +49 -49
  16. package/agent-docs/examples/extensions/bash-spawn-hook.ts +30 -30
  17. package/agent-docs/examples/extensions/bookmark.ts +50 -50
  18. package/agent-docs/examples/extensions/built-in-tool-renderer.ts +256 -256
  19. package/agent-docs/examples/extensions/claude-rules.ts +86 -86
  20. package/agent-docs/examples/extensions/commands.ts +75 -75
  21. package/agent-docs/examples/extensions/confirm-destructive.ts +59 -59
  22. package/agent-docs/examples/extensions/custom-compaction.ts +126 -126
  23. package/agent-docs/examples/extensions/custom-footer.ts +63 -63
  24. package/agent-docs/examples/extensions/custom-header.ts +73 -73
  25. package/agent-docs/examples/extensions/custom-provider-anthropic/index.ts +660 -660
  26. package/agent-docs/examples/extensions/custom-provider-gitlab-duo/index.ts +362 -362
  27. package/agent-docs/examples/extensions/custom-provider-gitlab-duo/test.ts +88 -88
  28. package/agent-docs/examples/extensions/custom-provider-qwen-cli/index.ts +349 -349
  29. package/agent-docs/examples/extensions/dirty-repo-guard.ts +56 -56
  30. package/agent-docs/examples/extensions/doom-overlay/doom-component.ts +133 -133
  31. package/agent-docs/examples/extensions/doom-overlay/doom-keys.ts +108 -108
  32. package/agent-docs/examples/extensions/doom-overlay/index.ts +74 -74
  33. package/agent-docs/examples/extensions/dynamic-resources/index.ts +15 -15
  34. package/agent-docs/examples/extensions/dynamic-tools.ts +77 -77
  35. package/agent-docs/examples/extensions/event-bus.ts +43 -43
  36. package/agent-docs/examples/extensions/file-trigger.ts +41 -41
  37. package/agent-docs/examples/extensions/git-checkpoint.ts +53 -53
  38. package/agent-docs/examples/extensions/handoff.ts +155 -155
  39. package/agent-docs/examples/extensions/hello.ts +25 -25
  40. package/agent-docs/examples/extensions/inline-bash.ts +94 -94
  41. package/agent-docs/examples/extensions/input-transform.ts +43 -43
  42. package/agent-docs/examples/extensions/interactive-shell.ts +209 -209
  43. package/agent-docs/examples/extensions/mac-system-theme.ts +47 -47
  44. package/agent-docs/examples/extensions/message-renderer.ts +59 -59
  45. package/agent-docs/examples/extensions/minimal-mode.ts +430 -430
  46. package/agent-docs/examples/extensions/modal-editor.ts +90 -90
  47. package/agent-docs/examples/extensions/model-status.ts +31 -31
  48. package/agent-docs/examples/extensions/notify.ts +55 -55
  49. package/agent-docs/examples/extensions/overlay-qa-tests.ts +936 -936
  50. package/agent-docs/examples/extensions/overlay-test.ts +159 -159
  51. package/agent-docs/examples/extensions/permission-gate.ts +37 -37
  52. package/agent-docs/examples/extensions/pirate.ts +47 -47
  53. package/agent-docs/examples/extensions/plan-mode/index.ts +363 -363
  54. package/agent-docs/examples/extensions/preset.ts +418 -418
  55. package/agent-docs/examples/extensions/protected-paths.ts +30 -30
  56. package/agent-docs/examples/extensions/qna.ts +122 -122
  57. package/agent-docs/examples/extensions/question.ts +278 -278
  58. package/agent-docs/examples/extensions/questionnaire.ts +440 -440
  59. package/agent-docs/examples/extensions/rainbow-editor.ts +90 -90
  60. package/agent-docs/examples/extensions/reload-runtime.ts +37 -37
  61. package/agent-docs/examples/extensions/rpc-demo.ts +124 -124
  62. package/agent-docs/examples/extensions/sandbox/index.ts +324 -324
  63. package/agent-docs/examples/extensions/send-user-message.ts +97 -97
  64. package/agent-docs/examples/extensions/session-name.ts +27 -27
  65. package/agent-docs/examples/extensions/shutdown-command.ts +69 -69
  66. package/agent-docs/examples/extensions/snake.ts +343 -343
  67. package/agent-docs/examples/extensions/space-invaders.ts +566 -566
  68. package/agent-docs/examples/extensions/ssh.ts +233 -233
  69. package/agent-docs/examples/extensions/status-line.ts +40 -40
  70. package/agent-docs/examples/extensions/subagent/agents.ts +130 -130
  71. package/agent-docs/examples/extensions/subagent/index.ts +1068 -1068
  72. package/agent-docs/examples/extensions/summarize.ts +206 -206
  73. package/agent-docs/examples/extensions/system-prompt-header.ts +17 -17
  74. package/agent-docs/examples/extensions/timed-confirm.ts +72 -72
  75. package/agent-docs/examples/extensions/titlebar-spinner.ts +58 -58
  76. package/agent-docs/examples/extensions/todo.ts +314 -314
  77. package/agent-docs/examples/extensions/tool-override.ts +146 -146
  78. package/agent-docs/examples/extensions/tools.ts +145 -145
  79. package/agent-docs/examples/extensions/trigger-compact.ts +40 -40
  80. package/agent-docs/examples/extensions/truncated-tool.ts +194 -194
  81. package/agent-docs/examples/extensions/widget-placement.ts +17 -17
  82. package/agent-docs/examples/extensions/with-deps/index.ts +37 -37
  83. package/agent-docs/examples/rpc-extension-ui.ts +654 -654
  84. package/agent-docs/examples/sdk/01-minimal.ts +22 -22
  85. package/agent-docs/examples/sdk/02-custom-model.ts +48 -48
  86. package/agent-docs/examples/sdk/03-custom-prompt.ts +55 -55
  87. package/agent-docs/examples/sdk/04-skills.ts +53 -53
  88. package/agent-docs/examples/sdk/05-tools.ts +56 -56
  89. package/agent-docs/examples/sdk/06-extensions.ts +88 -88
  90. package/agent-docs/examples/sdk/07-context-files.ts +40 -40
  91. package/agent-docs/examples/sdk/08-prompt-templates.ts +47 -47
  92. package/agent-docs/examples/sdk/09-api-keys-and-oauth.ts +48 -48
  93. package/agent-docs/examples/sdk/10-settings.ts +54 -54
  94. package/agent-docs/examples/sdk/11-sessions.ts +48 -48
  95. package/agent-docs/examples/sdk/12-full-control.ts +82 -82
  96. package/agent-docs/examples/sdk/README.md +144 -144
  97. package/agent-docs/xll-spec.md +110 -110
  98. package/dist/core/auth-storage.js +21 -2
  99. package/package.json +1 -1
  100. package/xll/ShortcutXL.xll +0 -0
  101. package/xll/modules/debug_render.py +272 -272
  102. package/xll/modules/gameboy.py +241 -241
  103. package/xll/modules/pong.py +188 -188
  104. package/xll/modules/shortcut_xl/_diff_highlight.py +176 -0
  105. package/xll/modules/shortcut_xl/_log.py +12 -12
  106. package/xll/modules/shortcut_xl/_registry.py +44 -44
  107. package/xll/modules/stocks.py +100 -100
  108. /package/skills/{com-advanced-api → COM-advanced-api}/SKILL.md +0 -0
  109. /package/skills/{com-advanced-api → COM-advanced-api}/excel-type-library.py +0 -0
  110. /package/skills/{com-advanced-api → COM-advanced-api}/office-type-library.py +0 -0
@@ -1,272 +1,272 @@
1
- """
2
- debug_render.py — Progressive rendering tests for isolating display issues.
3
-
4
- Type these in Excel cells to test each layer of the rendering pipeline:
5
-
6
- =debug_write_test() Layer 1: Can we write to a cell at all via COM?
7
- =debug_batch_test() Layer 2: Does xl_batch() work?
8
- =debug_grid_test() Layer 3: Can we write a 2D grid?
9
- =debug_format_pong() Layer 4: Set column/row sizes for pong display
10
- =debug_frame() Layer 5: Render one static pong frame
11
- =debug_counter() Layer 6: Animated counter (1 cell, 1Hz)
12
- =debug_stop() Stop any running animation
13
- """
14
-
15
- import shortcut_xl
16
- from shortcut_xl import xl_func, xl_log
17
-
18
- _counter_running = False
19
-
20
-
21
- # === Layer 1: Basic COM write ===
22
-
23
- @xl_func
24
- def debug_write_test():
25
- """Write a value to Z1 via xl_app() COM. Simplest possible test."""
26
- try:
27
- def _do(app):
28
- app.ActiveSheet.Range("Z1").Value = "WRITE_OK"
29
- shortcut_xl.xl_batch(_do)
30
- return "Wrote 'WRITE_OK' to Z1 — check Z1"
31
- except Exception as e:
32
- xl_log(f"debug_write_test FAILED: {e}")
33
- return f"FAILED: {e}"
34
-
35
-
36
- # === Layer 2: xl_batch with ScreenUpdating toggle ===
37
-
38
- @xl_func
39
- def debug_batch_test():
40
- """Write 3 cells in one batch. Tests ScreenUpdating toggle + PumpWaitingMessages."""
41
- try:
42
- def _do(app):
43
- sheet = app.ActiveSheet
44
- sheet.Range("Z1").Value = "BATCH"
45
- sheet.Range("Z2").Value = "TEST"
46
- sheet.Range("Z3").Value = "OK"
47
- shortcut_xl.xl_batch(_do)
48
- return "Wrote Z1:Z3 — check those cells"
49
- except Exception as e:
50
- xl_log(f"debug_batch_test FAILED: {e}")
51
- return f"FAILED: {e}"
52
-
53
-
54
- # === Layer 3: 2D grid write via Resize().Value ===
55
-
56
- @xl_func
57
- def debug_grid_test():
58
- """Write a small 5x5 grid using the same Resize().Value pattern as pong."""
59
- try:
60
- grid = []
61
- for r in range(5):
62
- row = []
63
- for c in range(5):
64
- if r == 0 or r == 4 or c == 0 or c == 4:
65
- row.append("#") # border
66
- elif r == 2 and c == 2:
67
- row.append("X") # center
68
- else:
69
- row.append("") # empty (same as pong does)
70
- grid.append(row)
71
-
72
- def _do(app):
73
- sheet = app.ActiveSheet
74
- top = sheet.Range("Z5").Cells(1, 1)
75
- sheet.Range("Z5:AD9").Value = grid
76
-
77
- shortcut_xl.xl_batch(_do)
78
- xl_log(f"debug_grid_test: wrote 5x5 grid to Z5:AD9, data={grid}")
79
- return "Wrote 5x5 grid to Z5:AD9 — check those cells"
80
- except Exception as e:
81
- xl_log(f"debug_grid_test FAILED: {e}")
82
- return f"FAILED: {e}"
83
-
84
-
85
- # === Layer 3b: Grid with tuples (test COM conversion) ===
86
-
87
- @xl_func
88
- def debug_grid_tuple_test():
89
- """Same as grid_test but converts to tuple-of-tuples for COM.
90
- If this works but debug_grid_test doesn't, it's a list-vs-tuple issue."""
91
- try:
92
- grid = []
93
- for r in range(5):
94
- row = []
95
- for c in range(5):
96
- if r == 0 or r == 4 or c == 0 or c == 4:
97
- row.append("#")
98
- elif r == 2 and c == 2:
99
- row.append("X")
100
- else:
101
- row.append("")
102
- grid.append(tuple(row))
103
- grid = tuple(grid)
104
-
105
- def _do(app):
106
- sheet = app.ActiveSheet
107
- sheet.Range("Z5:AD9").Value = grid
108
-
109
- shortcut_xl.xl_batch(_do)
110
- xl_log(f"debug_grid_tuple_test: wrote tuple grid to Z5:AD9")
111
- return "Wrote tuple-of-tuples 5x5 to Z5:AD9"
112
- except Exception as e:
113
- xl_log(f"debug_grid_tuple_test FAILED: {e}")
114
- return f"FAILED: {e}"
115
-
116
-
117
- # === Layer 4: Format cells for pong display ===
118
-
119
- @xl_func
120
- def debug_format_pong():
121
- """Set up column widths and row heights so pong grid looks right.
122
- This is what pong.py is missing — without it, the grid is spread across
123
- the entire screen and looks like nothing."""
124
- try:
125
- def _do(app):
126
- sheet = app.ActiveSheet
127
- # Columns A-AD (1-30): narrow width for character grid
128
- cols = sheet.Range("A:AD")
129
- cols.ColumnWidth = 2.0
130
- cols.HorizontalAlignment = -4108 # xlCenter
131
-
132
- # Rows 3-22 (pong grid area): compact height
133
- rows = sheet.Range("3:22")
134
- rows.RowHeight = 15
135
-
136
- # Monospace font for the grid
137
- grid_range = sheet.Range("A3:AD22")
138
- grid_range.Font.Name = "Consolas"
139
- grid_range.Font.Size = 11
140
-
141
- # Scoreboard formatting
142
- sheet.Range("A1").Font.Name = "Consolas"
143
- sheet.Range("A1").Font.Size = 14
144
- sheet.Range("A1").Font.Bold = True
145
-
146
- shortcut_xl.xl_batch(_do)
147
- return "Formatted A:AD for pong display"
148
- except Exception as e:
149
- xl_log(f"debug_format_pong FAILED: {e}")
150
- return f"FAILED: {e}"
151
-
152
-
153
- # === Layer 5: Static pong frame ===
154
-
155
- @xl_func
156
- def debug_frame():
157
- """Render exactly one pong frame. No animation, no schedule_call.
158
- If this shows up, the rendering works and the issue is in the animation loop."""
159
- try:
160
- WIDTH, HEIGHT, PADDLE_H = 30, 20, 4
161
- grid = []
162
- ball_x, ball_y = 15, 10
163
- paddle_l, paddle_r = 8, 8
164
-
165
- for r in range(HEIGHT):
166
- row = []
167
- for c in range(WIDTH):
168
- ch = ""
169
- if c == 0 and paddle_l <= r < paddle_l + PADDLE_H:
170
- ch = chr(9608) # full block
171
- elif c == WIDTH - 1 and paddle_r <= r < paddle_r + PADDLE_H:
172
- ch = chr(9608)
173
- elif r == ball_y and c == ball_x:
174
- ch = chr(9679) # black circle
175
- elif c == WIDTH // 2 and r % 2 == 0:
176
- ch = chr(9474) # light vertical
177
- row.append(ch)
178
- grid.append(row)
179
-
180
- def _do(app):
181
- sheet = app.ActiveSheet
182
- sheet.Range("A3:AD22").Value = grid
183
- sheet.Range("A1").Value = "PONG 0 : 0"
184
- sheet.Range("A2").Value = "Static frame test"
185
-
186
- shortcut_xl.xl_batch(_do)
187
- xl_log("debug_frame: wrote static pong frame")
188
- return "Wrote static pong frame to A3:AD22"
189
- except Exception as e:
190
- xl_log(f"debug_frame FAILED: {e}")
191
- return f"FAILED: {e}"
192
-
193
-
194
- # === Layer 5b: Static frame with ASCII (no Unicode) ===
195
-
196
- @xl_func
197
- def debug_frame_ascii():
198
- """Same as debug_frame but uses ASCII chars only.
199
- If this renders but debug_frame doesn't, it's a Unicode/font issue."""
200
- try:
201
- WIDTH, HEIGHT, PADDLE_H = 30, 20, 4
202
- grid = []
203
- ball_x, ball_y = 15, 10
204
- paddle_l, paddle_r = 8, 8
205
-
206
- for r in range(HEIGHT):
207
- row = []
208
- for c in range(WIDTH):
209
- ch = "." # visible empty (not "")
210
- if c == 0 and paddle_l <= r < paddle_l + PADDLE_H:
211
- ch = "|"
212
- elif c == WIDTH - 1 and paddle_r <= r < paddle_r + PADDLE_H:
213
- ch = "|"
214
- elif r == ball_y and c == ball_x:
215
- ch = "O"
216
- elif c == WIDTH // 2 and r % 2 == 0:
217
- ch = ":"
218
- row.append(ch)
219
- grid.append(row)
220
-
221
- def _do(app):
222
- sheet = app.ActiveSheet
223
- sheet.Range("A3:AD22").Value = grid
224
- sheet.Range("A1").Value = "PONG 0 : 0"
225
- sheet.Range("A2").Value = "Static ASCII frame test"
226
-
227
- shortcut_xl.xl_batch(_do)
228
- xl_log("debug_frame_ascii: wrote ASCII pong frame")
229
- return "Wrote ASCII pong frame to A3:AD22"
230
- except Exception as e:
231
- xl_log(f"debug_frame_ascii FAILED: {e}")
232
- return f"FAILED: {e}"
233
-
234
-
235
- # === Layer 6: Animated counter (simplest animation) ===
236
-
237
- @xl_func
238
- def debug_counter():
239
- """Increment a single cell once per second. Simplest animation test.
240
- If this works, schedule_call + xl_batch animation pipeline is fine."""
241
- global _counter_running
242
- if _counter_running:
243
- return "Already running! =debug_stop() first"
244
-
245
- _counter_running = True
246
- _count = [0]
247
-
248
- def _tick():
249
- if not _counter_running:
250
- return
251
- _count[0] += 1
252
- xl_log(f"debug_counter tick: {_count[0]}")
253
- try:
254
- def _do(app):
255
- app.ActiveSheet.Range("Z1").Value = f"Count: {_count[0]}"
256
- shortcut_xl.xl_batch(_do)
257
- except Exception as e:
258
- xl_log(f"debug_counter error: {e}")
259
-
260
- if _counter_running and _count[0] < 30:
261
- shortcut_xl.schedule_call(_tick, 1.0)
262
-
263
- shortcut_xl.schedule_call(_tick, 0.1)
264
- return "Counting in Z1 (1/sec, 30 max)"
265
-
266
-
267
- @xl_func
268
- def debug_stop():
269
- """Stop the debug counter."""
270
- global _counter_running
271
- _counter_running = False
272
- return "Stopped"
1
+ """
2
+ debug_render.py — Progressive rendering tests for isolating display issues.
3
+
4
+ Type these in Excel cells to test each layer of the rendering pipeline:
5
+
6
+ =debug_write_test() Layer 1: Can we write to a cell at all via COM?
7
+ =debug_batch_test() Layer 2: Does xl_batch() work?
8
+ =debug_grid_test() Layer 3: Can we write a 2D grid?
9
+ =debug_format_pong() Layer 4: Set column/row sizes for pong display
10
+ =debug_frame() Layer 5: Render one static pong frame
11
+ =debug_counter() Layer 6: Animated counter (1 cell, 1Hz)
12
+ =debug_stop() Stop any running animation
13
+ """
14
+
15
+ import shortcut_xl
16
+ from shortcut_xl import xl_func, xl_log
17
+
18
+ _counter_running = False
19
+
20
+
21
+ # === Layer 1: Basic COM write ===
22
+
23
+ @xl_func
24
+ def debug_write_test():
25
+ """Write a value to Z1 via xl_app() COM. Simplest possible test."""
26
+ try:
27
+ def _do(app):
28
+ app.ActiveSheet.Range("Z1").Value = "WRITE_OK"
29
+ shortcut_xl.xl_batch(_do)
30
+ return "Wrote 'WRITE_OK' to Z1 — check Z1"
31
+ except Exception as e:
32
+ xl_log(f"debug_write_test FAILED: {e}")
33
+ return f"FAILED: {e}"
34
+
35
+
36
+ # === Layer 2: xl_batch with ScreenUpdating toggle ===
37
+
38
+ @xl_func
39
+ def debug_batch_test():
40
+ """Write 3 cells in one batch. Tests ScreenUpdating toggle + PumpWaitingMessages."""
41
+ try:
42
+ def _do(app):
43
+ sheet = app.ActiveSheet
44
+ sheet.Range("Z1").Value = "BATCH"
45
+ sheet.Range("Z2").Value = "TEST"
46
+ sheet.Range("Z3").Value = "OK"
47
+ shortcut_xl.xl_batch(_do)
48
+ return "Wrote Z1:Z3 — check those cells"
49
+ except Exception as e:
50
+ xl_log(f"debug_batch_test FAILED: {e}")
51
+ return f"FAILED: {e}"
52
+
53
+
54
+ # === Layer 3: 2D grid write via Resize().Value ===
55
+
56
+ @xl_func
57
+ def debug_grid_test():
58
+ """Write a small 5x5 grid using the same Resize().Value pattern as pong."""
59
+ try:
60
+ grid = []
61
+ for r in range(5):
62
+ row = []
63
+ for c in range(5):
64
+ if r == 0 or r == 4 or c == 0 or c == 4:
65
+ row.append("#") # border
66
+ elif r == 2 and c == 2:
67
+ row.append("X") # center
68
+ else:
69
+ row.append("") # empty (same as pong does)
70
+ grid.append(row)
71
+
72
+ def _do(app):
73
+ sheet = app.ActiveSheet
74
+ top = sheet.Range("Z5").Cells(1, 1)
75
+ sheet.Range("Z5:AD9").Value = grid
76
+
77
+ shortcut_xl.xl_batch(_do)
78
+ xl_log(f"debug_grid_test: wrote 5x5 grid to Z5:AD9, data={grid}")
79
+ return "Wrote 5x5 grid to Z5:AD9 — check those cells"
80
+ except Exception as e:
81
+ xl_log(f"debug_grid_test FAILED: {e}")
82
+ return f"FAILED: {e}"
83
+
84
+
85
+ # === Layer 3b: Grid with tuples (test COM conversion) ===
86
+
87
+ @xl_func
88
+ def debug_grid_tuple_test():
89
+ """Same as grid_test but converts to tuple-of-tuples for COM.
90
+ If this works but debug_grid_test doesn't, it's a list-vs-tuple issue."""
91
+ try:
92
+ grid = []
93
+ for r in range(5):
94
+ row = []
95
+ for c in range(5):
96
+ if r == 0 or r == 4 or c == 0 or c == 4:
97
+ row.append("#")
98
+ elif r == 2 and c == 2:
99
+ row.append("X")
100
+ else:
101
+ row.append("")
102
+ grid.append(tuple(row))
103
+ grid = tuple(grid)
104
+
105
+ def _do(app):
106
+ sheet = app.ActiveSheet
107
+ sheet.Range("Z5:AD9").Value = grid
108
+
109
+ shortcut_xl.xl_batch(_do)
110
+ xl_log(f"debug_grid_tuple_test: wrote tuple grid to Z5:AD9")
111
+ return "Wrote tuple-of-tuples 5x5 to Z5:AD9"
112
+ except Exception as e:
113
+ xl_log(f"debug_grid_tuple_test FAILED: {e}")
114
+ return f"FAILED: {e}"
115
+
116
+
117
+ # === Layer 4: Format cells for pong display ===
118
+
119
+ @xl_func
120
+ def debug_format_pong():
121
+ """Set up column widths and row heights so pong grid looks right.
122
+ This is what pong.py is missing — without it, the grid is spread across
123
+ the entire screen and looks like nothing."""
124
+ try:
125
+ def _do(app):
126
+ sheet = app.ActiveSheet
127
+ # Columns A-AD (1-30): narrow width for character grid
128
+ cols = sheet.Range("A:AD")
129
+ cols.ColumnWidth = 2.0
130
+ cols.HorizontalAlignment = -4108 # xlCenter
131
+
132
+ # Rows 3-22 (pong grid area): compact height
133
+ rows = sheet.Range("3:22")
134
+ rows.RowHeight = 15
135
+
136
+ # Monospace font for the grid
137
+ grid_range = sheet.Range("A3:AD22")
138
+ grid_range.Font.Name = "Consolas"
139
+ grid_range.Font.Size = 11
140
+
141
+ # Scoreboard formatting
142
+ sheet.Range("A1").Font.Name = "Consolas"
143
+ sheet.Range("A1").Font.Size = 14
144
+ sheet.Range("A1").Font.Bold = True
145
+
146
+ shortcut_xl.xl_batch(_do)
147
+ return "Formatted A:AD for pong display"
148
+ except Exception as e:
149
+ xl_log(f"debug_format_pong FAILED: {e}")
150
+ return f"FAILED: {e}"
151
+
152
+
153
+ # === Layer 5: Static pong frame ===
154
+
155
+ @xl_func
156
+ def debug_frame():
157
+ """Render exactly one pong frame. No animation, no schedule_call.
158
+ If this shows up, the rendering works and the issue is in the animation loop."""
159
+ try:
160
+ WIDTH, HEIGHT, PADDLE_H = 30, 20, 4
161
+ grid = []
162
+ ball_x, ball_y = 15, 10
163
+ paddle_l, paddle_r = 8, 8
164
+
165
+ for r in range(HEIGHT):
166
+ row = []
167
+ for c in range(WIDTH):
168
+ ch = ""
169
+ if c == 0 and paddle_l <= r < paddle_l + PADDLE_H:
170
+ ch = chr(9608) # full block
171
+ elif c == WIDTH - 1 and paddle_r <= r < paddle_r + PADDLE_H:
172
+ ch = chr(9608)
173
+ elif r == ball_y and c == ball_x:
174
+ ch = chr(9679) # black circle
175
+ elif c == WIDTH // 2 and r % 2 == 0:
176
+ ch = chr(9474) # light vertical
177
+ row.append(ch)
178
+ grid.append(row)
179
+
180
+ def _do(app):
181
+ sheet = app.ActiveSheet
182
+ sheet.Range("A3:AD22").Value = grid
183
+ sheet.Range("A1").Value = "PONG 0 : 0"
184
+ sheet.Range("A2").Value = "Static frame test"
185
+
186
+ shortcut_xl.xl_batch(_do)
187
+ xl_log("debug_frame: wrote static pong frame")
188
+ return "Wrote static pong frame to A3:AD22"
189
+ except Exception as e:
190
+ xl_log(f"debug_frame FAILED: {e}")
191
+ return f"FAILED: {e}"
192
+
193
+
194
+ # === Layer 5b: Static frame with ASCII (no Unicode) ===
195
+
196
+ @xl_func
197
+ def debug_frame_ascii():
198
+ """Same as debug_frame but uses ASCII chars only.
199
+ If this renders but debug_frame doesn't, it's a Unicode/font issue."""
200
+ try:
201
+ WIDTH, HEIGHT, PADDLE_H = 30, 20, 4
202
+ grid = []
203
+ ball_x, ball_y = 15, 10
204
+ paddle_l, paddle_r = 8, 8
205
+
206
+ for r in range(HEIGHT):
207
+ row = []
208
+ for c in range(WIDTH):
209
+ ch = "." # visible empty (not "")
210
+ if c == 0 and paddle_l <= r < paddle_l + PADDLE_H:
211
+ ch = "|"
212
+ elif c == WIDTH - 1 and paddle_r <= r < paddle_r + PADDLE_H:
213
+ ch = "|"
214
+ elif r == ball_y and c == ball_x:
215
+ ch = "O"
216
+ elif c == WIDTH // 2 and r % 2 == 0:
217
+ ch = ":"
218
+ row.append(ch)
219
+ grid.append(row)
220
+
221
+ def _do(app):
222
+ sheet = app.ActiveSheet
223
+ sheet.Range("A3:AD22").Value = grid
224
+ sheet.Range("A1").Value = "PONG 0 : 0"
225
+ sheet.Range("A2").Value = "Static ASCII frame test"
226
+
227
+ shortcut_xl.xl_batch(_do)
228
+ xl_log("debug_frame_ascii: wrote ASCII pong frame")
229
+ return "Wrote ASCII pong frame to A3:AD22"
230
+ except Exception as e:
231
+ xl_log(f"debug_frame_ascii FAILED: {e}")
232
+ return f"FAILED: {e}"
233
+
234
+
235
+ # === Layer 6: Animated counter (simplest animation) ===
236
+
237
+ @xl_func
238
+ def debug_counter():
239
+ """Increment a single cell once per second. Simplest animation test.
240
+ If this works, schedule_call + xl_batch animation pipeline is fine."""
241
+ global _counter_running
242
+ if _counter_running:
243
+ return "Already running! =debug_stop() first"
244
+
245
+ _counter_running = True
246
+ _count = [0]
247
+
248
+ def _tick():
249
+ if not _counter_running:
250
+ return
251
+ _count[0] += 1
252
+ xl_log(f"debug_counter tick: {_count[0]}")
253
+ try:
254
+ def _do(app):
255
+ app.ActiveSheet.Range("Z1").Value = f"Count: {_count[0]}"
256
+ shortcut_xl.xl_batch(_do)
257
+ except Exception as e:
258
+ xl_log(f"debug_counter error: {e}")
259
+
260
+ if _counter_running and _count[0] < 30:
261
+ shortcut_xl.schedule_call(_tick, 1.0)
262
+
263
+ shortcut_xl.schedule_call(_tick, 0.1)
264
+ return "Counting in Z1 (1/sec, 30 max)"
265
+
266
+
267
+ @xl_func
268
+ def debug_stop():
269
+ """Stop the debug counter."""
270
+ global _counter_running
271
+ _counter_running = False
272
+ return "Stopped"