claudekit-cli 1.4.0 → 1.5.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 (50) hide show
  1. package/bin/ck-darwin-arm64 +0 -0
  2. package/bin/ck-darwin-x64 +0 -0
  3. package/bin/ck-linux-x64 +0 -0
  4. package/bin/ck-win32-x64.exe +0 -0
  5. package/package.json +8 -2
  6. package/scripts/postinstall.js +74 -0
  7. package/.github/workflows/ci.yml +0 -45
  8. package/.github/workflows/claude-code-review.yml +0 -57
  9. package/.github/workflows/claude.yml +0 -50
  10. package/.github/workflows/release.yml +0 -102
  11. package/.releaserc.json +0 -17
  12. package/.repomixignore +0 -15
  13. package/AGENTS.md +0 -217
  14. package/CHANGELOG.md +0 -88
  15. package/CLAUDE.md +0 -34
  16. package/biome.json +0 -28
  17. package/bun.lock +0 -863
  18. package/dist/index.js +0 -22489
  19. package/src/commands/new.ts +0 -185
  20. package/src/commands/update.ts +0 -174
  21. package/src/commands/version.ts +0 -135
  22. package/src/index.ts +0 -102
  23. package/src/lib/auth.ts +0 -157
  24. package/src/lib/download.ts +0 -654
  25. package/src/lib/github.ts +0 -230
  26. package/src/lib/merge.ts +0 -116
  27. package/src/lib/prompts.ts +0 -114
  28. package/src/types.ts +0 -171
  29. package/src/utils/config.ts +0 -87
  30. package/src/utils/file-scanner.ts +0 -134
  31. package/src/utils/logger.ts +0 -124
  32. package/src/utils/safe-prompts.ts +0 -44
  33. package/src/utils/safe-spinner.ts +0 -38
  34. package/src/version.json +0 -3
  35. package/test-integration/demo/.mcp.json +0 -13
  36. package/test-integration/demo/.repomixignore +0 -15
  37. package/test-integration/demo/CLAUDE.md +0 -34
  38. package/tests/commands/version.test.ts +0 -297
  39. package/tests/integration/cli.test.ts +0 -252
  40. package/tests/lib/auth.test.ts +0 -116
  41. package/tests/lib/download.test.ts +0 -292
  42. package/tests/lib/github-download-priority.test.ts +0 -432
  43. package/tests/lib/github.test.ts +0 -52
  44. package/tests/lib/merge.test.ts +0 -215
  45. package/tests/lib/prompts.test.ts +0 -66
  46. package/tests/types.test.ts +0 -337
  47. package/tests/utils/config.test.ts +0 -263
  48. package/tests/utils/file-scanner.test.ts +0 -202
  49. package/tests/utils/logger.test.ts +0 -239
  50. package/tsconfig.json +0 -30
