sumulige-claude 1.5.1 → 1.5.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.
Files changed (219) hide show
  1. package/.claude/hooks/hook-registry.json +0 -15
  2. package/.claude/rules/coding-style.md +18 -7
  3. package/.claude/rules/hooks.md +15 -4
  4. package/.claude/rules/performance.md +15 -5
  5. package/.claude/rules/security.md +140 -4
  6. package/.claude/rules/testing.md +138 -9
  7. package/.claude/rules/web-design-standard.md +16 -5
  8. package/.claude/skills/algorithmic-art/metadata.yaml +28 -0
  9. package/.claude/skills/api-tester/SKILL.md +61 -0
  10. package/.claude/skills/api-tester/examples/basic.md +3 -0
  11. package/.claude/skills/api-tester/metadata.yaml +30 -0
  12. package/.claude/skills/api-tester/templates/default.md +3 -0
  13. package/.claude/skills/brand-guidelines/metadata.yaml +26 -0
  14. package/.claude/skills/canvas-design/metadata.yaml +27 -0
  15. package/.claude/skills/code-reviewer-123/SKILL.md +61 -0
  16. package/.claude/skills/code-reviewer-123/examples/basic.md +3 -0
  17. package/.claude/skills/code-reviewer-123/metadata.yaml +30 -0
  18. package/.claude/skills/code-reviewer-123/templates/default.md +3 -0
  19. package/.claude/skills/doc-coauthoring/metadata.yaml +27 -0
  20. package/.claude/skills/docx/metadata.yaml +30 -0
  21. package/.claude/skills/frontend-design/metadata.yaml +28 -0
  22. package/.claude/skills/internal-comms/metadata.yaml +28 -0
  23. package/.claude/skills/mcp-builder/metadata.yaml +26 -0
  24. package/.claude/skills/my-skill/SKILL.md +61 -0
  25. package/.claude/skills/my-skill/examples/basic.md +3 -0
  26. package/.claude/skills/my-skill/metadata.yaml +30 -0
  27. package/.claude/skills/my-skill/templates/default.md +3 -0
  28. package/.claude/skills/pdf/metadata.yaml +29 -0
  29. package/.claude/skills/pptx/metadata.yaml +29 -0
  30. package/.claude/skills/react-best-practices/metadata.yaml +26 -0
  31. package/.claude/skills/react-node-practices/SKILL.md +409 -0
  32. package/.claude/skills/react-node-practices/metadata.yaml +56 -0
  33. package/.claude/skills/skill-creator/metadata.yaml +25 -0
  34. package/.claude/skills/slack-gif-creator/metadata.yaml +28 -0
  35. package/.claude/skills/test-skill-name/SKILL.md +61 -0
  36. package/.claude/skills/test-skill-name/examples/basic.md +3 -0
  37. package/.claude/skills/test-skill-name/metadata.yaml +30 -0
  38. package/.claude/skills/test-skill-name/templates/default.md +3 -0
  39. package/.claude/skills/test-workflow/metadata.yaml +32 -0
  40. package/.claude/skills/theme-factory/metadata.yaml +26 -0
  41. package/.claude/skills/threejs-fundamentals/metadata.yaml +27 -0
  42. package/.claude/skills/web-artifacts-builder/metadata.yaml +30 -0
  43. package/.claude/skills/web-design-guidelines/metadata.yaml +26 -0
  44. package/.claude/skills/webapp-testing/metadata.yaml +26 -0
  45. package/.claude/skills/xlsx/metadata.yaml +29 -0
  46. package/LICENSE +21 -0
  47. package/cli.js +1 -1
  48. package/package.json +25 -3
  49. package/.claude/.kickoff-hint.txt +0 -52
  50. package/.claude/.sumulige-claude-version +0 -1
  51. package/.claude/.version +0 -1
  52. package/.claude/AGENTS.md +0 -42
  53. package/.claude/ANCHORS.md +0 -40
  54. package/.claude/CLAUDE.md +0 -138
  55. package/.claude/MEMORY.md +0 -69
  56. package/.claude/PROJECT_LOG.md +0 -101
  57. package/.claude/THINKING_CHAIN_GUIDE.md +0 -287
  58. package/.claude/USAGE.md +0 -175
  59. package/.claude/boris-optimizations.md +0 -167
  60. package/.claude/handoffs/INDEX.md +0 -21
  61. package/.claude/handoffs/LATEST.md +0 -76
  62. package/.claude/handoffs/handoff_2026-01-22T13-07-04-757Z.md +0 -76
  63. package/.claude/quality-gate.json +0 -82
  64. package/.claude/rag/skill-index.json +0 -135
  65. package/.claude/settings.json +0 -99
  66. package/.claude/settings.local.json +0 -175
  67. package/.claude/templates/PROJECT_KICKOFF.md +0 -89
  68. package/.claude/templates/PROJECT_PROPOSAL.md +0 -227
  69. package/.claude/templates/TASK_PLAN.md +0 -121
  70. package/.claude/templates/hooks/README.md +0 -302
  71. package/.claude/templates/hooks/hook.sh.template +0 -94
  72. package/.claude/templates/hooks/user-prompt-submit.cjs.template +0 -116
  73. package/.claude/templates/hooks/user-response-submit.cjs.template +0 -94
  74. package/.claude/templates/hooks/validate.js +0 -173
  75. package/.claude/templates/tasks/develop.md +0 -69
  76. package/.claude/templates/tasks/research.md +0 -64
  77. package/.claude/templates/tasks/test.md +0 -96
  78. package/.claude/thinking-routes/.last-sync +0 -1
  79. package/.claude/thinking-routes/QUICKREF.md +0 -98
  80. package/.claude/workflow/document-scanner.js +0 -426
  81. package/.claude/workflow/knowledge-engine.js +0 -941
  82. package/.claude/workflow/notebooklm/browser.js +0 -1028
  83. package/.claude/workflow/phases/phase1-research.js +0 -578
  84. package/.claude/workflow/phases/phase1-research.ts +0 -465
  85. package/.claude/workflow/phases/phase2-approve.js +0 -722
  86. package/.claude/workflow/phases/phase3-plan.js +0 -1200
  87. package/.claude/workflow/phases/phase4-develop.js +0 -894
  88. package/.claude/workflow/search-cache.js +0 -230
  89. package/.claude/workflow/templates/approval.md +0 -315
  90. package/.claude/workflow/templates/development.md +0 -377
  91. package/.claude/workflow/templates/planning.md +0 -328
  92. package/.claude/workflow/templates/research.md +0 -250
  93. package/.claude/workflow/types.js +0 -37
  94. package/.claude/workflow/web-search.js +0 -278
  95. package/.claude-plugin/marketplace.json +0 -71
  96. package/.github/workflows/sync-skills.yml +0 -74
  97. package/.versionrc +0 -25
  98. package/AGENTS.md +0 -580
  99. package/CHANGELOG.md +0 -481
  100. package/CLAUDE-template.md +0 -114
  101. package/DEV_TOOLS_GUIDE.md +0 -190
  102. package/PROJECT_STRUCTURE.md +0 -266
  103. package/Q&A.md +0 -325
  104. package/config/defaults.json +0 -34
  105. package/config/official-skills.json +0 -183
  106. package/config/quality-gate.json +0 -67
  107. package/config/skill-categories.json +0 -40
  108. package/config/version-manifest.json +0 -85
  109. package/demos/power-3d-scatter.html +0 -683
  110. package/development/cache/web-search/search_1193d605f8eb364651fc2f2041b58a31.json +0 -36
  111. package/development/cache/web-search/search_3798bf06960edc125f744a1abb5b72c5.json +0 -36
  112. package/development/cache/web-search/search_37c7d4843a53f0d83f1122a6f908a2a3.json +0 -36
  113. package/development/cache/web-search/search_44166fa0153709ee168485a22aa0ab40.json +0 -36
  114. package/development/cache/web-search/search_4deaebb1f77e86a8ca066dc5a49c59fd.json +0 -36
  115. package/development/cache/web-search/search_94da91789466070a7f545612e73c7372.json +0 -36
  116. package/development/cache/web-search/search_dd5de8491b8b803a3cb01339cd210fb0.json +0 -36
  117. package/development/knowledge-base/.index.clean.json +0 -1
  118. package/development/knowledge-base/.index.json +0 -486
  119. package/development/knowledge-base/test-best-practices.md +0 -29
  120. package/development/projects/proj_mkh1pazz_ixmt1/phase1/feasibility-report.md +0 -160
  121. package/development/projects/proj_mkh4jvnb_z7rwf/phase1/feasibility-report.md +0 -160
  122. package/development/projects/proj_mkh4jxkd_ewz5a/phase1/feasibility-report.md +0 -160
  123. package/development/projects/proj_mkh4k84n_ni73k/phase1/feasibility-report.md +0 -160
  124. package/development/projects/proj_mkh4wfyd_u9w88/phase1/feasibility-report.md +0 -160
  125. package/development/projects/proj_mkh4wsbo_iahvf/development/projects/proj_mkh4xbpg_4na5w/phase1/feasibility-report.md +0 -160
  126. package/development/projects/proj_mkh4wsbo_iahvf/phase1/feasibility-report.md +0 -160
  127. package/development/projects/proj_mkh4xulg_1ka8x/phase1/feasibility-report.md +0 -160
  128. package/development/projects/proj_mkh4xwhj_gch8j/phase1/feasibility-report.md +0 -160
  129. package/development/projects/proj_mkh4y2qk_9lm8z/phase1/feasibility-report.md +0 -160
  130. package/development/projects/proj_mkh4y2qk_9lm8z/phase2/requirements.md +0 -226
  131. package/development/projects/proj_mkh4y2qk_9lm8z/phase3/PRD.md +0 -345
  132. package/development/projects/proj_mkh4y2qk_9lm8z/phase3/TASK_PLAN.md +0 -284
  133. package/development/projects/proj_mkh4y2qk_9lm8z/phase3/prototype/README.md +0 -14
  134. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/DEVELOPMENT_LOG.md +0 -35
  135. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/TASKS.md +0 -34
  136. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/.env.example +0 -5
  137. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/README.md +0 -60
  138. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/package.json +0 -25
  139. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/src/index.js +0 -70
  140. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/src/routes/index.js +0 -48
  141. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/tests/health.test.js +0 -20
  142. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/tests/jest.config.js +0 -21
  143. package/development/projects/proj_mkh7veqg_3lypc/phase1/feasibility-report.md +0 -160
  144. package/development/projects/proj_mkh7veqg_3lypc/phase2/requirements.md +0 -226
  145. package/development/projects/proj_mkh7veqg_3lypc/phase3/PRD.md +0 -345
  146. package/development/projects/proj_mkh7veqg_3lypc/phase3/TASK_PLAN.md +0 -284
  147. package/development/projects/proj_mkh7veqg_3lypc/phase3/prototype/README.md +0 -14
  148. package/development/projects/proj_mkh8k8fo_rmqn5/phase1/feasibility-report.md +0 -160
  149. package/development/projects/proj_mkh8xyhy_1vshq/phase1/feasibility-report.md +0 -178
  150. package/development/projects/proj_mkh8zddd_dhamf/phase1/feasibility-report.md +0 -377
  151. package/development/projects/proj_mkh8zddd_dhamf/phase2/requirements.md +0 -442
  152. package/development/projects/proj_mkh8zddd_dhamf/phase3/api-design.md +0 -800
  153. package/development/projects/proj_mkh8zddd_dhamf/phase3/architecture.md +0 -625
  154. package/development/projects/proj_mkh8zddd_dhamf/phase3/data-model.md +0 -830
  155. package/development/projects/proj_mkh8zddd_dhamf/phase3/risks.md +0 -957
  156. package/development/projects/proj_mkh8zddd_dhamf/phase3/wbs.md +0 -381
  157. package/development/todos/.state.json +0 -19
  158. package/development/todos/INDEX.md +0 -63
  159. package/development/todos/active/_README.md +0 -49
  160. package/development/todos/archived/_README.md +0 -11
  161. package/development/todos/backlog/_README.md +0 -11
  162. package/development/todos/backlog/mcp-integration.md +0 -35
  163. package/development/todos/completed/_README.md +0 -11
  164. package/development/todos/completed/boris-optimizations.md +0 -39
  165. package/development/todos/completed/develop/local-knowledge-index.md +0 -85
  166. package/development/todos/completed/develop/todo-system.md +0 -47
  167. package/development/todos/completed/develop/web-search-integration.md +0 -83
  168. package/development/todos/completed/test/phase1-e2e-test.md +0 -103
  169. package/docs/DEVELOPMENT.md +0 -461
  170. package/docs/MARKETPLACE.md +0 -352
  171. package/docs/RELEASE.md +0 -93
  172. package/jest.config.js +0 -63
  173. package/lib/commands.js +0 -3588
  174. package/lib/config-manager.js +0 -441
  175. package/lib/config-schema.js +0 -408
  176. package/lib/config-validator.js +0 -330
  177. package/lib/config.js +0 -122
  178. package/lib/errors.js +0 -305
  179. package/lib/incremental-sync.js +0 -274
  180. package/lib/marketplace.js +0 -487
  181. package/lib/migrations.js +0 -154
  182. package/lib/permission-audit.js +0 -255
  183. package/lib/quality-gate.js +0 -431
  184. package/lib/quality-rules.js +0 -373
  185. package/lib/utils.js +0 -150
  186. package/lib/version-check.js +0 -169
  187. package/lib/version-manifest.js +0 -171
  188. package/project-paradigm.md +0 -313
  189. package/prompts/how-to-find.md +0 -163
  190. package/prompts/linus-architect.md +0 -71
  191. package/prompts/software-architect.md +0 -173
  192. package/prompts/web-designer.md +0 -249
  193. package/scripts/fix-hooks.mjs +0 -97
  194. package/scripts/sync-external.mjs +0 -298
  195. package/scripts/sync-to-home.sh +0 -108
  196. package/scripts/update-registry.mjs +0 -325
  197. package/sources.yaml +0 -83
  198. package/tests/README.md +0 -263
  199. package/tests/commands.test.js +0 -1086
  200. package/tests/config-manager.test.js +0 -677
  201. package/tests/config-schema.test.js +0 -425
  202. package/tests/config-validator.test.js +0 -436
  203. package/tests/config.test.js +0 -100
  204. package/tests/errors.test.js +0 -477
  205. package/tests/manual/phase1-e2e.sh +0 -389
  206. package/tests/manual/phase2-test-cases.md +0 -311
  207. package/tests/manual/phase3-test-cases.md +0 -309
  208. package/tests/manual/phase4-test-cases.md +0 -414
  209. package/tests/manual/test-cases.md +0 -417
  210. package/tests/marketplace.test.js +0 -420
  211. package/tests/migrations.test.js +0 -187
  212. package/tests/quality-gate.test.js +0 -679
  213. package/tests/quality-rules.test.js +0 -619
  214. package/tests/sync-external.test.js +0 -214
  215. package/tests/update-registry.test.js +0 -251
  216. package/tests/utils.test.js +0 -171
  217. package/tests/version-check.test.js +0 -75
  218. package/tests/web-search.test.js +0 -392
  219. package/thinkinglens-silent.md +0 -138
