claudekit-cli 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +2 -0
- package/biome.json +1 -1
- package/bun.lock +17 -7
- package/dist/index.js +12352 -9730
- package/package.json +2 -2
- package/src/commands/new.ts +5 -2
- package/src/commands/update.ts +5 -2
- package/src/lib/download.ts +165 -35
- package/src/lib/github.ts +31 -14
- package/src/types.ts +2 -1
- package/src/utils/logger.ts +2 -2
- package/src/utils/safe-prompts.ts +21 -31
- package/src/utils/safe-spinner.ts +38 -0
- package/tests/lib/github-download-priority.test.ts +136 -5
- package/tests/types.test.ts +3 -0
|
@@ -17,6 +17,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
17
17
|
{
|
|
18
18
|
id: 1,
|
|
19
19
|
name: "other-file.tar.gz",
|
|
20
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/1",
|
|
20
21
|
browser_download_url: "https://github.com/test/other-file.tar.gz",
|
|
21
22
|
size: 1024,
|
|
22
23
|
content_type: "application/gzip",
|
|
@@ -24,6 +25,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
24
25
|
{
|
|
25
26
|
id: 2,
|
|
26
27
|
name: "ClaudeKit-Engineer-Package.zip",
|
|
28
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/2",
|
|
27
29
|
browser_download_url: "https://github.com/test/claudekit-package.zip",
|
|
28
30
|
size: 2048,
|
|
29
31
|
content_type: "application/zip",
|
|
@@ -35,7 +37,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
35
37
|
|
|
36
38
|
expect(result.type).toBe("asset");
|
|
37
39
|
expect(result.name).toBe("ClaudeKit-Engineer-Package.zip");
|
|
38
|
-
expect(result.url).toBe("https://github.com/test/
|
|
40
|
+
expect(result.url).toBe("https://api.github.com/repos/test/repo/releases/assets/2");
|
|
39
41
|
expect(result.size).toBe(2048);
|
|
40
42
|
});
|
|
41
43
|
|
|
@@ -52,6 +54,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
52
54
|
{
|
|
53
55
|
id: 1,
|
|
54
56
|
name: "random.zip",
|
|
57
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/1",
|
|
55
58
|
browser_download_url: "https://github.com/test/random.zip",
|
|
56
59
|
size: 512,
|
|
57
60
|
content_type: "application/zip",
|
|
@@ -59,6 +62,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
59
62
|
{
|
|
60
63
|
id: 2,
|
|
61
64
|
name: "ClaudeKit-Marketing-Package.zip",
|
|
65
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/2",
|
|
62
66
|
browser_download_url: "https://github.com/test/marketing-package.zip",
|
|
63
67
|
size: 2048,
|
|
64
68
|
content_type: "application/zip",
|
|
@@ -70,7 +74,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
70
74
|
|
|
71
75
|
expect(result.type).toBe("asset");
|
|
72
76
|
expect(result.name).toBe("ClaudeKit-Marketing-Package.zip");
|
|
73
|
-
expect(result.url).toBe("https://github.com/test/
|
|
77
|
+
expect(result.url).toBe("https://api.github.com/repos/test/repo/releases/assets/2");
|
|
74
78
|
});
|
|
75
79
|
|
|
76
80
|
test("should match ClaudeKit package case-insensitively", () => {
|
|
@@ -86,6 +90,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
86
90
|
{
|
|
87
91
|
id: 1,
|
|
88
92
|
name: "claudekit-engineer-package.zip",
|
|
93
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/1",
|
|
89
94
|
browser_download_url: "https://github.com/test/package.zip",
|
|
90
95
|
size: 2048,
|
|
91
96
|
content_type: "application/zip",
|
|
@@ -111,8 +116,9 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
111
116
|
assets: [
|
|
112
117
|
{
|
|
113
118
|
id: 1,
|
|
114
|
-
name: "
|
|
115
|
-
|
|
119
|
+
name: "release-package.zip",
|
|
120
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/1",
|
|
121
|
+
browser_download_url: "https://github.com/test/release.zip",
|
|
116
122
|
size: 1024,
|
|
117
123
|
content_type: "application/zip",
|
|
118
124
|
},
|
|
@@ -122,7 +128,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
122
128
|
const result = GitHubClient.getDownloadableAsset(release);
|
|
123
129
|
|
|
124
130
|
expect(result.type).toBe("asset");
|
|
125
|
-
expect(result.name).toBe("
|
|
131
|
+
expect(result.name).toBe("release-package.zip");
|
|
126
132
|
});
|
|
127
133
|
|
|
128
134
|
test("should fallback to tar.gz files if no zip found", () => {
|
|
@@ -138,6 +144,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
138
144
|
{
|
|
139
145
|
id: 1,
|
|
140
146
|
name: "release.tar.gz",
|
|
147
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/1",
|
|
141
148
|
browser_download_url: "https://github.com/test/release.tar.gz",
|
|
142
149
|
size: 1024,
|
|
143
150
|
content_type: "application/gzip",
|
|
@@ -164,6 +171,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
164
171
|
{
|
|
165
172
|
id: 1,
|
|
166
173
|
name: "release.tgz",
|
|
174
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/1",
|
|
167
175
|
browser_download_url: "https://github.com/test/release.tgz",
|
|
168
176
|
size: 1024,
|
|
169
177
|
content_type: "application/gzip",
|
|
@@ -210,6 +218,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
210
218
|
{
|
|
211
219
|
id: 1,
|
|
212
220
|
name: "README.md",
|
|
221
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/1",
|
|
213
222
|
browser_download_url: "https://github.com/test/README.md",
|
|
214
223
|
size: 128,
|
|
215
224
|
content_type: "text/markdown",
|
|
@@ -217,6 +226,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
217
226
|
{
|
|
218
227
|
id: 2,
|
|
219
228
|
name: "checksums.txt",
|
|
229
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/2",
|
|
220
230
|
browser_download_url: "https://github.com/test/checksums.txt",
|
|
221
231
|
size: 64,
|
|
222
232
|
content_type: "text/plain",
|
|
@@ -243,6 +253,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
243
253
|
{
|
|
244
254
|
id: 1,
|
|
245
255
|
name: "source.tar.gz",
|
|
256
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/1",
|
|
246
257
|
browser_download_url: "https://github.com/test/source.tar.gz",
|
|
247
258
|
size: 5000,
|
|
248
259
|
content_type: "application/gzip",
|
|
@@ -250,6 +261,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
250
261
|
{
|
|
251
262
|
id: 2,
|
|
252
263
|
name: "docs.zip",
|
|
264
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/2",
|
|
253
265
|
browser_download_url: "https://github.com/test/docs.zip",
|
|
254
266
|
size: 3000,
|
|
255
267
|
content_type: "application/zip",
|
|
@@ -257,6 +269,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
257
269
|
{
|
|
258
270
|
id: 3,
|
|
259
271
|
name: "ClaudeKit-Engineer-Package.zip",
|
|
272
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/3",
|
|
260
273
|
browser_download_url: "https://github.com/test/package.zip",
|
|
261
274
|
size: 2000,
|
|
262
275
|
content_type: "application/zip",
|
|
@@ -285,6 +298,7 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
285
298
|
{
|
|
286
299
|
id: 1,
|
|
287
300
|
name: "claudekit_marketing_package.zip",
|
|
301
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/1",
|
|
288
302
|
browser_download_url: "https://github.com/test/package.zip",
|
|
289
303
|
size: 2000,
|
|
290
304
|
content_type: "application/zip",
|
|
@@ -297,5 +311,122 @@ describe("GitHubClient - Asset Download Priority", () => {
|
|
|
297
311
|
expect(result.type).toBe("asset");
|
|
298
312
|
expect(result.name).toBe("claudekit_marketing_package.zip");
|
|
299
313
|
});
|
|
314
|
+
|
|
315
|
+
test("should handle assets with spaces in name", () => {
|
|
316
|
+
const release: GitHubRelease = {
|
|
317
|
+
id: 1,
|
|
318
|
+
tag_name: "v1.4.0",
|
|
319
|
+
name: "Release 1.4.0",
|
|
320
|
+
draft: false,
|
|
321
|
+
prerelease: false,
|
|
322
|
+
tarball_url: "https://api.github.com/repos/test/repo/tarball/v1.4.0",
|
|
323
|
+
zipball_url: "https://api.github.com/repos/test/repo/zipball/v1.4.0",
|
|
324
|
+
assets: [
|
|
325
|
+
{
|
|
326
|
+
id: 1,
|
|
327
|
+
name: "Changelog",
|
|
328
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/1",
|
|
329
|
+
browser_download_url: "https://github.com/test/changelog",
|
|
330
|
+
size: 7979,
|
|
331
|
+
content_type: "text/plain",
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
id: 2,
|
|
335
|
+
name: "ClaudeKit Engineer Package.zip",
|
|
336
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/2",
|
|
337
|
+
browser_download_url: "https://github.com/test/package.zip",
|
|
338
|
+
size: 3334963,
|
|
339
|
+
content_type: "application/zip",
|
|
340
|
+
},
|
|
341
|
+
],
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
const result = GitHubClient.getDownloadableAsset(release);
|
|
345
|
+
|
|
346
|
+
expect(result.type).toBe("asset");
|
|
347
|
+
expect(result.name).toBe("ClaudeKit Engineer Package.zip");
|
|
348
|
+
expect(result.size).toBe(3334963);
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
test("should exclude assets named 'Source code' or starting with 'source'", () => {
|
|
352
|
+
const release: GitHubRelease = {
|
|
353
|
+
id: 1,
|
|
354
|
+
tag_name: "v1.0.0",
|
|
355
|
+
name: "Release 1.0.0",
|
|
356
|
+
draft: false,
|
|
357
|
+
prerelease: false,
|
|
358
|
+
tarball_url: "https://api.github.com/repos/test/repo/tarball/v1.0.0",
|
|
359
|
+
zipball_url: "https://api.github.com/repos/test/repo/zipball/v1.0.0",
|
|
360
|
+
assets: [
|
|
361
|
+
{
|
|
362
|
+
id: 1,
|
|
363
|
+
name: "Source code.zip",
|
|
364
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/1",
|
|
365
|
+
browser_download_url: "https://github.com/test/source.zip",
|
|
366
|
+
size: 5000,
|
|
367
|
+
content_type: "application/zip",
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
id: 2,
|
|
371
|
+
name: "source-archive.tar.gz",
|
|
372
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/2",
|
|
373
|
+
browser_download_url: "https://github.com/test/source.tar.gz",
|
|
374
|
+
size: 4500,
|
|
375
|
+
content_type: "application/gzip",
|
|
376
|
+
},
|
|
377
|
+
],
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
const result = GitHubClient.getDownloadableAsset(release);
|
|
381
|
+
|
|
382
|
+
// Should fall back to tarball instead of using "Source code" assets
|
|
383
|
+
expect(result.type).toBe("tarball");
|
|
384
|
+
expect(result.url).toBe("https://api.github.com/repos/test/repo/tarball/v1.0.0");
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
test("should prioritize ClaudeKit package over source code archives", () => {
|
|
388
|
+
const release: GitHubRelease = {
|
|
389
|
+
id: 1,
|
|
390
|
+
tag_name: "v1.4.0",
|
|
391
|
+
name: "Release 1.4.0",
|
|
392
|
+
draft: false,
|
|
393
|
+
prerelease: false,
|
|
394
|
+
tarball_url: "https://api.github.com/repos/test/repo/tarball/v1.4.0",
|
|
395
|
+
zipball_url: "https://api.github.com/repos/test/repo/zipball/v1.4.0",
|
|
396
|
+
assets: [
|
|
397
|
+
{
|
|
398
|
+
id: 1,
|
|
399
|
+
name: "Source code.zip",
|
|
400
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/1",
|
|
401
|
+
browser_download_url: "https://github.com/test/source.zip",
|
|
402
|
+
size: 5000,
|
|
403
|
+
content_type: "application/zip",
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
id: 2,
|
|
407
|
+
name: "ClaudeKit Engineer Package.zip",
|
|
408
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/2",
|
|
409
|
+
browser_download_url: "https://github.com/test/package.zip",
|
|
410
|
+
size: 3334963,
|
|
411
|
+
content_type: "application/zip",
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
id: 3,
|
|
415
|
+
name: "Source code.tar.gz",
|
|
416
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/3",
|
|
417
|
+
browser_download_url: "https://github.com/test/source.tar.gz",
|
|
418
|
+
size: 4500,
|
|
419
|
+
content_type: "application/gzip",
|
|
420
|
+
},
|
|
421
|
+
],
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
const result = GitHubClient.getDownloadableAsset(release);
|
|
425
|
+
|
|
426
|
+
// Should pick the ClaudeKit package and ignore source code archives
|
|
427
|
+
expect(result.type).toBe("asset");
|
|
428
|
+
expect(result.name).toBe("ClaudeKit Engineer Package.zip");
|
|
429
|
+
expect(result.size).toBe(3334963);
|
|
430
|
+
});
|
|
300
431
|
});
|
|
301
432
|
});
|
package/tests/types.test.ts
CHANGED
|
@@ -108,6 +108,7 @@ describe("Types and Schemas", () => {
|
|
|
108
108
|
const asset = {
|
|
109
109
|
id: 123,
|
|
110
110
|
name: "release.tar.gz",
|
|
111
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/123",
|
|
111
112
|
browser_download_url: "https://github.com/test/release.tar.gz",
|
|
112
113
|
size: 1024,
|
|
113
114
|
content_type: "application/gzip",
|
|
@@ -122,6 +123,7 @@ describe("Types and Schemas", () => {
|
|
|
122
123
|
const asset = {
|
|
123
124
|
id: 123,
|
|
124
125
|
name: "release.tar.gz",
|
|
126
|
+
url: "not-a-url",
|
|
125
127
|
browser_download_url: "not-a-url",
|
|
126
128
|
size: 1024,
|
|
127
129
|
content_type: "application/gzip",
|
|
@@ -150,6 +152,7 @@ describe("Types and Schemas", () => {
|
|
|
150
152
|
{
|
|
151
153
|
id: 123,
|
|
152
154
|
name: "release.tar.gz",
|
|
155
|
+
url: "https://api.github.com/repos/test/repo/releases/assets/123",
|
|
153
156
|
browser_download_url: "https://github.com/test/release.tar.gz",
|
|
154
157
|
size: 1024,
|
|
155
158
|
content_type: "application/gzip",
|