@guildai/cli 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/dist/auth-CRMO5O3N.js +29 -0
  2. package/dist/auth-CRMO5O3N.js.map +7 -0
  3. package/dist/chat-5VX2WJH2.js +303 -0
  4. package/dist/chat-5VX2WJH2.js.map +7 -0
  5. package/dist/chat-SIKDYZQK.js +31 -0
  6. package/dist/chat-SIKDYZQK.js.map +7 -0
  7. package/dist/chunk-56YCMGL3.js +522 -0
  8. package/dist/chunk-56YCMGL3.js.map +7 -0
  9. package/dist/chunk-6EX6E7WP.js +7042 -0
  10. package/dist/chunk-6EX6E7WP.js.map +7 -0
  11. package/dist/chunk-B7VAF5UG.js +532 -0
  12. package/dist/chunk-B7VAF5UG.js.map +7 -0
  13. package/dist/chunk-DOIYVBNY.js +3057 -0
  14. package/dist/chunk-DOIYVBNY.js.map +7 -0
  15. package/dist/chunk-ENKEEJ45.js +17 -0
  16. package/dist/chunk-ENKEEJ45.js.map +7 -0
  17. package/dist/chunk-IBRKVGMZ.js +97041 -0
  18. package/dist/chunk-IBRKVGMZ.js.map +7 -0
  19. package/dist/chunk-LFMQJOKC.js +19778 -0
  20. package/dist/chunk-LFMQJOKC.js.map +7 -0
  21. package/dist/chunk-M347HP6M.js +22896 -0
  22. package/dist/chunk-M347HP6M.js.map +7 -0
  23. package/dist/chunk-OYQ476FQ.js +44 -0
  24. package/dist/chunk-OYQ476FQ.js.map +7 -0
  25. package/dist/chunk-PNCUR4OB.js +257 -0
  26. package/dist/chunk-PNCUR4OB.js.map +7 -0
  27. package/dist/chunk-RIG2HZWM.js +317 -0
  28. package/dist/chunk-RIG2HZWM.js.map +7 -0
  29. package/dist/chunk-SPZPZXUN.js +826 -0
  30. package/dist/chunk-SPZPZXUN.js.map +7 -0
  31. package/dist/chunk-VVSOU6ON.js +53 -0
  32. package/dist/chunk-VVSOU6ON.js.map +7 -0
  33. package/dist/chunk-X3ADGWOF.js +3643 -0
  34. package/dist/chunk-X3ADGWOF.js.map +7 -0
  35. package/dist/commands/agent/logs.d.ts +3 -0
  36. package/dist/commands/setup.d.ts +16 -0
  37. package/dist/commands/skill/create.d.ts +3 -0
  38. package/dist/commands/skill/get.d.ts +3 -0
  39. package/dist/commands/skill/list.d.ts +3 -0
  40. package/dist/commands/skill/update.d.ts +3 -0
  41. package/dist/commands/skill/version/create.d.ts +3 -0
  42. package/dist/commands/skill/version/get.d.ts +3 -0
  43. package/dist/commands/skill/version/list.d.ts +3 -0
  44. package/dist/devtools-AO7YSDOD.js +67 -0
  45. package/dist/devtools-AO7YSDOD.js.map +7 -0
  46. package/dist/dist-4CBK6X5H.js +1566 -0
  47. package/dist/dist-4CBK6X5H.js.map +7 -0
  48. package/dist/esm-FRAVZP4J.js +13 -0
  49. package/dist/esm-FRAVZP4J.js.map +7 -0
  50. package/dist/execa-XQMWSABC.js +35 -0
  51. package/dist/execa-XQMWSABC.js.map +7 -0
  52. package/dist/index.js +8231 -253
  53. package/dist/index.js.map +7 -0
  54. package/dist/lib/api-types.d.ts +44 -0
  55. package/dist/lib/auth.d.ts +1 -1
  56. package/dist/lib/config.d.ts +9 -0
  57. package/dist/lib/errors.d.ts +1 -1
  58. package/dist/lib/output-mode.d.ts +9 -2
  59. package/dist/lib/output.d.ts +17 -1
  60. package/dist/lib/session-events.d.ts +14 -3
  61. package/dist/lib/session-polling.d.ts +24 -1
  62. package/dist/lib/session-resume.d.ts +15 -1
  63. package/dist/lib/stdin.d.ts +5 -1
  64. package/dist/lib/websocket-client.d.ts +46 -0
  65. package/dist/open-RF4X5MOP.js +13 -0
  66. package/dist/open-RF4X5MOP.js.map +7 -0
  67. package/dist/server-JYVH64FD.js +27659 -0
  68. package/dist/server-JYVH64FD.js.map +7 -0
  69. package/dist/test-SNIYRJ32.js +692 -0
  70. package/dist/test-SNIYRJ32.js.map +7 -0
  71. package/docs/skills/codex-agent-dev.md +2 -2
  72. package/package.json +8 -12
  73. package/dist/commands/agent/chat.js +0 -278
  74. package/dist/commands/agent/clone.js +0 -116
  75. package/dist/commands/agent/code.js +0 -87
  76. package/dist/commands/agent/fork.js +0 -218
  77. package/dist/commands/agent/get.js +0 -37
  78. package/dist/commands/agent/grep.js +0 -107
  79. package/dist/commands/agent/init.js +0 -390
  80. package/dist/commands/agent/list.js +0 -110
  81. package/dist/commands/agent/owners.js +0 -74
  82. package/dist/commands/agent/publish.js +0 -91
  83. package/dist/commands/agent/pull.js +0 -198
  84. package/dist/commands/agent/revalidate.js +0 -56
  85. package/dist/commands/agent/save.js +0 -346
  86. package/dist/commands/agent/search.js +0 -61
  87. package/dist/commands/agent/tags/add.js +0 -73
  88. package/dist/commands/agent/tags/list.js +0 -43
  89. package/dist/commands/agent/tags/remove.js +0 -84
  90. package/dist/commands/agent/tags/set.js +0 -71
  91. package/dist/commands/agent/test.js +0 -486
  92. package/dist/commands/agent/unpublish.js +0 -64
  93. package/dist/commands/agent/update.js +0 -110
  94. package/dist/commands/agent/versions.js +0 -55
  95. package/dist/commands/agent/workspaces.js +0 -54
  96. package/dist/commands/auth/login.js +0 -33
  97. package/dist/commands/auth/logout.js +0 -24
  98. package/dist/commands/auth/status.js +0 -38
  99. package/dist/commands/auth/token.js +0 -19
  100. package/dist/commands/chat.js +0 -1345
  101. package/dist/commands/config/get.js +0 -64
  102. package/dist/commands/config/list.js +0 -47
  103. package/dist/commands/config/path.js +0 -38
  104. package/dist/commands/config/set.js +0 -132
  105. package/dist/commands/credentials/endpoint-list.js +0 -88
  106. package/dist/commands/credentials/list.js +0 -50
  107. package/dist/commands/credentials/policy-create.js +0 -66
  108. package/dist/commands/credentials/policy-delete.js +0 -33
  109. package/dist/commands/credentials/policy-list.js +0 -45
  110. package/dist/commands/credentials/policy-update.js +0 -66
  111. package/dist/commands/doctor.js +0 -233
  112. package/dist/commands/integration/connect.js +0 -76
  113. package/dist/commands/integration/create.js +0 -298
  114. package/dist/commands/integration/get.js +0 -95
  115. package/dist/commands/integration/list.js +0 -62
  116. package/dist/commands/integration/operation/create.js +0 -164
  117. package/dist/commands/integration/operation/list.js +0 -92
  118. package/dist/commands/integration/update.js +0 -139
  119. package/dist/commands/integration/version/build.js +0 -86
  120. package/dist/commands/integration/version/create.js +0 -45
  121. package/dist/commands/integration/version/get.js +0 -72
  122. package/dist/commands/integration/version/list.js +0 -45
  123. package/dist/commands/integration/version/publish.js +0 -79
  124. package/dist/commands/integration/version/test.js +0 -104
  125. package/dist/commands/job/get-step.js +0 -40
  126. package/dist/commands/job/get.js +0 -44
  127. package/dist/commands/mcp.js +0 -34
  128. package/dist/commands/session/create.js +0 -59
  129. package/dist/commands/session/events.js +0 -56
  130. package/dist/commands/session/get.js +0 -33
  131. package/dist/commands/session/interrupt.js +0 -33
  132. package/dist/commands/session/list.js +0 -59
  133. package/dist/commands/session/send.js +0 -54
  134. package/dist/commands/session/tasks.js +0 -45
  135. package/dist/commands/setup.js +0 -230
  136. package/dist/commands/trigger/activate.js +0 -41
  137. package/dist/commands/trigger/create.js +0 -197
  138. package/dist/commands/trigger/deactivate.js +0 -41
  139. package/dist/commands/trigger/get.js +0 -33
  140. package/dist/commands/trigger/list.js +0 -57
  141. package/dist/commands/trigger/sessions.js +0 -48
  142. package/dist/commands/trigger/update.js +0 -128
  143. package/dist/commands/version.js +0 -24
  144. package/dist/commands/workspace/agent/add.js +0 -114
  145. package/dist/commands/workspace/agent/list.js +0 -78
  146. package/dist/commands/workspace/agent/remove.js +0 -78
  147. package/dist/commands/workspace/clear.js +0 -45
  148. package/dist/commands/workspace/context/edit.js +0 -107
  149. package/dist/commands/workspace/context/get.js +0 -47
  150. package/dist/commands/workspace/context/list.js +0 -51
  151. package/dist/commands/workspace/context/publish.js +0 -42
  152. package/dist/commands/workspace/create.js +0 -51
  153. package/dist/commands/workspace/current.js +0 -63
  154. package/dist/commands/workspace/get.js +0 -39
  155. package/dist/commands/workspace/list.js +0 -70
  156. package/dist/commands/workspace/select.js +0 -184
  157. package/dist/components/AgentInstallPrompt.js +0 -97
  158. package/dist/components/SplashAnimation.js +0 -321
  159. package/dist/components/TaskView.js +0 -268
  160. package/dist/lib/agent-helpers.js +0 -306
  161. package/dist/lib/alternate-screen.js +0 -59
  162. package/dist/lib/api-client.js +0 -154
  163. package/dist/lib/api-types.js +0 -10
  164. package/dist/lib/auth.js +0 -284
  165. package/dist/lib/braille-canvas.js +0 -321
  166. package/dist/lib/colors.js +0 -46
  167. package/dist/lib/config-cache.js +0 -45
  168. package/dist/lib/config.js +0 -153
  169. package/dist/lib/did-you-mean.js +0 -144
  170. package/dist/lib/errors.js +0 -375
  171. package/dist/lib/event-filter.js +0 -91
  172. package/dist/lib/generated-types.js +0 -56
  173. package/dist/lib/git.js +0 -176
  174. package/dist/lib/gk.js +0 -91
  175. package/dist/lib/guild-config.js +0 -178
  176. package/dist/lib/iap.js +0 -117
  177. package/dist/lib/integration-helpers.js +0 -38
  178. package/dist/lib/loading-messages.js +0 -72
  179. package/dist/lib/logo.js +0 -141
  180. package/dist/lib/lottie-serverside.js +0 -181
  181. package/dist/lib/markdown.js +0 -38
  182. package/dist/lib/npmrc.js +0 -59
  183. package/dist/lib/output-mode.js +0 -33
  184. package/dist/lib/output.js +0 -591
  185. package/dist/lib/owner-helpers.js +0 -112
  186. package/dist/lib/polling.js +0 -76
  187. package/dist/lib/progress.js +0 -324
  188. package/dist/lib/session-events-fetch.js +0 -25
  189. package/dist/lib/session-events.js +0 -112
  190. package/dist/lib/session-polling.js +0 -160
  191. package/dist/lib/session-resume.js +0 -96
  192. package/dist/lib/spinners.js +0 -770
  193. package/dist/lib/splash.js +0 -41
  194. package/dist/lib/stdin.js +0 -84
  195. package/dist/lib/svg-to-braille.js +0 -76
  196. package/dist/lib/table.js +0 -59
  197. package/dist/lib/update-check.js +0 -65
  198. package/dist/lib/validate-input-schema.js +0 -208
  199. package/dist/lib/version-helpers.js +0 -121
  200. package/dist/lib/workspace-helpers.js +0 -49
  201. package/dist/mcp/resources.js +0 -67
  202. package/dist/mcp/server.js +0 -64
  203. package/dist/mcp/tools.js +0 -753