@@ -1,1086 +0,0 @@
1
- /**
2
- * Commands 模块单元测试 - 扩展版
3
- * 测试核心命令功能和边界情况
4
- */
5
-
6
- const fs = require('fs');
7
- const path = require('path');
8
- const os = require('os');
9
- const commands = require('../lib/commands');
10
- const { CopyMode } = require('../lib/utils');
11
-
12
- // ============================================================================
13
- // Helper Functions Tests
14
- // ============================================================================
15
-
16
- describe('Commands Helper Functions', () => {
17
- describe('countFiles', () => {
18
- const { countFiles } = commands;
19
-
20
- it('should count files in a directory', () => {
21
- // Use node_modules as a test directory (it exists)
22
- const nodeModulesPath = path.join(__dirname, '../node_modules');
23
- if (fs.existsSync(nodeModulesPath)) {
24
- const count = countFiles(nodeModulesPath);
25
- expect(typeof count).toBe('number');
26
- expect(count).toBeGreaterThan(0);
27
- }
28
- });
29
-
30
- it('should skip node_modules directory', () => {
31
- // This test verifies the logic in countFiles
32
- const skipDirs = ['node_modules', '.git', 'sessions'];
33
- expect(skipDirs).toContain('node_modules');
34
- expect(skipDirs).toContain('.git');
35
- expect(skipDirs).toContain('sessions');
36
- });
37
-
38
- it('should return 0 for empty logic check', () => {
39
- // Test the logic structure
40
- let count = 0;
41
- const entries = []; // Empty entries
42
- expect(count).toBe(0);
43
- });
44
- });
45
-
46
- describe('setExecutablePermission', () => {
47
- const { setExecutablePermission } = commands;
48
- const tmpDir = path.join(os.tmpdir(), 'smc-test-' + Date.now());
49
-
50
- beforeEach(() => {
51
- if (!fs.existsSync(tmpDir)) {
52
- fs.mkdirSync(tmpDir, { recursive: true });
53
- }
54
- });
55
-
56
- afterEach(() => {
57
- if (fs.existsSync(tmpDir)) {
58
- fs.rmSync(tmpDir, { recursive: true, force: true });
59
- }
60
- });
61
-
62
- it('should set executable permission for .sh files', () => {
63
- const shFile = path.join(tmpDir, 'test.sh');
64
- fs.writeFileSync(shFile, '#!/bin/bash\necho test');
65
- expect(() => setExecutablePermission(shFile)).not.toThrow();
66
- });
67
-
68
- it('should set executable permission for .cjs files', () => {
69
- const cjsFile = path.join(tmpDir, 'test.cjs');
70
- fs.writeFileSync(cjsFile, 'console.log("test");');
71
- expect(() => setExecutablePermission(cjsFile)).not.toThrow();
72
- });
73
-
74
- it('should not set permission for non-script files', () => {
75
- const txtFile = path.join(tmpDir, 'test.txt');
76
- fs.writeFileSync(txtFile, 'test content');
77
- expect(() => setExecutablePermission(txtFile)).not.toThrow();
78
- });
79
-
80
- it('should handle non-existent files gracefully', () => {
81
- const nonExistent = path.join(tmpDir, 'does-not-exist.sh');
82
- expect(() => setExecutablePermission(nonExistent)).not.toThrow();
83
- });
84
- });
85
-
86
- describe('generateAgentsMd', () => {
87
- const { generateAgentsMd } = commands;
88
-
89
- it('should generate markdown for agents', () => {
90
- const config = {
91
- model: 'claude-opus-4-5',
92
- agents: {
93
- conductor: { model: 'claude-opus-4-5', role: 'Task coordination' },
94
- builder: { model: 'claude-opus-4-5', role: 'Code implementation' }
95
- }
96
- };
97
-
98
- const md = generateAgentsMd(config);
99
- expect(md).toContain('# AGENTS');
100
- expect(md).toContain('conductor');
101
- expect(md).toContain('Task coordination');
102
- expect(md).toContain('builder');
103
- expect(md).toContain('Code implementation');
104
- });
105
-
106
- it('should use default model when agent has no model', () => {
107
- const config = {
108
- model: 'default-model',
109
- agents: {
110
- test: { role: 'Test role' }
111
- }
112
- };
113
-
114
- const md = generateAgentsMd(config);
115
- expect(md).toContain('default-model');
116
- });
117
-
118
- it('should include usage section', () => {
119
- const config = {
120
- model: 'test-model',
121
- agents: {}
122
- };
123
-
124
- const md = generateAgentsMd(config);
125
- expect(md).toContain('## Usage');
126
- });
127
- });
128
-
129
- describe('copySingleFile', () => {
130
- const { copySingleFile } = commands;
131
- const tmpDir = path.join(os.tmpdir(), 'smc-copy-test-' + Date.now());
132
- const srcDir = path.join(tmpDir, 'src');
133
- const destDir = path.join(tmpDir, 'dest');
134
- const backupDir = path.join(tmpDir, 'backup');
135
-
136
- beforeEach(() => {
137
- [srcDir, destDir, backupDir].forEach(d => {
138
- if (!fs.existsSync(d)) {
139
- fs.mkdirSync(d, { recursive: true });
140
- }
141
- });
142
- });
143
-
144
- afterEach(() => {
145
- if (fs.existsSync(tmpDir)) {
146
- fs.rmSync(tmpDir, { recursive: true, force: true });
147
- }
148
- });
149
-
150
- it('should copy file when destination does not exist', () => {
151
- const srcFile = path.join(srcDir, 'test.sh');
152
- const destFile = path.join(destDir, 'test.sh');
153
- fs.writeFileSync(srcFile, '#!/bin/bash\necho test');
154
-
155
- copySingleFile(srcFile, destFile, CopyMode.FORCE, backupDir, 'test.sh');
156
- expect(fs.existsSync(destFile)).toBe(true);
157
- });
158
-
159
- it('should respect CopyMode.SAFE - keep existing', () => {
160
- const srcFile = path.join(srcDir, 'test.txt');
161
- const destFile = path.join(destDir, 'test.txt');
162
- fs.writeFileSync(srcFile, 'new content');
163
- fs.writeFileSync(destFile, 'old content');
164
-
165
- copySingleFile(srcFile, destFile, CopyMode.SAFE, backupDir, 'test.txt');
166
- expect(fs.readFileSync(destFile, 'utf-8')).toBe('old content');
167
- });
168
-
169
- it('should handle non-existent source file gracefully', () => {
170
- const srcFile = path.join(srcDir, 'does-not-exist.sh');
171
- const destFile = path.join(destDir, 'test.sh');
172
- expect(() => copySingleFile(srcFile, destFile, CopyMode.FORCE, backupDir, 'test.sh')).not.toThrow();
173
- });
174
- });
175
- });
176
-
177
- describe('Commands Module - Extended Tests', () => {
178
- describe('exports', () => {
179
- it('should export runCommand function', () => {
180
- expect(typeof commands.runCommand).toBe('function');
181
- });
182
-
183
- it('should export commands object', () => {
184
- expect(typeof commands.commands).toBe('object');
185
- });
186
-
187
- it('should have all core commands', () => {
188
- const cmdList = commands.commands;
189
- // Core commands
190
- expect(cmdList.init).toBeDefined();
191
- expect(cmdList.sync).toBeDefined();
192
- expect(cmdList.migrate).toBeDefined();
193
- expect(cmdList.agent).toBeDefined();
194
- expect(cmdList.status).toBeDefined();
195
- expect(cmdList.version).toBeDefined();
196
- // Skill commands
197
- expect(cmdList['skill:list']).toBeDefined();
198
- expect(cmdList['skill:create']).toBeDefined();
199
- expect(cmdList['skill:check']).toBeDefined();
200
- expect(cmdList['skill:install']).toBeDefined();
201
- // Template commands
202
- expect(cmdList.template).toBeDefined();
203
- expect(cmdList.kickoff).toBeDefined();
204
- expect(cmdList['init:interactive']).toBeDefined();
205
- expect(cmdList.ultrathink).toBeDefined();
206
- });
207
-
208
- it('should have all marketplace commands', () => {
209
- // Marketplace commands are handled in cli.js, not in commands.js
210
- // Verify they exist in the marketplace module instead
211
- const marketplace = require('../lib/marketplace');
212
- const mpCommands = marketplace.marketplaceCommands;
213
- expect(mpCommands['marketplace:list']).toBeDefined();
214
- expect(mpCommands['marketplace:install']).toBeDefined();
215
- expect(mpCommands['marketplace:sync']).toBeDefined();
216
- expect(mpCommands['marketplace:add']).toBeDefined();
217
- expect(mpCommands['marketplace:remove']).toBeDefined();
218
- expect(mpCommands['marketplace:status']).toBeDefined();
219
- });
220
-
221
- it('should have all skills commands', () => {
222
- const cmdList = commands.commands;
223
- expect(cmdList['skills:official']).toBeDefined();
224
- expect(cmdList['skills:install-official']).toBeDefined();
225
- expect(cmdList['skills:install-all']).toBeDefined();
226
- expect(cmdList['skills:search']).toBeDefined();
227
- expect(cmdList['skills:validate']).toBeDefined();
228
- expect(cmdList['skills:update']).toBeDefined();
229
- expect(cmdList['skills:publish']).toBeDefined();
230
- });
231
-
232
- it('should have config commands', () => {
233
- const cmdList = commands.commands;
234
- expect(cmdList.config).toBeDefined();
235
- expect(cmdList['config:validate']).toBeDefined();
236
- expect(cmdList['config:backup']).toBeDefined();
237
- expect(cmdList['config:rollback']).toBeDefined();
238
- expect(cmdList['config:diff']).toBeDefined();
239
- });
240
-
241
- it('should have quality gate commands', () => {
242
- const cmdList = commands.commands;
243
- expect(cmdList['qg:check']).toBeDefined();
244
- expect(cmdList['qg:rules']).toBeDefined();
245
- expect(cmdList['qg:init']).toBeDefined();
246
- });
247
-
248
- it('should have workflow commands', () => {
249
- const cmdList = commands.commands;
250
- expect(cmdList.workflow).toBeDefined();
251
- expect(cmdList.knowledge).toBeDefined();
252
- expect(cmdList.notebooklm).toBeDefined();
253
- });
254
- });
255
-
256
- describe('runCommand', () => {
257
- it('should call the correct command function', async () => {
258
- const initSpy = jest.spyOn(commands.commands, 'init');
259
- await commands.runCommand('init', []);
260
- expect(initSpy).toHaveBeenCalled();
261
- initSpy.mockRestore();
262
- });
263
-
264
- it('should pass arguments to command function', async () => {
265
- const agentSpy = jest.spyOn(commands.commands, 'agent');
266
- await commands.runCommand('agent', ['test task']);
267
- expect(agentSpy).toHaveBeenCalledWith('test task');
268
- agentSpy.mockRestore();
269
- });
270
-
271
- it('should handle unknown commands gracefully', async () => {
272
- await expect(async () => {
273
- await commands.runCommand('unknown-command', []);
274
- }).not.toThrow();
275
- });
276
-
277
- it('should handle commands with multiple arguments', async () => {
278
- const syncSpy = jest.spyOn(commands.commands, 'sync');
279
- await commands.runCommand('sync', ['--check-update']);
280
- expect(syncSpy).toHaveBeenCalledWith('--check-update');
281
- syncSpy.mockRestore();
282
- });
283
- });
284
-
285
- describe('init command', () => {
286
- it('should be a function', () => {
287
- expect(typeof commands.commands.init).toBe('function');
288
- });
289
-
290
- it('should not throw on basic call', () => {
291
- expect(() => commands.commands.init()).not.toThrow();
292
- });
293
-
294
- it('should recognize --interactive flag', () => {
295
- const interactiveSpy = jest.spyOn(commands.commands, 'init:interactive').mockImplementation(() => {});
296
- commands.commands.init('--interactive');
297
- expect(interactiveSpy).toHaveBeenCalled();
298
- interactiveSpy.mockRestore();
299
- });
300
-
301
- it('should recognize -i flag', () => {
302
- const interactiveSpy = jest.spyOn(commands.commands, 'init:interactive').mockImplementation(() => {});
303
- commands.commands.init('-i');
304
- expect(interactiveSpy).toHaveBeenCalled();
305
- interactiveSpy.mockRestore();
306
- });
307
- });
308
-
309
- describe('sync command', () => {
310
- it('should be a function', () => {
311
- expect(typeof commands.commands.sync).toBe('function');
312
- });
313
-
314
- it('should not throw on basic call', async () => {
315
- await expect(async () => {
316
- await commands.commands.sync();
317
- }).not.toThrow();
318
- });
319
-
320
- it('should recognize --check-update flag', async () => {
321
- await expect(async () => {
322
- await commands.commands.sync('--check-update');
323
- }).not.toThrow();
324
- });
325
- });
326
-
327
- describe('migrate command', () => {
328
- it('should be a function', () => {
329
- expect(typeof commands.commands.migrate).toBe('function');
330
- });
331
-
332
- it('should not throw', () => {
333
- expect(() => commands.commands.migrate()).not.toThrow();
334
- });
335
- });
336
-
337
- describe('version command', () => {
338
- it('should be an async function', () => {
339
- expect(typeof commands.commands.version).toBe('function');
340
- });
341
-
342
- it('should not throw', async () => {
343
- await expect(async () => {
344
- await commands.commands.version();
345
- }).not.toThrow();
346
- });
347
- });
348
-
349
- describe('agent command', () => {
350
- it('should show usage when no task provided', () => {
351
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
352
- commands.commands.agent();
353
- expect(consoleSpy).toHaveBeenCalled();
354
- const output = consoleSpy.mock.calls.flat().join(' ');
355
- expect(output).toContain('Usage');
356
- consoleSpy.mockRestore();
357
- });
358
-
359
- it('should display agent information when task provided', () => {
360
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
361
- commands.commands.agent('Build a REST API');
362
- expect(consoleSpy).toHaveBeenCalled();
363
- const output = consoleSpy.mock.calls.flat().join(' ');
364
- expect(output).toContain('Agent Orchestration');
365
- expect(output).toContain('Build a REST API');
366
- consoleSpy.mockRestore();
367
- });
368
-
369
- it('should show available agents', () => {
370
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
371
- commands.commands.agent('test task');
372
- const output = consoleSpy.mock.calls.flat().join(' ');
373
- expect(output).toContain('Available Agents');
374
- consoleSpy.mockRestore();
375
- });
376
- });
377
-
378
- describe('status command', () => {
379
- it('should be a function', () => {
380
- expect(typeof commands.commands.status).toBe('function');
381
- });
382
-
383
- it('should display config info', () => {
384
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
385
- commands.commands.status();
386
- expect(consoleSpy).toHaveBeenCalled();
387
- const output = consoleSpy.mock.calls.flat().join(' ');
388
- expect(output).toContain('Status');
389
- consoleSpy.mockRestore();
390
- });
391
-
392
- it('should display agents list', () => {
393
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
394
- commands.commands.status();
395
- const output = consoleSpy.mock.calls.flat().join(' ');
396
- expect(output).toContain('Agents');
397
- consoleSpy.mockRestore();
398
- });
399
-
400
- it('should display skills', () => {
401
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
402
- commands.commands.status();
403
- const output = consoleSpy.mock.calls.flat().join(' ');
404
- expect(output).toContain('Skills');
405
- consoleSpy.mockRestore();
406
- });
407
-
408
- it('should display ThinkingLens status', () => {
409
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
410
- commands.commands.status();
411
- const output = consoleSpy.mock.calls.flat().join(' ');
412
- expect(output).toContain('ThinkingLens');
413
- consoleSpy.mockRestore();
414
- });
415
- });
416
-
417
- describe('skill:list command', () => {
418
- it('should be a function', () => {
419
- expect(typeof commands.commands['skill:list']).toBe('function');
420
- });
421
-
422
- it('should not throw', () => {
423
- expect(() => commands.commands['skill:list']()).not.toThrow();
424
- });
425
- });
426
-
427
- describe('skill:create command', () => {
428
- it('should show usage when no skill name provided', () => {
429
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
430
- commands.commands['skill:create']();
431
- expect(consoleSpy).toHaveBeenCalled();
432
- const output = consoleSpy.mock.calls.flat().join(' ');
433
- expect(output).toContain('Usage');
434
- consoleSpy.mockRestore();
435
- });
436
-
437
- it('should validate kebab-case format', () => {
438
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
439
-
440
- // Invalid names with underscores
441
- commands.commands['skill:create']('Invalid_Name');
442
- let output = consoleSpy.mock.calls.flat().join(' ');
443
- expect(output).toContain('Invalid skill name');
444
-
445
- // Invalid names with uppercase
446
- consoleSpy.mockClear();
447
- commands.commands['skill:create']('MySkill');
448
- output = consoleSpy.mock.calls.flat().join(' ');
449
- expect(output).toContain('Invalid skill name');
450
-
451
- // Test that valid names don't show invalid name error
452
- // (they may show other errors like "already exists" which is OK)
453
- consoleSpy.mockClear();
454
- commands.commands['skill:create']('test-skill-name');
455
- output = consoleSpy.mock.calls.flat().join(' ');
456
- // Should not contain "Invalid skill name" error
457
- // The regex requires starting with letter, so test a name that clearly violates it
458
- consoleSpy.mockClear();
459
- commands.commands['skill:create']('_invalid-start');
460
- output = consoleSpy.mock.calls.flat().join(' ');
461
- expect(output).toContain('Invalid skill name');
462
-
463
- consoleSpy.mockRestore();
464
- });
465
-
466
- it('should accept valid kebab-case names', () => {
467
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
468
- const consoleErrorSpy = jest.spyOn(console, 'log').mockImplementation();
469
-
470
- // Valid names - should not show "Invalid skill name" error
471
- // Note: These may fail for other reasons (directory exists, etc.)
472
- commands.commands['skill:create']('api-tester');
473
- commands.commands['skill:create']('my-skill');
474
- commands.commands['skill:create']('code-reviewer-123');
475
-
476
- // Should not contain the invalid name error
477
- // (other errors are OK for this test)
478
- const output = consoleSpy.mock.calls.flat().join(' ');
479
- // The fact it doesn't throw and runs is the main check
480
- expect(typeof commands.commands['skill:create']).toBe('function');
481
-
482
- consoleSpy.mockRestore();
483
- });
484
- });
485
-
486
- describe('skill:check command', () => {
487
- it('should be a function', () => {
488
- expect(typeof commands.commands['skill:check']).toBe('function');
489
- });
490
-
491
- it('should not throw when checking without skill name', () => {
492
- expect(() => commands.commands['skill:check']()).not.toThrow();
493
- });
494
-
495
- it('should not throw when checking with skill name', () => {
496
- expect(() => commands.commands['skill:check']('some-skill')).not.toThrow();
497
- });
498
- });
499
-
500
- describe('skill:install command', () => {
501
- it('should show usage when no source provided', () => {
502
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
503
- commands.commands['skill:install']();
504
- expect(consoleSpy).toHaveBeenCalled();
505
- const output = consoleSpy.mock.calls.flat().join(' ');
506
- expect(output).toContain('Usage');
507
- consoleSpy.mockRestore();
508
- });
509
- });
510
-
511
- describe('template command', () => {
512
- it('should be a function', () => {
513
- expect(typeof commands.commands.template).toBe('function');
514
- });
515
-
516
- it('should show help with --help flag', () => {
517
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
518
- commands.commands.template('--help');
519
- const output = consoleSpy.mock.calls.flat().join(' ');
520
- expect(output).toContain('USAGE');
521
- consoleSpy.mockRestore();
522
- });
523
-
524
- it('should show help with -h flag', () => {
525
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
526
- commands.commands.template('-h');
527
- const output = consoleSpy.mock.calls.flat().join(' ');
528
- expect(output).toContain('USAGE');
529
- consoleSpy.mockRestore();
530
- });
531
-
532
- it('should accept --safe flag', () => {
533
- expect(() => commands.commands.template('--safe')).not.toThrow();
534
- });
535
-
536
- it('should accept --force flag', () => {
537
- expect(() => commands.commands.template('--force')).not.toThrow();
538
- });
539
-
540
- it('should accept path argument', () => {
541
- expect(() => commands.commands.template('/tmp/test-project')).not.toThrow();
542
- });
543
-
544
- it('should accept combined flags and path', () => {
545
- expect(() => commands.commands.template('/tmp/test', '--safe')).not.toThrow();
546
- });
547
- });
548
-
549
- describe('kickoff command', () => {
550
- it('should be a function', () => {
551
- expect(typeof commands.commands.kickoff).toBe('function');
552
- });
553
-
554
- it('should not throw', () => {
555
- expect(() => commands.commands.kickoff()).not.toThrow();
556
- });
557
- });
558
-
559
- describe('ultrathink command', () => {
560
- it('should be a function', () => {
561
- expect(typeof commands.commands.ultrathink).toBe('function');
562
- });
563
-
564
- it('should display UltraThink mode info', () => {
565
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
566
- commands.commands.ultrathink();
567
- expect(consoleSpy).toHaveBeenCalled();
568
- const output = consoleSpy.mock.calls.flat().join(' ');
569
- expect(output).toContain('UltraThink');
570
- consoleSpy.mockRestore();
571
- });
572
- });
573
-
574
- describe('marketplace commands', () => {
575
- // Note: Marketplace commands are handled in cli.js directly, not in commands.js
576
- // They're registered in cli.js's COMMANDS object but call marketplaceCommands from lib/marketplace.js
577
- const marketplace = require('../lib/marketplace');
578
-
579
- it('marketplace:list should exist in marketplace module', () => {
580
- expect(marketplace.marketplaceCommands['marketplace:list']).toBeDefined();
581
- });
582
-
583
- it('marketplace:install should exist in marketplace module', () => {
584
- expect(marketplace.marketplaceCommands['marketplace:install']).toBeDefined();
585
- });
586
-
587
- it('marketplace:sync should exist in marketplace module', () => {
588
- expect(marketplace.marketplaceCommands['marketplace:sync']).toBeDefined();
589
- });
590
-
591
- it('marketplace:add should exist in marketplace module', () => {
592
- expect(marketplace.marketplaceCommands['marketplace:add']).toBeDefined();
593
- });
594
-
595
- it('marketplace:remove should exist in marketplace module', () => {
596
- expect(marketplace.marketplaceCommands['marketplace:remove']).toBeDefined();
597
- });
598
-
599
- it('marketplace:status should exist in marketplace module', () => {
600
- expect(marketplace.marketplaceCommands['marketplace:status']).toBeDefined();
601
- });
602
-
603
- it('marketplace:install should show usage without args', () => {
604
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
605
- marketplace.marketplaceCommands['marketplace:install']();
606
- expect(consoleSpy).toHaveBeenCalled();
607
- consoleSpy.mockRestore();
608
- });
609
-
610
- it('marketplace:add should show usage without args', () => {
611
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
612
- marketplace.marketplaceCommands['marketplace:add']();
613
- expect(consoleSpy).toHaveBeenCalled();
614
- consoleSpy.mockRestore();
615
- });
616
-
617
- it('marketplace:remove should show usage without args', () => {
618
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
619
- marketplace.marketplaceCommands['marketplace:remove']();
620
- expect(consoleSpy).toHaveBeenCalled();
621
- consoleSpy.mockRestore();
622
- });
623
- });
624
-
625
- describe('skills commands', () => {
626
- it('skills:official should be a function', () => {
627
- expect(typeof commands.commands['skills:official']).toBe('function');
628
- });
629
-
630
- it('skills:install-official should be a function', () => {
631
- expect(typeof commands.commands['skills:install-official']).toBe('function');
632
- });
633
-
634
- it('skills:install-all should be a function', () => {
635
- expect(typeof commands.commands['skills:install-all']).toBe('function');
636
- });
637
-
638
- it('skills:search should be a function', () => {
639
- expect(typeof commands.commands['skills:search']).toBe('function');
640
- });
641
-
642
- it('skills:validate should be a function', () => {
643
- expect(typeof commands.commands['skills:validate']).toBe('function');
644
- });
645
-
646
- it('skills:update should be a function', () => {
647
- expect(typeof commands.commands['skills:update']).toBe('function');
648
- });
649
-
650
- it('skills:publish should be a function', () => {
651
- expect(typeof commands.commands['skills:publish']).toBe('function');
652
- });
653
-
654
- it('skills:search should show usage without args', () => {
655
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
656
- commands.commands['skills:search']();
657
- const output = consoleSpy.mock.calls.flat().join(' ');
658
- expect(output).toContain('Usage');
659
- consoleSpy.mockRestore();
660
- });
661
-
662
- it('skills:install-official should show usage without args', () => {
663
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
664
- commands.commands['skills:install-official']();
665
- expect(consoleSpy).toHaveBeenCalled();
666
- consoleSpy.mockRestore();
667
- });
668
- });
669
-
670
- describe('config commands', () => {
671
- it('config should be a function', () => {
672
- expect(typeof commands.commands.config).toBe('function');
673
- });
674
-
675
- it('config:validate should be a function', () => {
676
- expect(typeof commands.commands['config:validate']).toBe('function');
677
- });
678
-
679
- it('config:backup should be a function', () => {
680
- expect(typeof commands.commands['config:backup']).toBe('function');
681
- });
682
-
683
- it('config:rollback should be a function', () => {
684
- expect(typeof commands.commands['config:rollback']).toBe('function');
685
- });
686
-
687
- it('config:diff should be a function', () => {
688
- expect(typeof commands.commands['config:diff']).toBe('function');
689
- });
690
-
691
- it('config:validate should not throw', () => {
692
- expect(() => commands.commands['config:validate']()).not.toThrow();
693
- });
694
-
695
- it('config:backup should not throw', () => {
696
- expect(() => commands.commands['config:backup']()).not.toThrow();
697
- });
698
- });
699
-
700
- describe('quality gate commands', () => {
701
- let exitSpy;
702
-
703
- beforeEach(() => {
704
- // Mock process.exit to prevent test suite termination
705
- exitSpy = jest.spyOn(process, 'exit').mockImplementation(() => {});
706
- });
707
-
708
- afterEach(() => {
709
- if (exitSpy) exitSpy.mockRestore();
710
- });
711
-
712
- it('qg:check should be a function', () => {
713
- expect(typeof commands.commands['qg:check']).toBe('function');
714
- });
715
-
716
- it('qg:rules should be a function', () => {
717
- expect(typeof commands.commands['qg:rules']).toBe('function');
718
- });
719
-
720
- it('qg:init should be a function', () => {
721
- expect(typeof commands.commands['qg:init']).toBe('function');
722
- });
723
-
724
- it('qg:check should call process.exit', async () => {
725
- await commands.commands['qg:check']();
726
- expect(exitSpy).toHaveBeenCalled();
727
- });
728
-
729
- it('qg:rules should not throw', () => {
730
- expect(() => commands.commands['qg:rules']()).not.toThrow();
731
- });
732
-
733
- it('qg:init should not throw', () => {
734
- expect(() => commands.commands['qg:init']()).not.toThrow();
735
- });
736
- });
737
-
738
- describe('workflow commands', () => {
739
- it('workflow should be an async function', () => {
740
- expect(typeof commands.commands.workflow).toBe('function');
741
- });
742
-
743
- it('knowledge should be an async function', () => {
744
- expect(typeof commands.commands.knowledge).toBe('function');
745
- });
746
-
747
- it('notebooklm should be an async function', () => {
748
- expect(typeof commands.commands.notebooklm).toBe('function');
749
- });
750
-
751
- it('workflow should not throw', async () => {
752
- await expect(async () => {
753
- await commands.commands.workflow();
754
- }).not.toThrow();
755
- });
756
-
757
- it('workflow should show usage without args', async () => {
758
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
759
- await commands.commands.workflow();
760
- const output = consoleSpy.mock.calls.flat().join(' ');
761
- expect(output).toContain('Usage');
762
- consoleSpy.mockRestore();
763
- });
764
- });
765
-
766
- describe('changelog command', () => {
767
- it('should be a function', () => {
768
- expect(typeof commands.commands.changelog).toBe('function');
769
- });
770
-
771
- it('should not throw', () => {
772
- expect(() => commands.commands.changelog()).not.toThrow();
773
- });
774
-
775
- it('should show usage without proper git context', () => {
776
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
777
- commands.commands.changelog();
778
- expect(consoleSpy).toHaveBeenCalled();
779
- consoleSpy.mockRestore();
780
- });
781
- });
782
-
783
- describe('doctor command', () => {
784
- it('should be a function', () => {
785
- expect(typeof commands.commands.doctor).toBe('function');
786
- });
787
-
788
- it('should not throw', () => {
789
- expect(() => commands.commands.doctor()).not.toThrow();
790
- });
791
-
792
- it('should display health info', () => {
793
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
794
- commands.commands.doctor();
795
- expect(consoleSpy).toHaveBeenCalled();
796
- const output = consoleSpy.mock.calls.flat().join(' ');
797
- expect(output).toContain('SMC') || expect(output).toContain('Health');
798
- consoleSpy.mockRestore();
799
- });
800
- });
801
-
802
- // ============================================================================
803
- // Additional Command Coverage Tests
804
- // ============================================================================
805
-
806
- describe('init:interactive command', () => {
807
- it('should be a function', () => {
808
- expect(typeof commands.commands['init:interactive']).toBe('function');
809
- });
810
- });
811
-
812
- describe('CopyMode enum', () => {
813
- it('should have BACKUP constant', () => {
814
- expect(CopyMode.BACKUP).toBeDefined();
815
- });
816
-
817
- it('should have SAFE constant', () => {
818
- expect(CopyMode.SAFE).toBeDefined();
819
- });
820
-
821
- it('should have FORCE constant', () => {
822
- expect(CopyMode.FORCE).toBeDefined();
823
- });
824
-
825
- it('should have different values for each mode', () => {
826
- expect(CopyMode.BACKUP).not.toBe(CopyMode.SAFE);
827
- expect(CopyMode.SAFE).not.toBe(CopyMode.FORCE);
828
- expect(CopyMode.BACKUP).not.toBe(CopyMode.FORCE);
829
- });
830
- });
831
-
832
- describe('runCommand edge cases', () => {
833
- it('should handle command with undefined args', async () => {
834
- await expect(async () => {
835
- await commands.runCommand('version', undefined);
836
- }).not.toThrow();
837
- });
838
-
839
- it('should handle command with empty args array', async () => {
840
- await expect(async () => {
841
- await commands.runCommand('version', []);
842
- }).not.toThrow();
843
- });
844
-
845
- it('should handle command with single string arg', async () => {
846
- await expect(async () => {
847
- await commands.runCommand('status', []);
848
- }).not.toThrow();
849
- });
850
- });
851
-
852
- describe('version command details', () => {
853
- it('should output version with v prefix', async () => {
854
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
855
- await commands.commands.version();
856
- expect(consoleSpy).toHaveBeenCalled();
857
- const output = consoleSpy.mock.calls[0][0];
858
- expect(output).toMatch(/^v\d+\.\d+\.\d+/);
859
- consoleSpy.mockRestore();
860
- });
861
- });
862
-
863
- describe('sync command variations', () => {
864
- it('should handle empty args', async () => {
865
- await expect(async () => {
866
- await commands.commands.sync();
867
- }).not.toThrow();
868
- });
869
-
870
- it('should handle force flag', async () => {
871
- await expect(async () => {
872
- await commands.commands.sync('--force');
873
- }).not.toThrow();
874
- });
875
- });
876
-
877
- describe('migrate command details', () => {
878
- it('should handle with --dry-run flag', () => {
879
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
880
- commands.commands.migrate('--dry-run');
881
- expect(consoleSpy).toHaveBeenCalled();
882
- consoleSpy.mockRestore();
883
- });
884
- });
885
-
886
- describe('skill:list details', () => {
887
- it('should output skills information', () => {
888
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
889
- commands.commands['skill:list']();
890
- expect(consoleSpy).toHaveBeenCalled();
891
- consoleSpy.mockRestore();
892
- });
893
- });
894
-
895
- describe('agent command details', () => {
896
- it('should handle empty task gracefully', () => {
897
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
898
- commands.commands.agent('');
899
- expect(consoleSpy).toHaveBeenCalled();
900
- consoleSpy.mockRestore();
901
- });
902
-
903
- it('should handle multi-word task', () => {
904
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
905
- commands.commands.agent('build a rest api with authentication');
906
- expect(consoleSpy).toHaveBeenCalled();
907
- consoleSpy.mockRestore();
908
- });
909
- });
910
-
911
- describe('template command edge cases', () => {
912
- it('should handle path with spaces', () => {
913
- expect(() => commands.commands.template('/tmp/test project')).not.toThrow();
914
- });
915
-
916
- it('should handle multiple flags', () => {
917
- expect(() => commands.commands.template('--safe', '--force')).not.toThrow();
918
- });
919
-
920
- it('should handle path before flags', () => {
921
- expect(() => commands.commands.template('/tmp/test', '--safe')).not.toThrow();
922
- });
923
- });
924
-
925
- describe('changelog command variations', () => {
926
- it('should handle --help flag', () => {
927
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
928
- commands.commands.changelog('--help');
929
- expect(consoleSpy).toHaveBeenCalled();
930
- consoleSpy.mockRestore();
931
- });
932
- });
933
-
934
- describe('knowledge command', () => {
935
- it('should be async function', () => {
936
- expect(typeof commands.commands.knowledge).toBe('function');
937
- });
938
-
939
- it('should handle no args', async () => {
940
- await expect(async () => {
941
- await commands.commands.knowledge();
942
- }).not.toThrow();
943
- });
944
- });
945
-
946
- describe('notebooklm command', () => {
947
- it('should be async function', () => {
948
- expect(typeof commands.commands.notebooklm).toBe('function');
949
- });
950
-
951
- it('should handle no args', async () => {
952
- await expect(async () => {
953
- await commands.commands.notebooklm();
954
- }).not.toThrow();
955
- });
956
- });
957
-
958
- // ============================================================================
959
- // Skills Commands Detailed Tests
960
- // ============================================================================
961
-
962
- describe('skills:official command', () => {
963
- it('should not throw', () => {
964
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
965
- expect(() => commands.commands['skills:official']()).not.toThrow();
966
- consoleSpy.mockRestore();
967
- });
968
- });
969
-
970
- describe('skills:validate command', () => {
971
- it('should not throw', () => {
972
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
973
- expect(() => commands.commands['skills:validate']()).not.toThrow();
974
- consoleSpy.mockRestore();
975
- });
976
- });
977
-
978
- describe('skills:update command', () => {
979
- it('should not throw', () => {
980
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
981
- expect(() => commands.commands['skills:update']()).not.toThrow();
982
- consoleSpy.mockRestore();
983
- });
984
- });
985
-
986
- describe('skills:publish command', () => {
987
- it('should not throw', () => {
988
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
989
- expect(() => commands.commands['skills:publish']()).not.toThrow();
990
- consoleSpy.mockRestore();
991
- });
992
- });
993
-
994
- describe('skills:install-all command', () => {
995
- it('should not throw', () => {
996
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
997
- expect(() => commands.commands['skills:install-all']()).not.toThrow();
998
- consoleSpy.mockRestore();
999
- });
1000
- });
1001
-
1002
- // ============================================================================
1003
- // Config Commands Detailed Tests
1004
- // ============================================================================
1005
-
1006
- describe('config:rollback command', () => {
1007
- it('should not throw', () => {
1008
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
1009
- expect(() => commands.commands['config:rollback']()).not.toThrow();
1010
- consoleSpy.mockRestore();
1011
- });
1012
- });
1013
-
1014
- describe('config:diff command', () => {
1015
- it('should not throw', () => {
1016
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
1017
- expect(() => commands.commands['config:diff']()).not.toThrow();
1018
- consoleSpy.mockRestore();
1019
- });
1020
- });
1021
-
1022
- describe('config command (main)', () => {
1023
- it('should not throw', () => {
1024
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
1025
- expect(() => commands.commands.config()).not.toThrow();
1026
- consoleSpy.mockRestore();
1027
- });
1028
- });
1029
-
1030
- // ============================================================================
1031
- // Skill Command Edge Cases
1032
- // ============================================================================
1033
-
1034
- describe('skill:install with source', () => {
1035
- it('should handle source argument', () => {
1036
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
1037
- commands.commands['skill:install']('https://github.com/owner/repo');
1038
- expect(consoleSpy).toHaveBeenCalled();
1039
- consoleSpy.mockRestore();
1040
- });
1041
-
1042
- it('should handle file:// source', () => {
1043
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
1044
- commands.commands['skill:install']('file:///path/to/skill');
1045
- expect(consoleSpy).toHaveBeenCalled();
1046
- consoleSpy.mockRestore();
1047
- });
1048
- });
1049
-
1050
- describe('skill:check with skill name', () => {
1051
- it('should handle skill name argument', () => {
1052
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
1053
- commands.commands['skill:check']('test-skill');
1054
- expect(consoleSpy).toHaveBeenCalled();
1055
- consoleSpy.mockRestore();
1056
- });
1057
-
1058
- it('should handle skill with kebab-case name', () => {
1059
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
1060
- commands.commands['skill:check']('my-test-skill-123');
1061
- expect(consoleSpy).toHaveBeenCalled();
1062
- consoleSpy.mockRestore();
1063
- });
1064
- });
1065
-
1066
- // ============================================================================
1067
- // Additional Edge Cases
1068
- // ============================================================================
1069
-
1070
- describe('kickoff with arguments', () => {
1071
- it('should handle project name argument', () => {
1072
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
1073
- expect(() => commands.commands.kickoff('my-project')).not.toThrow();
1074
- consoleSpy.mockRestore();
1075
- });
1076
- });
1077
-
1078
- describe('status with flags', () => {
1079
- it('should handle --verbose flag', () => {
1080
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
1081
- commands.commands.status('--verbose');
1082
- expect(consoleSpy).toHaveBeenCalled();
1083
- consoleSpy.mockRestore();
1084
- });
1085
- });
1086
- });