@cloudstreamsoftware/claude-tools 1.0.0 → 1.2.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 (190) hide show
  1. package/README.md +152 -37
  2. package/agents/INDEX.md +183 -0
  3. package/agents/architect.md +247 -0
  4. package/agents/build-error-resolver.md +555 -0
  5. package/agents/catalyst-deployer.md +132 -0
  6. package/agents/code-reviewer.md +121 -0
  7. package/agents/compliance-auditor.md +148 -0
  8. package/agents/creator-architect.md +395 -0
  9. package/agents/deluge-reviewer.md +98 -0
  10. package/agents/doc-updater.md +471 -0
  11. package/agents/e2e-runner.md +711 -0
  12. package/agents/planner.md +122 -0
  13. package/agents/refactor-cleaner.md +309 -0
  14. package/agents/security-reviewer.md +582 -0
  15. package/agents/tdd-guide.md +302 -0
  16. package/bin/cloudstream-setup.js +16 -6
  17. package/config/versions.json +63 -0
  18. package/dist/hooks/hooks.json +209 -0
  19. package/dist/index.js +47 -0
  20. package/dist/lib/asset-value.js +609 -0
  21. package/dist/lib/client-manager.js +300 -0
  22. package/dist/lib/command-matcher.js +242 -0
  23. package/dist/lib/cross-session-patterns.js +754 -0
  24. package/dist/lib/intent-classifier.js +1075 -0
  25. package/dist/lib/package-manager.js +374 -0
  26. package/dist/lib/recommendation-engine.js +597 -0
  27. package/dist/lib/session-memory.js +489 -0
  28. package/dist/lib/skill-effectiveness.js +486 -0
  29. package/dist/lib/skill-matcher.js +595 -0
  30. package/dist/lib/tutorial-metrics.js +242 -0
  31. package/dist/lib/tutorial-progress.js +209 -0
  32. package/dist/lib/tutorial-renderer.js +431 -0
  33. package/dist/lib/utils.js +380 -0
  34. package/dist/lib/verify-formatter.js +143 -0
  35. package/dist/lib/workflow-state.js +249 -0
  36. package/hooks/hooks.json +209 -0
  37. package/package.json +5 -1
  38. package/scripts/aggregate-sessions.js +290 -0
  39. package/scripts/branch-name-validator.js +291 -0
  40. package/scripts/build.js +101 -0
  41. package/scripts/commands/client-switch.js +231 -0
  42. package/scripts/deprecate-skill.js +610 -0
  43. package/scripts/diagnose.js +324 -0
  44. package/scripts/doc-freshness.js +168 -0
  45. package/scripts/generate-weekly-digest.js +393 -0
  46. package/scripts/health-check.js +270 -0
  47. package/scripts/hooks/credential-check.js +101 -0
  48. package/scripts/hooks/evaluate-session.js +81 -0
  49. package/scripts/hooks/pre-compact.js +66 -0
  50. package/scripts/hooks/prompt-analyzer.js +276 -0
  51. package/scripts/hooks/prompt-router.js +422 -0
  52. package/scripts/hooks/quality-gate-enforcer.js +371 -0
  53. package/scripts/hooks/session-end.js +156 -0
  54. package/scripts/hooks/session-start.js +195 -0
  55. package/scripts/hooks/skill-injector.js +333 -0
  56. package/scripts/hooks/suggest-compact.js +58 -0
  57. package/scripts/lib/asset-value.js +609 -0
  58. package/scripts/lib/client-manager.js +300 -0
  59. package/scripts/lib/command-matcher.js +242 -0
  60. package/scripts/lib/cross-session-patterns.js +754 -0
  61. package/scripts/lib/intent-classifier.js +1075 -0
  62. package/scripts/lib/package-manager.js +374 -0
  63. package/scripts/lib/recommendation-engine.js +597 -0
  64. package/scripts/lib/session-memory.js +489 -0
  65. package/scripts/lib/skill-effectiveness.js +486 -0
  66. package/scripts/lib/skill-matcher.js +595 -0
  67. package/scripts/lib/tutorial-metrics.js +242 -0
  68. package/scripts/lib/tutorial-progress.js +209 -0
  69. package/scripts/lib/tutorial-renderer.js +431 -0
  70. package/scripts/lib/utils.js +380 -0
  71. package/scripts/lib/verify-formatter.js +143 -0
  72. package/scripts/lib/workflow-state.js +249 -0
  73. package/scripts/onboard.js +363 -0
  74. package/scripts/quarterly-report.js +692 -0
  75. package/scripts/setup-package-manager.js +204 -0
  76. package/scripts/sync-upstream.js +391 -0
  77. package/scripts/test.js +108 -0
  78. package/scripts/tutorial-runner.js +351 -0
  79. package/scripts/validate-all.js +201 -0
  80. package/scripts/verifiers/agents.js +245 -0
  81. package/scripts/verifiers/config.js +186 -0
  82. package/scripts/verifiers/environment.js +123 -0
  83. package/scripts/verifiers/hooks.js +188 -0
  84. package/scripts/verifiers/index.js +38 -0
  85. package/scripts/verifiers/persistence.js +140 -0
  86. package/scripts/verifiers/plugin.js +215 -0
  87. package/scripts/verifiers/skills.js +209 -0
  88. package/scripts/verify-setup.js +164 -0
  89. package/skills/INDEX.md +157 -0
  90. package/skills/backend-patterns/SKILL.md +586 -0
  91. package/skills/backend-patterns/catalyst-patterns.md +128 -0
  92. package/skills/bigquery-patterns/SKILL.md +27 -0
  93. package/skills/bigquery-patterns/performance-optimization.md +518 -0
  94. package/skills/bigquery-patterns/query-patterns.md +372 -0
  95. package/skills/bigquery-patterns/schema-design.md +78 -0
  96. package/skills/cloudstream-project-template/SKILL.md +20 -0
  97. package/skills/cloudstream-project-template/structure.md +65 -0
  98. package/skills/coding-standards/SKILL.md +524 -0
  99. package/skills/coding-standards/deluge-standards.md +83 -0
  100. package/skills/compliance-patterns/SKILL.md +28 -0
  101. package/skills/compliance-patterns/hipaa/audit-requirements.md +251 -0
  102. package/skills/compliance-patterns/hipaa/baa-process.md +298 -0
  103. package/skills/compliance-patterns/hipaa/data-archival-strategy.md +387 -0
  104. package/skills/compliance-patterns/hipaa/phi-handling.md +52 -0
  105. package/skills/compliance-patterns/pci-dss/saq-a-requirements.md +307 -0
  106. package/skills/compliance-patterns/pci-dss/tokenization-patterns.md +382 -0
  107. package/skills/compliance-patterns/pci-dss/zoho-checkout-patterns.md +56 -0
  108. package/skills/compliance-patterns/soc2/access-controls.md +344 -0
  109. package/skills/compliance-patterns/soc2/audit-logging.md +458 -0
  110. package/skills/compliance-patterns/soc2/change-management.md +403 -0
  111. package/skills/compliance-patterns/soc2/deluge-execution-logging.md +407 -0
  112. package/skills/consultancy-workflows/SKILL.md +19 -0
  113. package/skills/consultancy-workflows/client-isolation.md +21 -0
  114. package/skills/consultancy-workflows/documentation-automation.md +454 -0
  115. package/skills/consultancy-workflows/handoff-procedures.md +257 -0
  116. package/skills/consultancy-workflows/knowledge-capture.md +513 -0
  117. package/skills/consultancy-workflows/time-tracking.md +26 -0
  118. package/skills/continuous-learning/SKILL.md +84 -0
  119. package/skills/continuous-learning/config.json +18 -0
  120. package/skills/continuous-learning/evaluate-session.sh +60 -0
  121. package/skills/continuous-learning-v2/SKILL.md +126 -0
  122. package/skills/continuous-learning-v2/config.json +61 -0
  123. package/skills/frontend-patterns/SKILL.md +635 -0
  124. package/skills/frontend-patterns/zoho-widget-patterns.md +103 -0
  125. package/skills/gcp-data-engineering/SKILL.md +36 -0
  126. package/skills/gcp-data-engineering/bigquery/performance-optimization.md +337 -0
  127. package/skills/gcp-data-engineering/dataflow/error-handling.md +496 -0
  128. package/skills/gcp-data-engineering/dataflow/pipeline-patterns.md +444 -0
  129. package/skills/gcp-data-engineering/dbt/model-organization.md +63 -0
  130. package/skills/gcp-data-engineering/dbt/testing-patterns.md +503 -0
  131. package/skills/gcp-data-engineering/medallion-architecture/bronze-layer.md +60 -0
  132. package/skills/gcp-data-engineering/medallion-architecture/gold-layer.md +311 -0
  133. package/skills/gcp-data-engineering/medallion-architecture/layer-transitions.md +517 -0
  134. package/skills/gcp-data-engineering/medallion-architecture/silver-layer.md +305 -0
  135. package/skills/gcp-data-engineering/zoho-to-gcp/data-extraction.md +543 -0
  136. package/skills/gcp-data-engineering/zoho-to-gcp/real-time-vs-batch.md +337 -0
  137. package/skills/security-review/SKILL.md +498 -0
  138. package/skills/security-review/compliance-checklist.md +53 -0
  139. package/skills/strategic-compact/SKILL.md +67 -0
  140. package/skills/tdd-workflow/SKILL.md +413 -0
  141. package/skills/tdd-workflow/zoho-testing.md +124 -0
  142. package/skills/tutorial/SKILL.md +249 -0
  143. package/skills/tutorial/docs/ACCESSIBILITY.md +169 -0
  144. package/skills/tutorial/lessons/00-philosophy-and-workflow.md +198 -0
  145. package/skills/tutorial/lessons/01-basics.md +81 -0
  146. package/skills/tutorial/lessons/02-training.md +86 -0
  147. package/skills/tutorial/lessons/03-commands.md +109 -0
  148. package/skills/tutorial/lessons/04-workflows.md +115 -0
  149. package/skills/tutorial/lessons/05-compliance.md +116 -0
  150. package/skills/tutorial/lessons/06-zoho.md +121 -0
  151. package/skills/tutorial/lessons/07-hooks-system.md +277 -0
  152. package/skills/tutorial/lessons/08-mcp-servers.md +316 -0
  153. package/skills/tutorial/lessons/09-client-management.md +215 -0
  154. package/skills/tutorial/lessons/10-testing-e2e.md +260 -0
  155. package/skills/tutorial/lessons/11-skills-deep-dive.md +272 -0
  156. package/skills/tutorial/lessons/12-rules-system.md +326 -0
  157. package/skills/tutorial/lessons/13-golden-standard-graduation.md +213 -0
  158. package/skills/tutorial/lessons/14-fork-setup-and-sync.md +312 -0
  159. package/skills/tutorial/lessons/15-living-examples-system.md +221 -0
  160. package/skills/tutorial/tracks/accelerated/README.md +134 -0
  161. package/skills/tutorial/tracks/accelerated/assessment/checkpoint-1.md +161 -0
  162. package/skills/tutorial/tracks/accelerated/assessment/checkpoint-2.md +175 -0
  163. package/skills/tutorial/tracks/accelerated/day-1-core-concepts.md +234 -0
  164. package/skills/tutorial/tracks/accelerated/day-2-essential-commands.md +270 -0
  165. package/skills/tutorial/tracks/accelerated/day-3-workflow-mastery.md +305 -0
  166. package/skills/tutorial/tracks/accelerated/day-4-compliance-zoho.md +304 -0
  167. package/skills/tutorial/tracks/accelerated/day-5-hooks-skills.md +344 -0
  168. package/skills/tutorial/tracks/accelerated/day-6-client-testing.md +386 -0
  169. package/skills/tutorial/tracks/accelerated/day-7-graduation.md +369 -0
  170. package/skills/zoho-patterns/CHANGELOG.md +108 -0
  171. package/skills/zoho-patterns/SKILL.md +446 -0
  172. package/skills/zoho-patterns/analytics/dashboard-patterns.md +352 -0
  173. package/skills/zoho-patterns/analytics/zoho-to-bigquery-pipeline.md +427 -0
  174. package/skills/zoho-patterns/catalyst/appsail-deployment.md +349 -0
  175. package/skills/zoho-patterns/catalyst/context-close-patterns.md +354 -0
  176. package/skills/zoho-patterns/catalyst/cron-batch-processing.md +374 -0
  177. package/skills/zoho-patterns/catalyst/function-patterns.md +439 -0
  178. package/skills/zoho-patterns/creator/form-design.md +304 -0
  179. package/skills/zoho-patterns/creator/publish-api-patterns.md +313 -0
  180. package/skills/zoho-patterns/creator/widget-integration.md +306 -0
  181. package/skills/zoho-patterns/creator/workflow-automation.md +253 -0
  182. package/skills/zoho-patterns/deluge/api-patterns.md +468 -0
  183. package/skills/zoho-patterns/deluge/batch-processing.md +403 -0
  184. package/skills/zoho-patterns/deluge/cross-app-integration.md +356 -0
  185. package/skills/zoho-patterns/deluge/error-handling.md +423 -0
  186. package/skills/zoho-patterns/deluge/syntax-reference.md +65 -0
  187. package/skills/zoho-patterns/integration/cors-proxy-architecture.md +426 -0
  188. package/skills/zoho-patterns/integration/crm-books-native-sync.md +277 -0
  189. package/skills/zoho-patterns/integration/oauth-token-management.md +461 -0
  190. package/skills/zoho-patterns/integration/zoho-flow-patterns.md +334 -0