@@ -1,202 +0,0 @@
1
- import { afterEach, beforeEach, describe, expect, test } from "bun:test";
2
- import { join } from "node:path";
3
- import { mkdir, remove, writeFile } from "fs-extra";
4
- import { FileScanner } from "../../src/utils/file-scanner.js";
5
-
6
- describe("FileScanner", () => {
7
- const testDir = join(__dirname, "..", "..", "temp-test-file-scanner");
8
- const destDir = join(testDir, "dest");
9
- const sourceDir = join(testDir, "source");
10
-
11
- beforeEach(async () => {
12
- // Clean up and create test directories
13
- await remove(testDir);
14
- await mkdir(testDir, { recursive: true });
15
- await mkdir(destDir, { recursive: true });
16
- await mkdir(sourceDir, { recursive: true });
17
- });
18
-
19
- afterEach(async () => {
20
- // Clean up test directories
21
- await remove(testDir);
22
- });
23
-
24
- describe("getFiles", () => {
25
- test("should return empty array for non-existent directory", async () => {
26
- const files = await FileScanner.getFiles(join(testDir, "non-existent"));
27
- expect(files).toEqual([]);
28
- });
29
-
30
- test("should return files from directory", async () => {
31
- // Create test files
32
- await writeFile(join(destDir, "file1.txt"), "content1");
33
- await writeFile(join(destDir, "file2.txt"), "content2");
34
-
35
- const files = await FileScanner.getFiles(destDir);
36
-
37
- expect(files).toHaveLength(2);
38
- expect(files).toContain("file1.txt");
39
- expect(files).toContain("file2.txt");
40
- });
41
-
42
- test("should recursively scan subdirectories", async () => {
43
- // Create nested structure
44
- await mkdir(join(destDir, "subdir"), { recursive: true });
45
- await writeFile(join(destDir, "file1.txt"), "content1");
46
- await writeFile(join(destDir, "subdir", "file2.txt"), "content2");
47
-
48
- const files = await FileScanner.getFiles(destDir);
49
-
50
- expect(files).toHaveLength(2);
51
- expect(files).toContain("file1.txt");
52
- expect(files).toContain("subdir/file2.txt");
53
- });
54
-
55
- test("should handle empty directory", async () => {
56
- const files = await FileScanner.getFiles(destDir);
57
- expect(files).toEqual([]);
58
- });
59
-
60
- test("should handle deeply nested directories", async () => {
61
- // Create deeply nested structure
62
- const deepPath = join(destDir, "a", "b", "c", "d");
63
- await mkdir(deepPath, { recursive: true });
64
- await writeFile(join(deepPath, "deep.txt"), "deep content");
65
-
66
- const files = await FileScanner.getFiles(destDir);
67
-
68
- expect(files).toHaveLength(1);
69
- expect(files).toContain("a/b/c/d/deep.txt");
70
- });
71
-
72
- test("should return relative paths", async () => {
73
- await mkdir(join(destDir, "subdir"), { recursive: true });
74
- await writeFile(join(destDir, "subdir", "file.txt"), "content");
75
-
76
- const files = await FileScanner.getFiles(destDir);
77
-
78
- // Should return relative path, not absolute
79
- expect(files[0]).toBe("subdir/file.txt");
80
- expect(files[0]).not.toContain(destDir);
81
- });
82
- });
83
-
84
- describe("findCustomFiles", () => {
85
- test("should identify files in dest but not in source", async () => {
86
- // Create .claude directories
87
- const destClaudeDir = join(destDir, ".claude");
88
- const sourceClaudeDir = join(sourceDir, ".claude");
89
- await mkdir(destClaudeDir, { recursive: true });
90
- await mkdir(sourceClaudeDir, { recursive: true });
91
-
92
- // Create files
93
- await writeFile(join(destClaudeDir, "custom.md"), "custom content");
94
- await writeFile(join(destClaudeDir, "standard.md"), "standard content");
95
- await writeFile(join(sourceClaudeDir, "standard.md"), "standard content");
96
-
97
- const customFiles = await FileScanner.findCustomFiles(destDir, sourceDir, ".claude");
98
-
99
- expect(customFiles).toHaveLength(1);
100
- expect(customFiles).toContain(".claude/custom.md");
101
- });
102
-
103
- test("should return empty array when no custom files exist", async () => {
104
- // Create .claude directories
105
- const destClaudeDir = join(destDir, ".claude");
106
- const sourceClaudeDir = join(sourceDir, ".claude");
107
- await mkdir(destClaudeDir, { recursive: true });
108
- await mkdir(sourceClaudeDir, { recursive: true });
109
-
110
- // Create same files in both
111
- await writeFile(join(destClaudeDir, "file1.md"), "content1");
112
- await writeFile(join(sourceClaudeDir, "file1.md"), "content1");
113
-
114
- const customFiles = await FileScanner.findCustomFiles(destDir, sourceDir, ".claude");
115
-
116
- expect(customFiles).toEqual([]);
117
- });
118
-
119
- test("should handle missing .claude in destination", async () => {
120
- // Only create source .claude directory
121
- const sourceClaudeDir = join(sourceDir, ".claude");
122
- await mkdir(sourceClaudeDir, { recursive: true });
123
- await writeFile(join(sourceClaudeDir, "file1.md"), "content1");
124
-
125
- const customFiles = await FileScanner.findCustomFiles(destDir, sourceDir, ".claude");
126
-
127
- expect(customFiles).toEqual([]);
128
- });
129
-
130
- test("should handle missing .claude in source", async () => {
131
- // Only create dest .claude directory
132
- const destClaudeDir = join(destDir, ".claude");
133
- await mkdir(destClaudeDir, { recursive: true });
134
- await writeFile(join(destClaudeDir, "custom.md"), "custom content");
135
-
136
- const customFiles = await FileScanner.findCustomFiles(destDir, sourceDir, ".claude");
137
-
138
- expect(customFiles).toHaveLength(1);
139
- expect(customFiles).toContain(".claude/custom.md");
140
- });
141
-
142
- test("should handle nested subdirectories", async () => {
143
- // Create nested structure
144
- const destNestedDir = join(destDir, ".claude", "commands");
145
- const sourceNestedDir = join(sourceDir, ".claude", "commands");
146
- await mkdir(destNestedDir, { recursive: true });
147
- await mkdir(sourceNestedDir, { recursive: true });
148
-
149
- // Create custom file in nested dir
150
- await writeFile(join(destNestedDir, "custom-cmd.md"), "custom command");
151
- await writeFile(join(destNestedDir, "standard-cmd.md"), "standard command");
152
- await writeFile(join(sourceNestedDir, "standard-cmd.md"), "standard command");
153
-
154
- const customFiles = await FileScanner.findCustomFiles(destDir, sourceDir, ".claude");
155
-
156
- expect(customFiles).toHaveLength(1);
157
- expect(customFiles).toContain(".claude/commands/custom-cmd.md");
158
- });
159
-
160
- test("should handle multiple custom files", async () => {
161
- // Create .claude directories
162
- const destClaudeDir = join(destDir, ".claude");
163
- const sourceClaudeDir = join(sourceDir, ".claude");
164
- await mkdir(destClaudeDir, { recursive: true });
165
- await mkdir(sourceClaudeDir, { recursive: true });
166
-
167
- // Create multiple custom files
168
- await writeFile(join(destClaudeDir, "custom1.md"), "custom1");
169
- await writeFile(join(destClaudeDir, "custom2.md"), "custom2");
170
- await writeFile(join(destClaudeDir, "custom3.md"), "custom3");
171
- await writeFile(join(destClaudeDir, "standard.md"), "standard");
172
- await writeFile(join(sourceClaudeDir, "standard.md"), "standard");
173
-
174
- const customFiles = await FileScanner.findCustomFiles(destDir, sourceDir, ".claude");
175
-
176
- expect(customFiles).toHaveLength(3);
177
- expect(customFiles).toContain(".claude/custom1.md");
178
- expect(customFiles).toContain(".claude/custom2.md");
179
- expect(customFiles).toContain(".claude/custom3.md");
180
- });
181
-
182
- test("should handle files with special characters in names", async () => {
183
- // Create .claude directories
184
- const destClaudeDir = join(destDir, ".claude");
185
- const sourceClaudeDir = join(sourceDir, ".claude");
186
- await mkdir(destClaudeDir, { recursive: true });
187
- await mkdir(sourceClaudeDir, { recursive: true });
188
-
189
- // Create files with special characters
190
- await writeFile(join(destClaudeDir, "file-with-dash.md"), "content");
191
- await writeFile(join(destClaudeDir, "file_with_underscore.md"), "content");
192
- await writeFile(join(destClaudeDir, "file.multiple.dots.md"), "content");
193
-
194
- const customFiles = await FileScanner.findCustomFiles(destDir, sourceDir, ".claude");
195
-
196
- expect(customFiles).toHaveLength(3);
197
- expect(customFiles).toContain(".claude/file-with-dash.md");
198
- expect(customFiles).toContain(".claude/file_with_underscore.md");
199
- expect(customFiles).toContain(".claude/file.multiple.dots.md");
200
- });
201
- });
202
- });
@@ -1,239 +0,0 @@
1
- import { afterEach, beforeEach, describe, expect, mock, test } from "bun:test";
2
- import { logger } from "../../src/utils/logger.js";
3
-
4
- describe("Logger Utilities", () => {
5
- let consoleLogSpy: any;
6
- let consoleErrorSpy: any;
7
- const originalDebug = process.env.DEBUG;
8
-
9
- beforeEach(() => {
10
- // Reset logger state
11
- logger.setVerbose(false);
12
- logger.setLogFile(undefined);
13
-
14
- consoleLogSpy = mock(() => {});
15
- consoleErrorSpy = mock(() => {});
16
- console.log = consoleLogSpy;
17
- console.error = consoleErrorSpy;
18
- });
19
-
20
- afterEach(() => {
21
- process.env.DEBUG = originalDebug;
22
- consoleLogSpy.mockRestore?.();
23
- consoleErrorSpy.mockRestore?.();
24
- });
25
-
26
- describe("info", () => {
27
- test("should log info messages", () => {
28
- logger.info("Test info message");
29
- expect(consoleLogSpy).toHaveBeenCalled();
30
- });
31
- });
32
-
33
- describe("success", () => {
34
- test("should log success messages", () => {
35
- logger.success("Test success message");
36
- expect(consoleLogSpy).toHaveBeenCalled();
37
- });
38
- });
39
-
40
- describe("warning", () => {
41
- test("should log warning messages", () => {
42
- logger.warning("Test warning message");
43
- expect(consoleLogSpy).toHaveBeenCalled();
44
- });
45
- });
46
-
47
- describe("error", () => {
48
- test("should log error messages", () => {
49
- logger.error("Test error message");
50
- expect(consoleErrorSpy).toHaveBeenCalled();
51
- });
52
- });
53
-
54
- describe("debug", () => {
55
- test("should log debug messages when DEBUG is set", () => {
56
- process.env.DEBUG = "true";
57
- logger.debug("Test debug message");
58
- expect(consoleLogSpy).toHaveBeenCalled();
59
- });
60
-
61
- test("should not log debug messages when DEBUG is not set", () => {
62
- process.env.DEBUG = undefined;
63
- logger.debug("Test debug message");
64
- expect(consoleLogSpy).not.toHaveBeenCalled();
65
- });
66
- });
67
-
68
- describe("sanitize", () => {
69
- test("should sanitize ghp_ tokens (36 chars)", () => {
70
- const text = "Token: ghp_123456789012345678901234567890123456";
71
- const sanitized = logger.sanitize(text);
72
- expect(sanitized).toBe("Token: ghp_***");
73
- });
74
-
75
- test("should sanitize github_pat_ tokens (82 chars)", () => {
76
- // github_pat_ prefix + 82 alphanumeric/underscore characters (exact length)
77
- const token =
78
- "1234567890123456789012345678901234567890123456789012345678901234567890123456789012";
79
- const text = `Token: github_pat_${token}`;
80
- const sanitized = logger.sanitize(text);
81
- expect(sanitized).toBe("Token: github_pat_***");
82
- });
83
-
84
- test("should sanitize gho_ tokens (36 chars)", () => {
85
- const text = "Token: gho_123456789012345678901234567890123456";
86
- const sanitized = logger.sanitize(text);
87
- expect(sanitized).toBe("Token: gho_***");
88
- });
89
-
90
- test("should sanitize ghu_ tokens (36 chars)", () => {
91
- const text = "Token: ghu_123456789012345678901234567890123456";
92
- const sanitized = logger.sanitize(text);
93
- expect(sanitized).toBe("Token: ghu_***");
94
- });
95
-
96
- test("should sanitize ghs_ tokens (36 chars)", () => {
97
- const text = "Token: ghs_123456789012345678901234567890123456";
98
- const sanitized = logger.sanitize(text);
99
- expect(sanitized).toBe("Token: ghs_***");
100
- });
101
-
102
- test("should sanitize ghr_ tokens (36 chars)", () => {
103
- const text = "Token: ghr_123456789012345678901234567890123456";
104
- const sanitized = logger.sanitize(text);
105
- expect(sanitized).toBe("Token: ghr_***");
106
- });
107
-
108
- test("should sanitize Bearer tokens", () => {
109
- const text = "Authorization: Bearer abc123xyz-token_value";
110
- const sanitized = logger.sanitize(text);
111
- expect(sanitized).toBe("Authorization: Bearer ***");
112
- });
113
-
114
- test("should sanitize query string tokens", () => {
115
- const text = "https://api.example.com?token=secret123";
116
- const sanitized = logger.sanitize(text);
117
- expect(sanitized).toBe("https://api.example.com?token=***");
118
- });
119
-
120
- test("should sanitize multiple tokens", () => {
121
- const ghpToken = "123456789012345678901234567890123456";
122
- const patToken =
123
- "1234567890123456789012345678901234567890123456789012345678901234567890123456789012";
124
- const text = `Tokens: ghp_${ghpToken} and github_pat_${patToken}`;
125
- const sanitized = logger.sanitize(text);
126
- expect(sanitized).toBe("Tokens: ghp_*** and github_pat_***");
127
- });
128
-
129
- test("should not modify text without tokens", () => {
130
- const text = "No tokens here, just regular text";
131
- const sanitized = logger.sanitize(text);
132
- expect(sanitized).toBe(text);
133
- });
134
-
135
- test("should handle empty string", () => {
136
- const sanitized = logger.sanitize("");
137
- expect(sanitized).toBe("");
138
- });
139
- });
140
-
141
- describe("verbose", () => {
142
- beforeEach(() => {
143
- logger.setVerbose(false);
144
- });
145
-
146
- test("should not log when verbose is disabled", () => {
147
- logger.verbose("Test verbose message");
148
- expect(consoleErrorSpy).not.toHaveBeenCalled();
149
- });
150
-
151
- test("should log to stderr when verbose is enabled", () => {
152
- logger.setVerbose(true);
153
- logger.verbose("Test verbose message");
154
- expect(consoleErrorSpy).toHaveBeenCalled();
155
- const call = consoleErrorSpy.mock.calls[1][0];
156
- expect(call).toContain("[VERBOSE]");
157
- expect(call).toContain("Test verbose message");
158
- });
159
-
160
- test("should include timestamp in verbose logs", () => {
161
- logger.setVerbose(true);
162
- logger.verbose("Test message");
163
- const call = consoleErrorSpy.mock.calls[1][0];
164
- expect(call).toMatch(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/);
165
- });
166
-
167
- test("should sanitize sensitive data in verbose logs", () => {
168
- logger.setVerbose(true);
169
- logger.verbose("Token: ghp_123456789012345678901234567890123456");
170
- const call = consoleErrorSpy.mock.calls[1][0];
171
- expect(call).toContain("ghp_***");
172
- expect(call).not.toContain("ghp_123456789012345678901234567890123456");
173
- });
174
-
175
- test("should include context in verbose logs", () => {
176
- logger.setVerbose(true);
177
- logger.verbose("Test message", { key: "value", num: 123 });
178
- const call = consoleErrorSpy.mock.calls[1][0];
179
- expect(call).toContain('"key": "value"');
180
- expect(call).toContain('"num": 123');
181
- });
182
-
183
- test("should sanitize context strings", () => {
184
- logger.setVerbose(true);
185
- logger.verbose("Test message", {
186
- token: "ghp_123456789012345678901234567890123456",
187
- });
188
- const call = consoleErrorSpy.mock.calls[1][0];
189
- expect(call).toContain("ghp_***");
190
- expect(call).not.toContain("ghp_123456789012345678901234567890123456");
191
- });
192
-
193
- test("should handle nested objects in context", () => {
194
- logger.setVerbose(true);
195
- logger.verbose("Test message", {
196
- nested: { key: "value" },
197
- });
198
- const call = consoleErrorSpy.mock.calls[1][0];
199
- expect(call).toContain('"nested"');
200
- });
201
- });
202
-
203
- describe("setVerbose", () => {
204
- test("should enable verbose logging", () => {
205
- logger.setVerbose(true);
206
- expect(logger.isVerbose()).toBe(true);
207
- });
208
-
209
- test("should disable verbose logging", () => {
210
- logger.setVerbose(true);
211
- logger.setVerbose(false);
212
- expect(logger.isVerbose()).toBe(false);
213
- });
214
-
215
- test("should log when enabling verbose", () => {
216
- logger.setVerbose(true);
217
- expect(consoleErrorSpy).toHaveBeenCalled();
218
- const call = consoleErrorSpy.mock.calls[0][0];
219
- expect(call).toContain("Verbose logging enabled");
220
- });
221
- });
222
-
223
- describe("isVerbose", () => {
224
- test("should return false by default", () => {
225
- expect(logger.isVerbose()).toBe(false);
226
- });
227
-
228
- test("should return true when enabled", () => {
229
- logger.setVerbose(true);
230
- expect(logger.isVerbose()).toBe(true);
231
- });
232
-
233
- test("should return false when disabled", () => {
234
- logger.setVerbose(true);
235
- logger.setVerbose(false);
236
- expect(logger.isVerbose()).toBe(false);
237
- });
238
- });
239
- });
package/tsconfig.json DELETED
@@ -1,30 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "lib": ["ES2022"],
6
- "moduleResolution": "bundler",
7
- "types": ["bun-types"],
8
-
9
- "strict": true,
10
- "esModuleInterop": true,
11
- "skipLibCheck": true,
12
- "forceConsistentCasingInFileNames": true,
13
- "resolveJsonModule": true,
14
- "allowSyntheticDefaultImports": true,
15
-
16
- "declaration": true,
17
- "declarationMap": true,
18
- "sourceMap": true,
19
-
20
- "outDir": "./dist",
21
- "rootDir": "./src",
22
-
23
- "noUnusedLocals": true,
24
- "noUnusedParameters": true,
25
- "noImplicitReturns": true,
26
- "noFallthroughCasesInSwitch": true
27
- },
28
- "include": ["src/**/*"],
29
- "exclude": ["node_modules", "dist", "bin"]
30
- }