@@ -1,770 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- /**
4
- * Animated Spinners - Real-time animated spinners using braille canvas
5
- *
6
- * Spinners can be simple (frame-based) or complex (particle simulations).
7
- * All spinners expose a tick() method for real-time rendering.
8
- *
9
- * Color schemes are decoupled from patterns:
10
- * - GUILD_SPINNER_THEME controls the pattern (classic, wave, rain, etc.)
11
- * - GUILD_SPINNER_COLOR controls the color (guild, white, cyan, rainbow)
12
- */
13
- import chalk from 'chalk';
14
- import { BrailleCanvas } from './braille-canvas.js';
15
- /**
16
- * Guild brand colors - rust orange to warm grey palette
17
- */
18
- const GUILD_COLORS = [
19
- '#d4522a', // bright saturated orange
20
- '#c45c3e', // rust orange
21
- '#b34a2d', // deeper rust
22
- '#a84832', // darker rust
23
- '#8b5a3c', // warm brown
24
- '#6b4d3a', // dark brown
25
- '#5c4a42', // grey-brown
26
- '#4a4544', // warm grey
27
- '#3a3838', // darker grey
28
- ];
29
- /**
30
- * Cyan gradient - bright cyan to dark cyan (matrix-style)
31
- */
32
- const CYAN_COLORS = [
33
- '#00ffff', // bright cyan
34
- '#00e6e6', // lighter cyan
35
- '#00cccc', // light cyan
36
- '#00b3b3', // medium-light cyan
37
- '#009999', // medium cyan
38
- '#008080', // teal
39
- '#006666', // darker teal
40
- '#004d4d', // dark teal
41
- '#003333', // very dark teal
42
- ];
43
- /**
44
- * Get the active color scheme from environment
45
- * Falls back to the spinner's default color if not explicitly set
46
- */
47
- function getColorScheme(defaultColor) {
48
- const envColor = process.env.GUILD_SPINNER_COLOR?.toLowerCase();
49
- // Explicit color overrides (not 'random')
50
- if (envColor === 'white' ||
51
- envColor === 'cyan' ||
52
- envColor === 'rainbow' ||
53
- envColor === 'guild') {
54
- return envColor;
55
- }
56
- // Use spinner's default color
57
- return defaultColor;
58
- }
59
- /**
60
- * Apply color scheme to a canvas
61
- */
62
- function applyColorScheme(canvas, tick, defaultColor) {
63
- const colorScheme = getColorScheme(defaultColor);
64
- const charWidth = canvas.getCharWidth();
65
- switch (colorScheme) {
66
- case 'white':
67
- for (let cx = 0; cx < charWidth; cx++) {
68
- canvas.setCellColor(cx, 0, { fg: '#ffffff' });
69
- }
70
- break;
71
- case 'cyan':
72
- // Slow color cycling through cyan gradient - change every 4 ticks
73
- for (let cx = 0; cx < charWidth; cx++) {
74
- const colorIndex = (Math.floor(tick / 4) + cx) % CYAN_COLORS.length;
75
- canvas.setCellColor(cx, 0, { fg: CYAN_COLORS[colorIndex] });
76
- }
77
- break;
78
- case 'rainbow':
79
- for (let cx = 0; cx < charWidth; cx++) {
80
- const hue = (tick * 3 + cx * 40) % 360;
81
- canvas.setCellColor(cx, 0, { fg: hslToHex(hue, 0.9, 0.5) });
82
- }
83
- break;
84
- case 'guild':
85
- default:
86
- // Slow color cycling - change every 4 ticks
87
- for (let cx = 0; cx < charWidth; cx++) {
88
- const colorIndex = (Math.floor(tick / 4) + cx) % GUILD_COLORS.length;
89
- canvas.setCellColor(cx, 0, { fg: GUILD_COLORS[colorIndex] });
90
- }
91
- break;
92
- }
93
- }
94
- /**
95
- * Get list of available spinner themes
96
- */
97
- export function getSpinnerThemeList() {
98
- return [
99
- { name: 'wave', description: 'Flowing wave (default)' },
100
- { name: 'classic', description: 'Classic braille spinner' },
101
- { name: 'random', description: 'Random spinner, changes periodically' },
102
- { name: 'snow', description: 'Gentle snowfall animation' },
103
- { name: 'wave2', description: 'Dual waves with sweeping rainbow' },
104
- { name: 'orbit', description: 'Dots circling around center' },
105
- { name: 'fireworks', description: 'Exploding particle bursts' },
106
- { name: 'confetti', description: 'Colorful particles drifting' },
107
- { name: 'pulse', description: 'Breathing pulsing shape' },
108
- { name: 'radar', description: 'Rotating radar sweep' },
109
- { name: 'spiral', description: 'Rotating spiral pattern' },
110
- { name: 'guild', description: 'Rotating pinwheel logo' },
111
- { name: 'rain', description: 'Digital rain falling' },
112
- ];
113
- }
114
- /**
115
- * Spinner themes for random selection (3-char wide spinners only)
116
- */
117
- const SPINNER_THEMES = [
118
- 'snow',
119
- 'wave',
120
- 'wave2',
121
- 'orbit',
122
- 'fireworks',
123
- 'confetti',
124
- 'pulse',
125
- 'radar',
126
- 'spiral',
127
- 'guild',
128
- 'rain',
129
- ];
130
- /**
131
- * Create a spinner instance for the active theme
132
- * If GUILD_SPINNER_THEME env var is set, uses that theme.
133
- * Otherwise, defaults to wave spinner with guild colors.
134
- */
135
- export function createSpinner() {
136
- const envTheme = process.env.GUILD_SPINNER_THEME;
137
- if (envTheme) {
138
- return createSpinnerByName(envTheme);
139
- }
140
- return createWaveSpinner();
141
- }
142
- /**
143
- * Create a random spinner from the available themes
144
- */
145
- export function createRandomSpinner() {
146
- const randomTheme = SPINNER_THEMES[Math.floor(Math.random() * SPINNER_THEMES.length)];
147
- return createSpinnerByName(randomTheme);
148
- }
149
- /**
150
- * Create a spinner by theme name
151
- */
152
- export function createSpinnerByName(name) {
153
- switch (name) {
154
- case 'random':
155
- return createRandomSpinner();
156
- case 'snow':
157
- return createSnowSpinner();
158
- case 'wave':
159
- return createWaveSpinner();
160
- case 'wave2':
161
- return createWave2Spinner();
162
- case 'orbit':
163
- return createOrbitSpinner();
164
- case 'fireworks':
165
- return createFireworksSpinner();
166
- case 'confetti':
167
- return createConfettiSpinner();
168
- case 'pulse':
169
- return createPulseSpinner();
170
- case 'radar':
171
- return createRadarSpinner();
172
- case 'spiral':
173
- return createSpiralSpinner();
174
- case 'guild':
175
- return createGuildSpinner();
176
- case 'rain':
177
- return createRainSpinner();
178
- case 'classic':
179
- default:
180
- return createClassicSpinner();
181
- }
182
- }
183
- // =============================================================================
184
- // SPINNERS
185
- // =============================================================================
186
- /**
187
- * Get color for a single-character spinner based on color scheme
188
- */
189
- function getSpinnerColor(tick, defaultColor) {
190
- const colorScheme = getColorScheme(defaultColor);
191
- switch (colorScheme) {
192
- case 'white':
193
- return '#ffffff';
194
- case 'cyan': {
195
- // Slow color cycling through cyan gradient - change every 3 frames
196
- const colorIndex = Math.floor(tick / 3) % CYAN_COLORS.length;
197
- return CYAN_COLORS[colorIndex];
198
- }
199
- case 'rainbow': {
200
- const hue = (tick * 15) % 360;
201
- return hslToHex(hue, 0.9, 0.5);
202
- }
203
- case 'guild':
204
- default: {
205
- // Slow color cycling - change every 3 frames
206
- const colorIndex = Math.floor(tick / 3) % GUILD_COLORS.length;
207
- return GUILD_COLORS[colorIndex];
208
- }
209
- }
210
- }
211
- /**
212
- * Classic braille spinner
213
- */
214
- function createClassicSpinner() {
215
- const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
216
- let frameIndex = 0;
217
- return {
218
- name: 'classic',
219
- defaultColor: 'rainbow',
220
- frameInterval: 80,
221
- tick() {
222
- const color = getSpinnerColor(frameIndex, 'rainbow');
223
- const frame = chalk.hex(color)(frames[frameIndex]);
224
- frameIndex = (frameIndex + 1) % frames.length;
225
- return frame;
226
- },
227
- };
228
- }
229
- /**
230
- * Convert HSL to hex color
231
- */
232
- function hslToHex(h, s, l) {
233
- const c = (1 - Math.abs(2 * l - 1)) * s;
234
- const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
235
- const m = l - c / 2;
236
- let r = 0, g = 0, b = 0;
237
- if (h < 60) {
238
- r = c;
239
- g = x;
240
- }
241
- else if (h < 120) {
242
- r = x;
243
- g = c;
244
- }
245
- else if (h < 180) {
246
- g = c;
247
- b = x;
248
- }
249
- else if (h < 240) {
250
- g = x;
251
- b = c;
252
- }
253
- else if (h < 300) {
254
- r = x;
255
- b = c;
256
- }
257
- else {
258
- r = c;
259
- b = x;
260
- }
261
- const toHex = (n) => Math.round((n + m) * 255)
262
- .toString(16)
263
- .padStart(2, '0');
264
- return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
265
- }
266
- /**
267
- * Wave spinner - animated sine wave with thick stroke
268
- */
269
- function createWaveSpinner() {
270
- const width = 6; // 3 braille chars
271
- let tick = 0;
272
- return {
273
- name: 'wave',
274
- defaultColor: 'guild',
275
- frameInterval: 50,
276
- tick() {
277
- const canvas = new BrailleCanvas(width, 4);
278
- // Draw thick sine wave (2 pixels tall)
279
- for (let x = 0; x < width; x++) {
280
- const phase = (tick * 0.3 + x * 0.5) % (Math.PI * 2);
281
- const y = 1.5 + Math.sin(phase) * 1.2;
282
- const y1 = Math.floor(y);
283
- const y2 = Math.ceil(y);
284
- canvas.setPixel(x, y1, true);
285
- if (y2 !== y1) {
286
- canvas.setPixel(x, y2, true);
287
- }
288
- }
289
- applyColorScheme(canvas, tick, 'guild');
290
- tick++;
291
- return canvas.renderLine();
292
- },
293
- };
294
- }
295
- /**
296
- * Wave2 spinner - dual sine waves with sweeping rainbow gradient
297
- */
298
- function createWave2Spinner() {
299
- const width = 6; // 3 braille chars
300
- let tick = 0;
301
- return {
302
- name: 'wave2',
303
- defaultColor: 'rainbow',
304
- frameInterval: 50,
305
- tick() {
306
- const canvas = new BrailleCanvas(width, 4);
307
- // Draw two overlapping sine waves at different frequencies
308
- for (let x = 0; x < width; x++) {
309
- // Primary wave
310
- const phase1 = (tick * 0.6 + x * 0.5) % (Math.PI * 2);
311
- const y1 = Math.floor(1.5 + Math.sin(phase1) * 1.3);
312
- canvas.setPixel(x, y1, true);
313
- // Secondary wave (slightly different frequency)
314
- const phase2 = (tick * 0.48 + x * 0.65) % (Math.PI * 2);
315
- const y2 = Math.floor(1.5 + Math.sin(phase2) * 1.3);
316
- canvas.setPixel(x, y2, true);
317
- }
318
- applyColorScheme(canvas, tick, 'rainbow');
319
- tick++;
320
- return canvas.renderLine();
321
- },
322
- };
323
- }
324
- /**
325
- * Snow spinner - dense blizzard simulation
326
- */
327
- function createSnowSpinner() {
328
- const width = 6; // 3 braille chars = 6 pixels
329
- const height = 4; // 4 pixels tall
330
- let tick = 0;
331
- const flakes = [];
332
- let wind = 0;
333
- let windTarget = 0;
334
- // Spawn a new snowflake
335
- function spawnFlake() {
336
- flakes.push({
337
- x: Math.random() * width,
338
- y: -0.5,
339
- speed: 0.15 + Math.random() * 0.25, // gentle: 0.15 to 0.4
340
- drift: (Math.random() - 0.5) * 0.15,
341
- });
342
- }
343
- // Initialize with some flakes
344
- for (let i = 0; i < 5; i++) {
345
- flakes.push({
346
- x: Math.random() * width,
347
- y: Math.random() * height,
348
- speed: 0.15 + Math.random() * 0.25,
349
- drift: (Math.random() - 0.5) * 0.15,
350
- });
351
- }
352
- return {
353
- name: 'snow',
354
- defaultColor: 'white',
355
- frameInterval: 60,
356
- tick() {
357
- const canvas = new BrailleCanvas(width, height);
358
- // Gentle wind
359
- if (Math.random() < 0.08) {
360
- windTarget = (Math.random() - 0.5) * 0.3;
361
- }
362
- wind += (windTarget - wind) * 0.1;
363
- windTarget *= 0.97;
364
- // Maintain moderate density
365
- while (flakes.length < 6) {
366
- spawnFlake();
367
- }
368
- // Update and draw flakes
369
- for (let i = flakes.length - 1; i >= 0; i--) {
370
- const f = flakes[i];
371
- f.y += f.speed;
372
- f.x += f.drift + wind;
373
- // Wrap horizontally for continuous blizzard
374
- if (f.x < 0)
375
- f.x += width;
376
- if (f.x >= width)
377
- f.x -= width;
378
- // Remove only if off bottom
379
- if (f.y >= height) {
380
- flakes.splice(i, 1);
381
- continue;
382
- }
383
- const px = Math.floor(f.x);
384
- const py = Math.floor(f.y);
385
- if (py >= 0 && px >= 0 && px < width) {
386
- canvas.setPixel(px, py, true);
387
- }
388
- }
389
- applyColorScheme(canvas, tick, 'white');
390
- tick++;
391
- return canvas.renderLine();
392
- },
393
- };
394
- }
395
- /**
396
- * Draw a 2x2 block at the given position (for thicker strokes)
397
- */
398
- function drawBlock(canvas, x, y, width, height) {
399
- const px = Math.floor(x);
400
- const py = Math.floor(y);
401
- // Draw 2x2 block
402
- for (let dy = 0; dy < 2; dy++) {
403
- for (let dx = 0; dx < 2; dx++) {
404
- const bx = px + dx;
405
- const by = py + dy;
406
- if (bx >= 0 && bx < width && by >= 0 && by < height) {
407
- canvas.setPixel(bx, by, true);
408
- }
409
- }
410
- }
411
- }
412
- /**
413
- * Orbit spinner - dots circling around center
414
- */
415
- function createOrbitSpinner() {
416
- const width = 6;
417
- const height = 4;
418
- let tick = 0;
419
- return {
420
- name: 'orbit',
421
- defaultColor: 'guild',
422
- frameInterval: 50,
423
- tick() {
424
- const canvas = new BrailleCanvas(width, height);
425
- const centerX = width / 2;
426
- const centerY = height / 2;
427
- // Two dots orbiting opposite each other (2x2 blocks)
428
- for (let i = 0; i < 2; i++) {
429
- const angle = (tick * 0.2 + i * Math.PI) % (Math.PI * 2);
430
- const radius = 1.3;
431
- const x = centerX + Math.cos(angle) * radius * 1.4 - 0.5;
432
- const y = centerY + Math.sin(angle) * radius - 0.5;
433
- drawBlock(canvas, x, y, width, height);
434
- }
435
- applyColorScheme(canvas, tick, 'guild');
436
- tick++;
437
- return canvas.renderLine();
438
- },
439
- };
440
- }
441
- /**
442
- * Fireworks spinner - particles exploding outward
443
- */
444
- function createFireworksSpinner() {
445
- const width = 6;
446
- const height = 4;
447
- let tick = 0;
448
- let particles = [];
449
- let cooldown = 0;
450
- return {
451
- name: 'fireworks',
452
- defaultColor: 'rainbow',
453
- frameInterval: 50,
454
- tick() {
455
- const canvas = new BrailleCanvas(width, height);
456
- // Spawn new explosion
457
- cooldown--;
458
- if (cooldown <= 0 && particles.length < 8) {
459
- const cx = 1 + Math.random() * (width - 2);
460
- const cy = 1 + Math.random() * (height - 2);
461
- for (let i = 0; i < 6; i++) {
462
- const angle = (i / 6) * Math.PI * 2;
463
- particles.push({
464
- x: cx,
465
- y: cy,
466
- vx: Math.cos(angle) * 0.5,
467
- vy: Math.sin(angle) * 0.4,
468
- life: 6 + Math.floor(Math.random() * 4),
469
- });
470
- }
471
- cooldown = 10;
472
- }
473
- // Update particles
474
- for (let i = particles.length - 1; i >= 0; i--) {
475
- const p = particles[i];
476
- p.x += p.vx;
477
- p.y += p.vy;
478
- p.vy += 0.05; // gravity
479
- p.life--;
480
- if (p.life <= 0) {
481
- particles.splice(i, 1);
482
- continue;
483
- }
484
- // Draw 2x2 block for each particle
485
- drawBlock(canvas, p.x, p.y, width, height);
486
- }
487
- applyColorScheme(canvas, tick, 'rainbow');
488
- tick++;
489
- return canvas.renderLine();
490
- },
491
- };
492
- }
493
- /**
494
- * Confetti spinner - colorful particles drifting down
495
- */
496
- function createConfettiSpinner() {
497
- const width = 6;
498
- const height = 4;
499
- let tick = 0;
500
- const pieces = [];
501
- for (let i = 0; i < 4; i++) {
502
- pieces.push({
503
- x: Math.random() * width,
504
- y: Math.random() * height,
505
- vx: (Math.random() - 0.5) * 0.3,
506
- speed: 0.1 + Math.random() * 0.2,
507
- });
508
- }
509
- return {
510
- name: 'confetti',
511
- defaultColor: 'rainbow',
512
- frameInterval: 70,
513
- tick() {
514
- const canvas = new BrailleCanvas(width, height);
515
- // Spawn new pieces
516
- if (Math.random() < 0.3 && pieces.length < 6) {
517
- pieces.push({
518
- x: Math.random() * width,
519
- y: -0.5,
520
- vx: (Math.random() - 0.5) * 0.3,
521
- speed: 0.1 + Math.random() * 0.2,
522
- });
523
- }
524
- // Update pieces
525
- for (let i = pieces.length - 1; i >= 0; i--) {
526
- const p = pieces[i];
527
- p.y += p.speed;
528
- p.x += p.vx + Math.sin(p.y * 2) * 0.1; // wobble
529
- if (p.y >= height) {
530
- pieces.splice(i, 1);
531
- continue;
532
- }
533
- // Draw 2x2 block for each piece
534
- drawBlock(canvas, p.x, p.y, width, height);
535
- }
536
- applyColorScheme(canvas, tick, 'rainbow');
537
- tick++;
538
- return canvas.renderLine();
539
- },
540
- };
541
- }
542
- /**
543
- * Pulse spinner - concentric rings that pulse outward
544
- */
545
- function createPulseSpinner() {
546
- const width = 6;
547
- const height = 4;
548
- let tick = 0;
549
- return {
550
- name: 'pulse',
551
- defaultColor: 'rainbow',
552
- frameInterval: 50,
553
- tick() {
554
- const canvas = new BrailleCanvas(width, height);
555
- const centerX = (width - 1) / 2;
556
- const centerY = (height - 1) / 2;
557
- // Draw expanding ring
558
- const phase = (tick * 0.12) % (Math.PI * 2);
559
- const ringRadius = 0.5 + (Math.sin(phase) + 1) * 1.2;
560
- for (let y = 0; y < height; y++) {
561
- for (let x = 0; x < width; x++) {
562
- const dx = (x - centerX) * 0.7;
563
- const dy = y - centerY;
564
- const dist = Math.sqrt(dx * dx + dy * dy);
565
- // Draw ring (not filled circle)
566
- if (Math.abs(dist - ringRadius) < 0.6) {
567
- canvas.setPixel(x, y, true);
568
- }
569
- // Draw center dot
570
- if (dist < 0.5) {
571
- canvas.setPixel(x, y, true);
572
- }
573
- }
574
- }
575
- applyColorScheme(canvas, tick, 'rainbow');
576
- tick++;
577
- return canvas.renderLine();
578
- },
579
- };
580
- }
581
- /**
582
- * Radar spinner - rotating sweep line
583
- */
584
- function createRadarSpinner() {
585
- const width = 6;
586
- const height = 4;
587
- let tick = 0;
588
- return {
589
- name: 'radar',
590
- defaultColor: 'cyan',
591
- frameInterval: 50,
592
- tick() {
593
- const canvas = new BrailleCanvas(width, height);
594
- const centerX = width / 2;
595
- const centerY = height / 2;
596
- const angle = tick * 0.12;
597
- // Draw sweep line
598
- for (let r = 0; r < 3; r++) {
599
- const x = Math.floor(centerX + Math.cos(angle) * r * 1.2);
600
- const y = Math.floor(centerY + Math.sin(angle) * r * 0.8);
601
- if (x >= 0 && x < width && y >= 0 && y < height) {
602
- canvas.setPixel(x, y, true);
603
- }
604
- }
605
- // Draw fading trail
606
- for (let i = 1; i < 3; i++) {
607
- const trailAngle = angle - i * 0.3;
608
- const x = Math.floor(centerX + Math.cos(trailAngle) * 2);
609
- const y = Math.floor(centerY + Math.sin(trailAngle) * 1.2);
610
- if (x >= 0 && x < width && y >= 0 && y < height) {
611
- canvas.setPixel(x, y, true);
612
- }
613
- }
614
- applyColorScheme(canvas, tick, 'cyan');
615
- tick++;
616
- return canvas.renderLine();
617
- },
618
- };
619
- }
620
- /**
621
- * Spiral spinner - rotating spiral pattern
622
- */
623
- function createSpiralSpinner() {
624
- const width = 6;
625
- const height = 4;
626
- let tick = 0;
627
- return {
628
- name: 'spiral',
629
- defaultColor: 'rainbow',
630
- frameInterval: 50,
631
- tick() {
632
- const canvas = new BrailleCanvas(width, height);
633
- const centerX = width / 2;
634
- const centerY = height / 2;
635
- // Draw spiral arms
636
- for (let arm = 0; arm < 2; arm++) {
637
- for (let r = 0.5; r < 2.5; r += 0.5) {
638
- const angle = tick * 0.15 + r * 1.2 + arm * Math.PI;
639
- const x = Math.floor(centerX + Math.cos(angle) * r * 1.2);
640
- const y = Math.floor(centerY + Math.sin(angle) * r * 0.7);
641
- if (x >= 0 && x < width && y >= 0 && y < height) {
642
- canvas.setPixel(x, y, true);
643
- }
644
- }
645
- }
646
- applyColorScheme(canvas, tick, 'rainbow');
647
- tick++;
648
- return canvas.renderLine();
649
- },
650
- };
651
- }
652
- /**
653
- * Guild spinner - rotating pinwheel logo
654
- */
655
- function createGuildSpinner() {
656
- const width = 6;
657
- const height = 4;
658
- let tick = 0;
659
- return {
660
- name: 'guild',
661
- defaultColor: 'guild',
662
- frameInterval: 60,
663
- tick() {
664
- const canvas = new BrailleCanvas(width, height);
665
- const centerX = width / 2;
666
- const centerY = height / 2;
667
- const angle = tick * 0.2;
668
- // Four arms of the pinwheel, each offset by 90 degrees
669
- for (let arm = 0; arm < 4; arm++) {
670
- const armAngle = angle + (arm * Math.PI) / 2;
671
- // Swirl effect: arm curves outward
672
- const innerR = 0.8;
673
- const outerR = 1.8;
674
- // Draw 2 pixels per arm to show the curve
675
- for (let i = 0; i < 2; i++) {
676
- const r = innerR + i * (outerR - innerR);
677
- // Add swirl offset that increases with radius
678
- const swirl = i * 0.4;
679
- const px = Math.floor(centerX + Math.cos(armAngle + swirl) * r * 1.3);
680
- const py = Math.floor(centerY + Math.sin(armAngle + swirl) * r * 0.9);
681
- if (px >= 0 && px < width && py >= 0 && py < height) {
682
- canvas.setPixel(px, py, true);
683
- }
684
- }
685
- }
686
- applyColorScheme(canvas, tick, 'guild');
687
- tick++;
688
- return canvas.renderLine();
689
- },
690
- };
691
- }
692
- /**
693
- * Rain spinner - dots raining down
694
- */
695
- function createRainSpinner() {
696
- const width = 6;
697
- const height = 4;
698
- const drops = Array(width).fill(-1);
699
- let tick = 0;
700
- return {
701
- name: 'rain',
702
- defaultColor: 'cyan',
703
- frameInterval: 70,
704
- tick() {
705
- const canvas = new BrailleCanvas(width, height);
706
- for (let x = 0; x < width; x++) {
707
- // Random new drops
708
- if (drops[x] < 0 && Math.random() < 0.15) {
709
- drops[x] = 0;
710
- }
711
- if (drops[x] >= 0) {
712
- // Draw drop and trail
713
- for (let t = 0; t < 3; t++) {
714
- const y = Math.floor(drops[x]) - t;
715
- if (y >= 0 && y < height) {
716
- canvas.setPixel(x, y, true);
717
- }
718
- }
719
- drops[x] += 0.4;
720
- if (drops[x] > height + 2) {
721
- drops[x] = -1 - Math.random() * 3;
722
- }
723
- }
724
- }
725
- applyColorScheme(canvas, tick, 'cyan');
726
- tick++;
727
- return canvas.renderLine();
728
- },
729
- };
730
- }
731
- /**
732
- * @deprecated Use createSpinner() instead
733
- */
734
- export function getSpinnerThemes() {
735
- const themes = new Map();
736
- // Only classic works well with legacy interface
737
- const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
738
- themes.set('classic', {
739
- name: 'classic',
740
- description: 'Classic braille spinner',
741
- frameCount: frames.length,
742
- frameInterval: 80,
743
- generateFrame: (index) => {
744
- const color = getSpinnerColor(index, 'rainbow');
745
- return chalk.hex(color)(frames[index]);
746
- },
747
- });
748
- return themes;
749
- }
750
- /**
751
- * @deprecated Use createSpinner() instead
752
- */
753
- export function getActiveTheme() {
754
- const theme = getSpinnerThemes().get('classic');
755
- if (!theme)
756
- throw new Error('Missing classic spinner theme');
757
- return theme;
758
- }
759
- /**
760
- * @deprecated Use createSpinner() instead
761
- */
762
- export function generateSpinnerFrames() {
763
- const theme = getActiveTheme();
764
- const frames = [];
765
- for (let i = 0; i < theme.frameCount; i++) {
766
- frames.push(theme.generateFrame(i));
767
- }
768
- return frames;
769
- }
770
- //# sourceMappingURL=spinners.js.map