@@ -0,0 +1,610 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Skill Deprecation Script
4
+ *
5
+ * Safely deprecates skills with full lifecycle management.
6
+ * Updates versions.json, creates migration guide template, and updates CHANGELOG.
7
+ *
8
+ * Usage:
9
+ * npm run skill:deprecate <skill-name>
10
+ * npm run skill:deprecate <skill-name> --superseded-by <replacement>
11
+ * npm run skill:deprecate <skill-name> --removal-target 2.0.0 --reason "Low effectiveness"
12
+ * npm run skill:deprecate <skill-name> --dry-run
13
+ *
14
+ * Options:
15
+ * --superseded-by Replacement skill name
16
+ * --removal-target Version when skill will be removed (required)
17
+ * --reason Reason for deprecation
18
+ * --dry-run Show what would be done without making changes
19
+ * --force Skip confirmation prompts
20
+ */
21
+
22
+ const fs = require('fs');
23
+ const path = require('path');
24
+ const readline = require('readline');
25
+
26
+ // Paths
27
+ const PLUGIN_ROOT = process.env.CLAUDE_PLUGIN_ROOT || path.join(__dirname, '..');
28
+ const VERSIONS_FILE = path.join(PLUGIN_ROOT, 'config', 'versions.json');
29
+ const CHANGELOG_FILE = path.join(PLUGIN_ROOT, 'CHANGELOG.md');
30
+ const SKILLS_DIR = path.join(PLUGIN_ROOT, 'skills');
31
+
32
+ /**
33
+ * Parse command line arguments.
34
+ */
35
+ function parseArgs() {
36
+ const args = process.argv.slice(2);
37
+ const options = {
38
+ skillName: null,
39
+ supersededBy: null,
40
+ removalTarget: null,
41
+ reason: null,
42
+ dryRun: false,
43
+ force: false,
44
+ help: false,
45
+ };
46
+
47
+ for (let i = 0; i < args.length; i++) {
48
+ const arg = args[i];
49
+
50
+ if (arg === '--help' || arg === '-h') {
51
+ options.help = true;
52
+ } else if (arg === '--dry-run') {
53
+ options.dryRun = true;
54
+ } else if (arg === '--force') {
55
+ options.force = true;
56
+ } else if (arg === '--superseded-by' && args[i + 1]) {
57
+ options.supersededBy = args[++i];
58
+ } else if (arg.startsWith('--superseded-by=')) {
59
+ options.supersededBy = arg.split('=')[1];
60
+ } else if (arg === '--removal-target' && args[i + 1]) {
61
+ options.removalTarget = args[++i];
62
+ } else if (arg.startsWith('--removal-target=')) {
63
+ options.removalTarget = arg.split('=')[1];
64
+ } else if (arg === '--reason' && args[i + 1]) {
65
+ options.reason = args[++i];
66
+ } else if (arg.startsWith('--reason=')) {
67
+ options.reason = arg.split('=')[1];
68
+ } else if (!arg.startsWith('-') && !options.skillName) {
69
+ options.skillName = arg;
70
+ }
71
+ }
72
+
73
+ return options;
74
+ }
75
+
76
+ /**
77
+ * Show help message.
78
+ */
79
+ function showHelp() {
80
+ console.log(`
81
+ Skill Deprecation Tool
82
+
83
+ Usage:
84
+ npm run skill:deprecate <skill-name> [options]
85
+
86
+ Options:
87
+ --superseded-by <skill> Replacement skill name
88
+ --removal-target <ver> Version when skill will be removed (e.g., 2.0.0)
89
+ --reason <text> Reason for deprecation
90
+ --dry-run Show what would be done without making changes
91
+ --force Skip confirmation prompts
92
+
93
+ Examples:
94
+ npm run skill:deprecate old-patterns
95
+ npm run skill:deprecate old-patterns --superseded-by new-patterns
96
+ npm run skill:deprecate old-patterns --removal-target 2.0.0 --reason "Low effectiveness"
97
+ npm run skill:deprecate old-patterns --dry-run
98
+ `);
99
+ }
100
+
101
+ /**
102
+ * Load version registry.
103
+ */
104
+ function loadVersionRegistry() {
105
+ try {
106
+ if (fs.existsSync(VERSIONS_FILE)) {
107
+ return JSON.parse(fs.readFileSync(VERSIONS_FILE, 'utf8'));
108
+ }
109
+ } catch (err) {
110
+ console.error(`[Deprecate] Error loading versions.json: ${err.message}`);
111
+ }
112
+ return null;
113
+ }
114
+
115
+ /**
116
+ * Save version registry.
117
+ */
118
+ function saveVersionRegistry(registry) {
119
+ fs.writeFileSync(VERSIONS_FILE, JSON.stringify(registry, null, 2) + '\n');
120
+ }
121
+
122
+ /**
123
+ * Validate skill exists.
124
+ */
125
+ function validateSkill(skillName, registry) {
126
+ const errors = [];
127
+
128
+ // Check if skill exists in registry
129
+ if (!registry.skills[skillName]) {
130
+ errors.push(`Skill "${skillName}" not found in versions.json`);
131
+ return { valid: false, errors };
132
+ }
133
+
134
+ const skillInfo = registry.skills[skillName];
135
+
136
+ // Check if already deprecated
137
+ if (skillInfo.status === 'deprecated') {
138
+ errors.push(`Skill "${skillName}" is already deprecated`);
139
+ return { valid: false, errors };
140
+ }
141
+
142
+ // Check if archived
143
+ if (skillInfo.status === 'archived') {
144
+ errors.push(`Skill "${skillName}" is already archived`);
145
+ return { valid: false, errors };
146
+ }
147
+
148
+ return { valid: true, errors: [], skillInfo };
149
+ }
150
+
151
+ /**
152
+ * Validate replacement skill exists.
153
+ */
154
+ function validateReplacement(replacementName, registry) {
155
+ if (!replacementName) return { valid: true };
156
+
157
+ if (!registry.skills[replacementName]) {
158
+ return { valid: false, error: `Replacement skill "${replacementName}" not found` };
159
+ }
160
+
161
+ const replacement = registry.skills[replacementName];
162
+ if (replacement.status === 'deprecated' || replacement.status === 'archived') {
163
+ return {
164
+ valid: false,
165
+ error: `Replacement skill "${replacementName}" is ${replacement.status}`,
166
+ };
167
+ }
168
+
169
+ return { valid: true };
170
+ }
171
+
172
+ /**
173
+ * Validate semver version.
174
+ */
175
+ function validateVersion(version, currentVersion) {
176
+ if (!version) return { valid: false, error: 'Removal target version is required' };
177
+
178
+ const semverPattern = /^\d+\.\d+\.\d+$/;
179
+ if (!semverPattern.test(version)) {
180
+ return {
181
+ valid: false,
182
+ error: `Invalid version format: "${version}". Use semver (e.g., 2.0.0)`,
183
+ };
184
+ }
185
+
186
+ // Compare versions (simple comparison)
187
+ const current = currentVersion.split('.').map(Number);
188
+ const target = version.split('.').map(Number);
189
+
190
+ for (let i = 0; i < 3; i++) {
191
+ if (target[i] > current[i]) return { valid: true };
192
+ if (target[i] < current[i]) {
193
+ return {
194
+ valid: false,
195
+ error: `Removal target ${version} must be greater than current version ${currentVersion}`,
196
+ };
197
+ }
198
+ }
199
+
200
+ return {
201
+ valid: false,
202
+ error: `Removal target ${version} must be greater than current version ${currentVersion}`,
203
+ };
204
+ }
205
+
206
+ /**
207
+ * Check for dependencies on this skill.
208
+ */
209
+ function checkDependencies(skillName, registry) {
210
+ const dependents = [];
211
+
212
+ // Check if any other skills reference this skill
213
+ // This is a simple check - in production you might parse skill files
214
+ for (const [name, info] of Object.entries(registry.skills)) {
215
+ if (name === skillName) continue;
216
+ if (info.status === 'deprecated' || info.status === 'archived') continue;
217
+
218
+ // Check if skill file references the deprecated skill
219
+ const skillDir = path.join(SKILLS_DIR, name);
220
+ const skillFile = path.join(skillDir, 'SKILL.md');
221
+
222
+ if (fs.existsSync(skillFile)) {
223
+ try {
224
+ const content = fs.readFileSync(skillFile, 'utf8');
225
+ if (content.includes(skillName)) {
226
+ dependents.push(name);
227
+ }
228
+ } catch (e) {
229
+ // Ignore read errors
230
+ }
231
+ }
232
+ }
233
+
234
+ return dependents;
235
+ }
236
+
237
+ /**
238
+ * Update versions.json with deprecation info.
239
+ */
240
+ function updateVersionRegistry(skillName, deprecationInfo, registry) {
241
+ const skill = registry.skills[skillName];
242
+
243
+ skill.status = 'deprecated';
244
+ skill.deprecationInfo = {
245
+ deprecated: true,
246
+ deprecatedIn: registry.version,
247
+ deprecatedAt: new Date().toISOString().split('T')[0],
248
+ removalTarget: deprecationInfo.removalTarget,
249
+ supersededBy: deprecationInfo.supersededBy || null,
250
+ reason: deprecationInfo.reason || 'No longer recommended',
251
+ migrationGuide: deprecationInfo.migrationGuide || null,
252
+ };
253
+ skill.lastUpdated = new Date().toISOString().split('T')[0];
254
+
255
+ return registry;
256
+ }
257
+
258
+ /**
259
+ * Create migration guide template.
260
+ */
261
+ function createMigrationGuide(skillName, deprecationInfo) {
262
+ const skillDir = path.join(SKILLS_DIR, skillName);
263
+ const migrationFile = path.join(skillDir, 'MIGRATION.md');
264
+
265
+ // Check if skill directory exists
266
+ if (!fs.existsSync(skillDir)) {
267
+ return null;
268
+ }
269
+
270
+ const template = `# Migration Guide: ${skillName}
271
+
272
+ ## Deprecation Notice
273
+
274
+ **Status:** Deprecated
275
+ **Deprecated In:** v${deprecationInfo.deprecatedIn}
276
+ **Removal Target:** v${deprecationInfo.removalTarget}
277
+ ${deprecationInfo.supersededBy ? `**Replacement:** ${deprecationInfo.supersededBy}` : ''}
278
+ ${deprecationInfo.reason ? `**Reason:** ${deprecationInfo.reason}` : ''}
279
+
280
+ ---
281
+
282
+ ## Migration Steps
283
+
284
+ ${
285
+ deprecationInfo.supersededBy
286
+ ? `
287
+ ### 1. Identify Usage
288
+
289
+ Search your codebase for references to \`${skillName}\`:
290
+
291
+ \`\`\`bash
292
+ grep -r "${skillName}" ~/.claude/
293
+ \`\`\`
294
+
295
+ ### 2. Update References
296
+
297
+ Replace \`${skillName}\` with \`${deprecationInfo.supersededBy}\` in your configuration.
298
+
299
+ ### 3. Review Differences
300
+
301
+ Key differences between ${skillName} and ${deprecationInfo.supersededBy}:
302
+
303
+ - [ ] Document difference 1
304
+ - [ ] Document difference 2
305
+ - [ ] Document difference 3
306
+
307
+ ### 4. Test
308
+
309
+ Verify that the replacement skill works correctly in your environment.
310
+ `
311
+ : `
312
+ ### 1. Identify Usage
313
+
314
+ Search your codebase for references to \`${skillName}\`:
315
+
316
+ \`\`\`bash
317
+ grep -r "${skillName}" ~/.claude/
318
+ \`\`\`
319
+
320
+ ### 2. Alternative Approaches
321
+
322
+ No direct replacement is available. Consider these alternatives:
323
+
324
+ - [ ] Alternative approach 1
325
+ - [ ] Alternative approach 2
326
+ - [ ] Manual implementation
327
+ `
328
+ }
329
+
330
+ ---
331
+
332
+ ## Timeline
333
+
334
+ | Milestone | Date | Action |
335
+ |-----------|------|--------|
336
+ | Deprecation | ${new Date().toISOString().split('T')[0]} | Deprecation warnings begin |
337
+ | Migration Period | 6 months | Users migrate to ${deprecationInfo.supersededBy || 'alternatives'} |
338
+ | Removal | v${deprecationInfo.removalTarget} | Skill removed from system |
339
+
340
+ ---
341
+
342
+ ## Support
343
+
344
+ If you need help with migration:
345
+
346
+ 1. Check the ${deprecationInfo.supersededBy ? `${deprecationInfo.supersededBy} skill documentation` : 'quarterly review documentation'}
347
+ 2. Run \`/skill-gaps\` to identify alternative patterns
348
+ 3. Contact the CloudStream team for assistance
349
+
350
+ ---
351
+
352
+ *Generated by CloudStream Claude Code Deprecation Tool*
353
+ `;
354
+
355
+ fs.writeFileSync(migrationFile, template);
356
+ return migrationFile;
357
+ }
358
+
359
+ /**
360
+ * Update CHANGELOG.md with deprecation entry.
361
+ */
362
+ function updateChangelog(skillName, deprecationInfo) {
363
+ if (!fs.existsSync(CHANGELOG_FILE)) {
364
+ console.log('[Deprecate] Warning: CHANGELOG.md not found');
365
+ return null;
366
+ }
367
+
368
+ const content = fs.readFileSync(CHANGELOG_FILE, 'utf8');
369
+ const lines = content.split('\n');
370
+
371
+ // Find the first version section
372
+ let insertIndex = -1;
373
+ for (let i = 0; i < lines.length; i++) {
374
+ if (lines[i].startsWith('## [')) {
375
+ insertIndex = i + 1;
376
+ break;
377
+ }
378
+ }
379
+
380
+ if (insertIndex === -1) {
381
+ console.log('[Deprecate] Warning: Could not find version section in CHANGELOG.md');
382
+ return null;
383
+ }
384
+
385
+ // Find or create Deprecated section
386
+ let deprecatedIndex = -1;
387
+ for (let i = insertIndex; i < lines.length; i++) {
388
+ if (lines[i].startsWith('## [')) break; // Next version section
389
+ if (lines[i].startsWith('### Deprecated')) {
390
+ deprecatedIndex = i;
391
+ break;
392
+ }
393
+ }
394
+
395
+ const deprecationEntry = `- \`${skillName}\` deprecated - ${deprecationInfo.supersededBy ? `use \`${deprecationInfo.supersededBy}\` instead` : deprecationInfo.reason || 'no longer recommended'}. Removal target: v${deprecationInfo.removalTarget}`;
396
+
397
+ if (deprecatedIndex !== -1) {
398
+ // Add to existing Deprecated section
399
+ lines.splice(deprecatedIndex + 2, 0, deprecationEntry);
400
+ } else {
401
+ // Create new Deprecated section after existing sections
402
+ let lastSectionEnd = insertIndex;
403
+ for (let i = insertIndex; i < lines.length; i++) {
404
+ if (lines[i].startsWith('## [')) break;
405
+ if (lines[i].startsWith('### ')) lastSectionEnd = i;
406
+ }
407
+
408
+ // Find end of last section
409
+ for (let i = lastSectionEnd + 1; i < lines.length; i++) {
410
+ if (lines[i].startsWith('## [') || lines[i].startsWith('### ')) break;
411
+ lastSectionEnd = i;
412
+ }
413
+
414
+ const newSection = ['', '### Deprecated', '', deprecationEntry];
415
+ lines.splice(lastSectionEnd + 1, 0, ...newSection);
416
+ }
417
+
418
+ fs.writeFileSync(CHANGELOG_FILE, lines.join('\n'));
419
+ return CHANGELOG_FILE;
420
+ }
421
+
422
+ /**
423
+ * Prompt for confirmation.
424
+ */
425
+ async function confirm(message) {
426
+ const rl = readline.createInterface({
427
+ input: process.stdin,
428
+ output: process.stdout,
429
+ });
430
+
431
+ return new Promise((resolve) => {
432
+ rl.question(`${message} (y/N): `, (answer) => {
433
+ rl.close();
434
+ resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
435
+ });
436
+ });
437
+ }
438
+
439
+ /**
440
+ * Output deprecation checklist.
441
+ */
442
+ function outputChecklist(skillName, deprecationInfo, results) {
443
+ console.log('');
444
+ console.log('='.repeat(50));
445
+ console.log(' DEPRECATION CHECKLIST');
446
+ console.log('='.repeat(50));
447
+ console.log('');
448
+ console.log(`Skill: ${skillName}`);
449
+ console.log(`Status: DEPRECATED`);
450
+ console.log(`Removal Target: v${deprecationInfo.removalTarget}`);
451
+ if (deprecationInfo.supersededBy) {
452
+ console.log(`Replacement: ${deprecationInfo.supersededBy}`);
453
+ }
454
+ console.log('');
455
+ console.log('Completed Actions:');
456
+ console.log(` [x] Updated versions.json`);
457
+ console.log(` [${results.migrationGuide ? 'x' : ' '}] Created migration guide`);
458
+ console.log(` [${results.changelog ? 'x' : ' '}] Updated CHANGELOG.md`);
459
+ console.log('');
460
+ console.log('Manual Steps Required:');
461
+ console.log(' [ ] Review and complete migration guide');
462
+ console.log(' [ ] Test deprecation warnings appear');
463
+ console.log(' [ ] Notify team of deprecation');
464
+ console.log(' [ ] Update onboarding materials if needed');
465
+ console.log('');
466
+ if (results.migrationGuide) {
467
+ console.log(`Migration guide: ${results.migrationGuide}`);
468
+ }
469
+ console.log('');
470
+ }
471
+
472
+ /**
473
+ * Main entry point.
474
+ */
475
+ async function main() {
476
+ const options = parseArgs();
477
+
478
+ if (options.help) {
479
+ showHelp();
480
+ return;
481
+ }
482
+
483
+ if (!options.skillName) {
484
+ console.error('[Deprecate] Error: Skill name is required');
485
+ console.log('Run with --help for usage information');
486
+ process.exit(1);
487
+ }
488
+
489
+ // Load registry
490
+ const registry = loadVersionRegistry();
491
+ if (!registry) {
492
+ console.error('[Deprecate] Error: Could not load versions.json');
493
+ process.exit(1);
494
+ }
495
+
496
+ // Validate skill
497
+ const validation = validateSkill(options.skillName, registry);
498
+ if (!validation.valid) {
499
+ console.error(`[Deprecate] Error: ${validation.errors.join(', ')}`);
500
+ process.exit(1);
501
+ }
502
+
503
+ // Validate replacement if provided
504
+ if (options.supersededBy) {
505
+ const replacementValidation = validateReplacement(options.supersededBy, registry);
506
+ if (!replacementValidation.valid) {
507
+ console.error(`[Deprecate] Error: ${replacementValidation.error}`);
508
+ process.exit(1);
509
+ }
510
+ }
511
+
512
+ // Default removal target if not provided
513
+ if (!options.removalTarget) {
514
+ // Increment major version
515
+ const parts = registry.version.split('.');
516
+ options.removalTarget = `${parseInt(parts[0], 10) + 1}.0.0`;
517
+ console.log(`[Deprecate] Using default removal target: v${options.removalTarget}`);
518
+ }
519
+
520
+ // Validate version
521
+ const versionValidation = validateVersion(options.removalTarget, registry.version);
522
+ if (!versionValidation.valid) {
523
+ console.error(`[Deprecate] Error: ${versionValidation.error}`);
524
+ process.exit(1);
525
+ }
526
+
527
+ // Check dependencies
528
+ const dependents = checkDependencies(options.skillName, registry);
529
+ if (dependents.length > 0) {
530
+ console.log('');
531
+ console.log('[Deprecate] Warning: The following skills reference this skill:');
532
+ for (const dep of dependents) {
533
+ console.log(` - ${dep}`);
534
+ }
535
+ console.log('');
536
+ }
537
+
538
+ // Show what will be done
539
+ console.log('');
540
+ console.log('[Deprecate] Deprecation Summary:');
541
+ console.log(` Skill: ${options.skillName}`);
542
+ console.log(` Current Status: ${validation.skillInfo.status}`);
543
+ console.log(` New Status: deprecated`);
544
+ console.log(` Removal Target: v${options.removalTarget}`);
545
+ if (options.supersededBy) {
546
+ console.log(` Replacement: ${options.supersededBy}`);
547
+ }
548
+ if (options.reason) {
549
+ console.log(` Reason: ${options.reason}`);
550
+ }
551
+ console.log('');
552
+
553
+ // Dry run check
554
+ if (options.dryRun) {
555
+ console.log('[Deprecate] Dry run - no changes made');
556
+ return;
557
+ }
558
+
559
+ // Confirm unless forced
560
+ if (!options.force) {
561
+ const confirmed = await confirm('Proceed with deprecation?');
562
+ if (!confirmed) {
563
+ console.log('[Deprecate] Cancelled');
564
+ return;
565
+ }
566
+ }
567
+
568
+ // Execute deprecation
569
+ const deprecationInfo = {
570
+ deprecatedIn: registry.version,
571
+ removalTarget: options.removalTarget,
572
+ supersededBy: options.supersededBy,
573
+ reason: options.reason,
574
+ };
575
+
576
+ const results = {
577
+ versionsUpdated: false,
578
+ migrationGuide: null,
579
+ changelog: null,
580
+ };
581
+
582
+ // Update versions.json
583
+ const updatedRegistry = updateVersionRegistry(options.skillName, deprecationInfo, registry);
584
+ saveVersionRegistry(updatedRegistry);
585
+ results.versionsUpdated = true;
586
+ console.log('[Deprecate] Updated versions.json');
587
+
588
+ // Create migration guide
589
+ const migrationPath = `skills/${options.skillName}/MIGRATION.md`;
590
+ deprecationInfo.migrationGuide = migrationPath;
591
+ results.migrationGuide = createMigrationGuide(options.skillName, deprecationInfo);
592
+ if (results.migrationGuide) {
593
+ console.log(`[Deprecate] Created migration guide: ${results.migrationGuide}`);
594
+ }
595
+
596
+ // Update CHANGELOG
597
+ results.changelog = updateChangelog(options.skillName, deprecationInfo);
598
+ if (results.changelog) {
599
+ console.log('[Deprecate] Updated CHANGELOG.md');
600
+ }
601
+
602
+ // Output checklist
603
+ outputChecklist(options.skillName, deprecationInfo, results);
604
+ }
605
+
606
+ // Run
607
+ main().catch((err) => {
608
+ console.error('[Deprecate] Error:', err.message);
609
+ process.exit(1);
610
+ });