@cloudstreamsoftware/claude-tools 1.0.0 → 1.1.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 (189) 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/config/versions.json +63 -0
  17. package/dist/hooks/hooks.json +209 -0
  18. package/dist/index.js +47 -0
  19. package/dist/lib/asset-value.js +609 -0
  20. package/dist/lib/client-manager.js +300 -0
  21. package/dist/lib/command-matcher.js +242 -0
  22. package/dist/lib/cross-session-patterns.js +754 -0
  23. package/dist/lib/intent-classifier.js +1075 -0
  24. package/dist/lib/package-manager.js +374 -0
  25. package/dist/lib/recommendation-engine.js +597 -0
  26. package/dist/lib/session-memory.js +489 -0
  27. package/dist/lib/skill-effectiveness.js +486 -0
  28. package/dist/lib/skill-matcher.js +595 -0
  29. package/dist/lib/tutorial-metrics.js +242 -0
  30. package/dist/lib/tutorial-progress.js +209 -0
  31. package/dist/lib/tutorial-renderer.js +431 -0
  32. package/dist/lib/utils.js +380 -0
  33. package/dist/lib/verify-formatter.js +143 -0
  34. package/dist/lib/workflow-state.js +249 -0
  35. package/hooks/hooks.json +209 -0
  36. package/package.json +5 -1
  37. package/scripts/aggregate-sessions.js +290 -0
  38. package/scripts/branch-name-validator.js +291 -0
  39. package/scripts/build.js +101 -0
  40. package/scripts/commands/client-switch.js +231 -0
  41. package/scripts/deprecate-skill.js +610 -0
  42. package/scripts/diagnose.js +324 -0
  43. package/scripts/doc-freshness.js +168 -0
  44. package/scripts/generate-weekly-digest.js +393 -0
  45. package/scripts/health-check.js +270 -0
  46. package/scripts/hooks/credential-check.js +101 -0
  47. package/scripts/hooks/evaluate-session.js +81 -0
  48. package/scripts/hooks/pre-compact.js +66 -0
  49. package/scripts/hooks/prompt-analyzer.js +276 -0
  50. package/scripts/hooks/prompt-router.js +422 -0
  51. package/scripts/hooks/quality-gate-enforcer.js +371 -0
  52. package/scripts/hooks/session-end.js +156 -0
  53. package/scripts/hooks/session-start.js +195 -0
  54. package/scripts/hooks/skill-injector.js +333 -0
  55. package/scripts/hooks/suggest-compact.js +58 -0
  56. package/scripts/lib/asset-value.js +609 -0
  57. package/scripts/lib/client-manager.js +300 -0
  58. package/scripts/lib/command-matcher.js +242 -0
  59. package/scripts/lib/cross-session-patterns.js +754 -0
  60. package/scripts/lib/intent-classifier.js +1075 -0
  61. package/scripts/lib/package-manager.js +374 -0
  62. package/scripts/lib/recommendation-engine.js +597 -0
  63. package/scripts/lib/session-memory.js +489 -0
  64. package/scripts/lib/skill-effectiveness.js +486 -0
  65. package/scripts/lib/skill-matcher.js +595 -0
  66. package/scripts/lib/tutorial-metrics.js +242 -0
  67. package/scripts/lib/tutorial-progress.js +209 -0
  68. package/scripts/lib/tutorial-renderer.js +431 -0
  69. package/scripts/lib/utils.js +380 -0
  70. package/scripts/lib/verify-formatter.js +143 -0
  71. package/scripts/lib/workflow-state.js +249 -0
  72. package/scripts/onboard.js +363 -0
  73. package/scripts/quarterly-report.js +692 -0
  74. package/scripts/setup-package-manager.js +204 -0
  75. package/scripts/sync-upstream.js +391 -0
  76. package/scripts/test.js +108 -0
  77. package/scripts/tutorial-runner.js +351 -0
  78. package/scripts/validate-all.js +201 -0
  79. package/scripts/verifiers/agents.js +245 -0
  80. package/scripts/verifiers/config.js +186 -0
  81. package/scripts/verifiers/environment.js +123 -0
  82. package/scripts/verifiers/hooks.js +188 -0
  83. package/scripts/verifiers/index.js +38 -0
  84. package/scripts/verifiers/persistence.js +140 -0
  85. package/scripts/verifiers/plugin.js +215 -0
  86. package/scripts/verifiers/skills.js +209 -0
  87. package/scripts/verify-setup.js +164 -0
  88. package/skills/INDEX.md +157 -0
  89. package/skills/backend-patterns/SKILL.md +586 -0
  90. package/skills/backend-patterns/catalyst-patterns.md +128 -0
  91. package/skills/bigquery-patterns/SKILL.md +27 -0
  92. package/skills/bigquery-patterns/performance-optimization.md +518 -0
  93. package/skills/bigquery-patterns/query-patterns.md +372 -0
  94. package/skills/bigquery-patterns/schema-design.md +78 -0
  95. package/skills/cloudstream-project-template/SKILL.md +20 -0
  96. package/skills/cloudstream-project-template/structure.md +65 -0
  97. package/skills/coding-standards/SKILL.md +524 -0
  98. package/skills/coding-standards/deluge-standards.md +83 -0
  99. package/skills/compliance-patterns/SKILL.md +28 -0
  100. package/skills/compliance-patterns/hipaa/audit-requirements.md +251 -0
  101. package/skills/compliance-patterns/hipaa/baa-process.md +298 -0
  102. package/skills/compliance-patterns/hipaa/data-archival-strategy.md +387 -0
  103. package/skills/compliance-patterns/hipaa/phi-handling.md +52 -0
  104. package/skills/compliance-patterns/pci-dss/saq-a-requirements.md +307 -0
  105. package/skills/compliance-patterns/pci-dss/tokenization-patterns.md +382 -0
  106. package/skills/compliance-patterns/pci-dss/zoho-checkout-patterns.md +56 -0
  107. package/skills/compliance-patterns/soc2/access-controls.md +344 -0
  108. package/skills/compliance-patterns/soc2/audit-logging.md +458 -0
  109. package/skills/compliance-patterns/soc2/change-management.md +403 -0
  110. package/skills/compliance-patterns/soc2/deluge-execution-logging.md +407 -0
  111. package/skills/consultancy-workflows/SKILL.md +19 -0
  112. package/skills/consultancy-workflows/client-isolation.md +21 -0
  113. package/skills/consultancy-workflows/documentation-automation.md +454 -0
  114. package/skills/consultancy-workflows/handoff-procedures.md +257 -0
  115. package/skills/consultancy-workflows/knowledge-capture.md +513 -0
  116. package/skills/consultancy-workflows/time-tracking.md +26 -0
  117. package/skills/continuous-learning/SKILL.md +84 -0
  118. package/skills/continuous-learning/config.json +18 -0
  119. package/skills/continuous-learning/evaluate-session.sh +60 -0
  120. package/skills/continuous-learning-v2/SKILL.md +126 -0
  121. package/skills/continuous-learning-v2/config.json +61 -0
  122. package/skills/frontend-patterns/SKILL.md +635 -0
  123. package/skills/frontend-patterns/zoho-widget-patterns.md +103 -0
  124. package/skills/gcp-data-engineering/SKILL.md +36 -0
  125. package/skills/gcp-data-engineering/bigquery/performance-optimization.md +337 -0
  126. package/skills/gcp-data-engineering/dataflow/error-handling.md +496 -0
  127. package/skills/gcp-data-engineering/dataflow/pipeline-patterns.md +444 -0
  128. package/skills/gcp-data-engineering/dbt/model-organization.md +63 -0
  129. package/skills/gcp-data-engineering/dbt/testing-patterns.md +503 -0
  130. package/skills/gcp-data-engineering/medallion-architecture/bronze-layer.md +60 -0
  131. package/skills/gcp-data-engineering/medallion-architecture/gold-layer.md +311 -0
  132. package/skills/gcp-data-engineering/medallion-architecture/layer-transitions.md +517 -0
  133. package/skills/gcp-data-engineering/medallion-architecture/silver-layer.md +305 -0
  134. package/skills/gcp-data-engineering/zoho-to-gcp/data-extraction.md +543 -0
  135. package/skills/gcp-data-engineering/zoho-to-gcp/real-time-vs-batch.md +337 -0
  136. package/skills/security-review/SKILL.md +498 -0
  137. package/skills/security-review/compliance-checklist.md +53 -0
  138. package/skills/strategic-compact/SKILL.md +67 -0
  139. package/skills/tdd-workflow/SKILL.md +413 -0
  140. package/skills/tdd-workflow/zoho-testing.md +124 -0
  141. package/skills/tutorial/SKILL.md +249 -0
  142. package/skills/tutorial/docs/ACCESSIBILITY.md +169 -0
  143. package/skills/tutorial/lessons/00-philosophy-and-workflow.md +198 -0
  144. package/skills/tutorial/lessons/01-basics.md +81 -0
  145. package/skills/tutorial/lessons/02-training.md +86 -0
  146. package/skills/tutorial/lessons/03-commands.md +109 -0
  147. package/skills/tutorial/lessons/04-workflows.md +115 -0
  148. package/skills/tutorial/lessons/05-compliance.md +116 -0
  149. package/skills/tutorial/lessons/06-zoho.md +121 -0
  150. package/skills/tutorial/lessons/07-hooks-system.md +277 -0
  151. package/skills/tutorial/lessons/08-mcp-servers.md +316 -0
  152. package/skills/tutorial/lessons/09-client-management.md +215 -0
  153. package/skills/tutorial/lessons/10-testing-e2e.md +260 -0
  154. package/skills/tutorial/lessons/11-skills-deep-dive.md +272 -0
  155. package/skills/tutorial/lessons/12-rules-system.md +326 -0
  156. package/skills/tutorial/lessons/13-golden-standard-graduation.md +213 -0
  157. package/skills/tutorial/lessons/14-fork-setup-and-sync.md +312 -0
  158. package/skills/tutorial/lessons/15-living-examples-system.md +221 -0
  159. package/skills/tutorial/tracks/accelerated/README.md +134 -0
  160. package/skills/tutorial/tracks/accelerated/assessment/checkpoint-1.md +161 -0
  161. package/skills/tutorial/tracks/accelerated/assessment/checkpoint-2.md +175 -0
  162. package/skills/tutorial/tracks/accelerated/day-1-core-concepts.md +234 -0
  163. package/skills/tutorial/tracks/accelerated/day-2-essential-commands.md +270 -0
  164. package/skills/tutorial/tracks/accelerated/day-3-workflow-mastery.md +305 -0
  165. package/skills/tutorial/tracks/accelerated/day-4-compliance-zoho.md +304 -0
  166. package/skills/tutorial/tracks/accelerated/day-5-hooks-skills.md +344 -0
  167. package/skills/tutorial/tracks/accelerated/day-6-client-testing.md +386 -0
  168. package/skills/tutorial/tracks/accelerated/day-7-graduation.md +369 -0
  169. package/skills/zoho-patterns/CHANGELOG.md +108 -0
  170. package/skills/zoho-patterns/SKILL.md +446 -0
  171. package/skills/zoho-patterns/analytics/dashboard-patterns.md +352 -0
  172. package/skills/zoho-patterns/analytics/zoho-to-bigquery-pipeline.md +427 -0
  173. package/skills/zoho-patterns/catalyst/appsail-deployment.md +349 -0
  174. package/skills/zoho-patterns/catalyst/context-close-patterns.md +354 -0
  175. package/skills/zoho-patterns/catalyst/cron-batch-processing.md +374 -0
  176. package/skills/zoho-patterns/catalyst/function-patterns.md +439 -0
  177. package/skills/zoho-patterns/creator/form-design.md +304 -0
  178. package/skills/zoho-patterns/creator/publish-api-patterns.md +313 -0
  179. package/skills/zoho-patterns/creator/widget-integration.md +306 -0
  180. package/skills/zoho-patterns/creator/workflow-automation.md +253 -0
  181. package/skills/zoho-patterns/deluge/api-patterns.md +468 -0
  182. package/skills/zoho-patterns/deluge/batch-processing.md +403 -0
  183. package/skills/zoho-patterns/deluge/cross-app-integration.md +356 -0
  184. package/skills/zoho-patterns/deluge/error-handling.md +423 -0
  185. package/skills/zoho-patterns/deluge/syntax-reference.md +65 -0
  186. package/skills/zoho-patterns/integration/cors-proxy-architecture.md +426 -0
  187. package/skills/zoho-patterns/integration/crm-books-native-sync.md +277 -0
  188. package/skills/zoho-patterns/integration/oauth-token-management.md +461 -0
  189. package/skills/zoho-patterns/integration/zoho-flow-patterns.md +334 -0
@@ -0,0 +1,249 @@
1
+ /**
2
+ * Workflow State - Tracks Workflow Phases and Suggests Next Steps
3
+ *
4
+ * Manages the state of multi-phase workflows (feature, bugfix, refactor, zoho)
5
+ * and provides guidance on skipped phases and next steps.
6
+ *
7
+ * @module workflow-state
8
+ */
9
+
10
+ /**
11
+ * Workflow phase definitions
12
+ *
13
+ * Each workflow type has an ordered list of phases that should be followed.
14
+ * Critical phases are marked and require confirmation to skip.
15
+ */
16
+ const WORKFLOW_PHASES = {
17
+ feature: ['plan', 'tdd', 'implement', 'review', 'verify', 'pr'],
18
+ bugfix: ['investigate', 'tdd', 'fix', 'review', 'verify'],
19
+ refactor: ['plan', 'review-existing', 'refactor', 'verify'],
20
+ zoho: ['architect', 'deluge-review', 'deploy', 'verify'],
21
+ };
22
+
23
+ /**
24
+ * Critical phases that require confirmation to skip
25
+ */
26
+ const CRITICAL_PHASES = {
27
+ feature: ['plan', 'tdd', 'review'],
28
+ bugfix: ['investigate', 'review'],
29
+ refactor: ['plan', 'review-existing'],
30
+ zoho: ['architect', 'deluge-review'],
31
+ };
32
+
33
+ /**
34
+ * In-memory workflow state
35
+ * In production, this would be persisted to session-memory.js
36
+ */
37
+ let currentWorkflow = null;
38
+
39
+ /**
40
+ * Get the current workflow state
41
+ *
42
+ * @returns {object|null} Current workflow state or null if no workflow active
43
+ */
44
+ function getWorkflowState() {
45
+ return currentWorkflow;
46
+ }
47
+
48
+ /**
49
+ * Start a new workflow
50
+ *
51
+ * @param {string} type - Workflow type (feature, bugfix, refactor, zoho)
52
+ * @param {string} description - Description of what this workflow is for
53
+ * @returns {boolean} True if workflow started successfully
54
+ */
55
+ function startWorkflow(type, description = '') {
56
+ // Validate workflow type
57
+ if (!WORKFLOW_PHASES[type]) {
58
+ return false;
59
+ }
60
+
61
+ currentWorkflow = {
62
+ type,
63
+ description,
64
+ currentPhase: null,
65
+ completedPhases: [],
66
+ startedAt: new Date().toISOString(),
67
+ lastUpdated: new Date().toISOString(),
68
+ };
69
+
70
+ return true;
71
+ }
72
+
73
+ /**
74
+ * Advance to a specific phase
75
+ *
76
+ * @param {string} phase - The phase to advance to
77
+ * @returns {boolean} True if phase was advanced successfully
78
+ */
79
+ function advancePhase(phase) {
80
+ if (!currentWorkflow) {
81
+ return false;
82
+ }
83
+
84
+ // Add to completed phases if not already there
85
+ if (!currentWorkflow.completedPhases.includes(phase)) {
86
+ currentWorkflow.completedPhases.push(phase);
87
+ }
88
+
89
+ currentWorkflow.currentPhase = phase;
90
+ currentWorkflow.lastUpdated = new Date().toISOString();
91
+
92
+ return true;
93
+ }
94
+
95
+ /**
96
+ * Check which phases were skipped to reach a target phase
97
+ *
98
+ * @param {string} targetPhase - The phase we're trying to reach
99
+ * @returns {string[]} Array of skipped phase names
100
+ */
101
+ function checkSkippedPhases(targetPhase) {
102
+ if (!currentWorkflow) {
103
+ return [];
104
+ }
105
+
106
+ const phases = WORKFLOW_PHASES[currentWorkflow.type];
107
+ if (!phases) {
108
+ return [];
109
+ }
110
+
111
+ const targetIndex = phases.indexOf(targetPhase);
112
+ if (targetIndex === -1) {
113
+ return [];
114
+ }
115
+
116
+ const skipped = [];
117
+
118
+ // Check all phases before the target
119
+ for (let i = 0; i < targetIndex; i++) {
120
+ const phase = phases[i];
121
+ if (!currentWorkflow.completedPhases.includes(phase)) {
122
+ skipped.push(phase);
123
+ }
124
+ }
125
+
126
+ return skipped;
127
+ }
128
+
129
+ /**
130
+ * Get the next recommended phase
131
+ *
132
+ * @returns {string|null} Next phase name or null if workflow complete
133
+ */
134
+ function getNextPhase() {
135
+ if (!currentWorkflow) {
136
+ return null;
137
+ }
138
+
139
+ const phases = WORKFLOW_PHASES[currentWorkflow.type];
140
+ if (!phases) {
141
+ return null;
142
+ }
143
+
144
+ // Find the current phase index
145
+ const currentIndex = currentWorkflow.currentPhase
146
+ ? phases.indexOf(currentWorkflow.currentPhase)
147
+ : -1;
148
+
149
+ // Return the next phase
150
+ const nextIndex = currentIndex + 1;
151
+ if (nextIndex >= phases.length) {
152
+ return null; // Workflow complete
153
+ }
154
+
155
+ return phases[nextIndex];
156
+ }
157
+
158
+ /**
159
+ * Check if a phase is critical for a workflow type
160
+ *
161
+ * @param {string} phase - Phase name
162
+ * @param {string} workflowType - Workflow type
163
+ * @returns {boolean} True if phase is critical
164
+ */
165
+ function isCriticalPhase(phase, workflowType) {
166
+ const criticalPhases = CRITICAL_PHASES[workflowType];
167
+ if (!criticalPhases) {
168
+ return false;
169
+ }
170
+ return criticalPhases.includes(phase);
171
+ }
172
+
173
+ /**
174
+ * Reset the workflow state
175
+ */
176
+ function resetWorkflow() {
177
+ currentWorkflow = null;
178
+ }
179
+
180
+ /**
181
+ * Check if a workflow is currently active
182
+ *
183
+ * @returns {boolean} True if workflow is active
184
+ */
185
+ function hasActiveWorkflow() {
186
+ return currentWorkflow !== null;
187
+ }
188
+
189
+ /**
190
+ * Get workflow progress as a percentage
191
+ *
192
+ * @returns {number} Progress percentage (0-100)
193
+ */
194
+ function getProgress() {
195
+ if (!currentWorkflow) {
196
+ return 0;
197
+ }
198
+
199
+ const phases = WORKFLOW_PHASES[currentWorkflow.type];
200
+ if (!phases || phases.length === 0) {
201
+ return 0;
202
+ }
203
+
204
+ return Math.round((currentWorkflow.completedPhases.length / phases.length) * 100);
205
+ }
206
+
207
+ /**
208
+ * Detect workflow type from an intent
209
+ *
210
+ * @param {string} intent - The detected intent
211
+ * @returns {string|null} Suggested workflow type or null
212
+ */
213
+ function detectWorkflowType(intent) {
214
+ const intentToWorkflow = {
215
+ PLANNING: 'feature',
216
+ TESTING: 'feature', // Testing typically part of feature workflow
217
+ REVIEW: null, // Review could be any workflow
218
+ SECURITY: null,
219
+ COMPLIANCE: null,
220
+ ZOHO: 'zoho',
221
+ DEPLOY: null, // Deploy is usually end of workflow
222
+ REFACTOR: 'refactor',
223
+ DEBUG: 'bugfix',
224
+ };
225
+
226
+ return intentToWorkflow[intent] || null;
227
+ }
228
+
229
+ module.exports = {
230
+ // State management
231
+ getWorkflowState,
232
+ startWorkflow,
233
+ advancePhase,
234
+ resetWorkflow,
235
+ hasActiveWorkflow,
236
+
237
+ // Phase checking
238
+ checkSkippedPhases,
239
+ getNextPhase,
240
+ isCriticalPhase,
241
+ getProgress,
242
+
243
+ // Workflow detection
244
+ detectWorkflowType,
245
+
246
+ // Constants
247
+ WORKFLOW_PHASES,
248
+ CRITICAL_PHASES,
249
+ };
@@ -0,0 +1,209 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
+ "hooks": {
4
+ "UserPromptSubmit": [
5
+ {
6
+ "matcher": "*",
7
+ "hooks": [
8
+ {
9
+ "type": "command",
10
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/prompt-router.js\""
11
+ }
12
+ ],
13
+ "description": "Intelligent prompt routing - auto-detect intent and suggest optimal commands"
14
+ },
15
+ {
16
+ "matcher": "*",
17
+ "hooks": [
18
+ {
19
+ "type": "command",
20
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/prompt-analyzer.js\""
21
+ }
22
+ ],
23
+ "description": "Real-time correction detection and session learning"
24
+ }
25
+ ],
26
+ "PreToolUse": [
27
+ {
28
+ "matcher": "tool == \"Edit\" || tool == \"Write\"",
29
+ "hooks": [
30
+ {
31
+ "type": "command",
32
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/credential-check.js\""
33
+ }
34
+ ],
35
+ "description": "Scan for hardcoded Zoho/GCP credentials in edits"
36
+ },
37
+ {
38
+ "matcher": "tool == \"Bash\" && tool_input.command matches \"(npm run dev|pnpm( run)? dev|yarn dev|bun run dev)\"",
39
+ "hooks": [
40
+ {
41
+ "type": "command",
42
+ "command": "node -e \"console.error('[Hook] BLOCKED: Dev server must run in tmux for log access');console.error('[Hook] Use: tmux new-session -d -s dev \\\"npm run dev\\\"');console.error('[Hook] Then: tmux attach -t dev');process.exit(1)\""
43
+ }
44
+ ],
45
+ "description": "Block dev servers outside tmux - ensures you can access logs"
46
+ },
47
+ {
48
+ "matcher": "tool == \"Bash\" && tool_input.command matches \"(npm (install|test)|pnpm (install|test)|yarn (install|test)?|bun (install|test)|cargo build|make|docker|pytest|vitest|playwright)\"",
49
+ "hooks": [
50
+ {
51
+ "type": "command",
52
+ "command": "node -e \"if(!process.env.TMUX){console.error('[Hook] Consider running in tmux for session persistence');console.error('[Hook] tmux new -s dev | tmux attach -t dev')}\""
53
+ }
54
+ ],
55
+ "description": "Reminder to use tmux for long-running commands"
56
+ },
57
+ {
58
+ "matcher": "tool == \"Bash\" && tool_input.command matches \"git push\"",
59
+ "hooks": [
60
+ {
61
+ "type": "command",
62
+ "command": "node -e \"console.error('[Hook] Review changes before push...');console.error('[Hook] Continuing with push (remove this hook to add interactive review)')\""
63
+ }
64
+ ],
65
+ "description": "Reminder before git push to review changes"
66
+ },
67
+ {
68
+ "matcher": "tool == \"Write\" && tool_input.file_path matches \"\\\\.(md|txt)$\" && !(tool_input.file_path matches \"README\\\\.md|CLAUDE\\\\.md|AGENTS\\\\.md|CONTRIBUTING\\\\.md\")",
69
+ "hooks": [
70
+ {
71
+ "type": "command",
72
+ "command": "node -e \"const fs=require('fs');let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING)\\.md$/.test(p)){console.error('[Hook] BLOCKED: Unnecessary documentation file creation');console.error('[Hook] File: '+p);console.error('[Hook] Use README.md for documentation instead');process.exit(1)}console.log(d)})\""
73
+ }
74
+ ],
75
+ "description": "Block creation of random .md files - keeps docs consolidated"
76
+ },
77
+ {
78
+ "matcher": "tool == \"Edit\" || tool == \"Write\"",
79
+ "hooks": [
80
+ {
81
+ "type": "command",
82
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/suggest-compact.js\""
83
+ }
84
+ ],
85
+ "description": "Suggest manual compaction at logical intervals"
86
+ },
87
+ {
88
+ "matcher": "tool == \"Edit\" || tool == \"Write\"",
89
+ "hooks": [
90
+ {
91
+ "type": "command",
92
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/quality-gate-enforcer.js\""
93
+ }
94
+ ],
95
+ "description": "Enforce quality gates (credentials, compliance, patterns)"
96
+ },
97
+ {
98
+ "matcher": "tool == \"Edit\" || tool == \"Write\" || tool == \"Read\"",
99
+ "hooks": [
100
+ {
101
+ "type": "command",
102
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/skill-injector.js\""
103
+ }
104
+ ],
105
+ "description": "Auto-inject relevant skills based on context"
106
+ }
107
+ ],
108
+ "PreCompact": [
109
+ {
110
+ "matcher": "*",
111
+ "hooks": [
112
+ {
113
+ "type": "command",
114
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/pre-compact.js\""
115
+ }
116
+ ],
117
+ "description": "Save state before context compaction"
118
+ }
119
+ ],
120
+ "SessionStart": [
121
+ {
122
+ "matcher": "*",
123
+ "hooks": [
124
+ {
125
+ "type": "command",
126
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/session-start.js\""
127
+ }
128
+ ],
129
+ "description": "Load previous context and detect package manager on new session"
130
+ }
131
+ ],
132
+ "PostToolUse": [
133
+ {
134
+ "matcher": "tool == \"Bash\"",
135
+ "hooks": [
136
+ {
137
+ "type": "command",
138
+ "command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const i=JSON.parse(d);const cmd=i.tool_input?.command||'';if(/gh pr create/.test(cmd)){const out=i.tool_output?.output||'';const m=out.match(/https:\\/\\/github.com\\/[^/]+\\/[^/]+\\/pull\\/\\d+/);if(m){console.error('[Hook] PR created: '+m[0]);const repo=m[0].replace(/https:\\/\\/github.com\\/([^/]+\\/[^/]+)\\/pull\\/\\d+/,'$1');const pr=m[0].replace(/.*\\/pull\\/(\\d+)/,'$1');console.error('[Hook] To review: gh pr review '+pr+' --repo '+repo)}}console.log(d)})\""
139
+ }
140
+ ],
141
+ "description": "Log PR URL and provide review command after PR creation"
142
+ },
143
+ {
144
+ "matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(ts|tsx|js|jsx)$\"",
145
+ "hooks": [
146
+ {
147
+ "type": "command",
148
+ "command": "node -e \"const{execSync}=require('child_process');const fs=require('fs');let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const i=JSON.parse(d);const p=i.tool_input?.file_path;if(p&&fs.existsSync(p)){try{execSync('npx prettier --write \"'+p+'\"',{stdio:['pipe','pipe','pipe']})}catch(e){}}console.log(d)})\""
149
+ }
150
+ ],
151
+ "description": "Auto-format JS/TS files with Prettier after edits"
152
+ },
153
+ {
154
+ "matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(ts|tsx)$\"",
155
+ "hooks": [
156
+ {
157
+ "type": "command",
158
+ "command": "node -e \"const{execSync}=require('child_process');const fs=require('fs');const path=require('path');let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const i=JSON.parse(d);const p=i.tool_input?.file_path;if(p&&fs.existsSync(p)){let dir=path.dirname(p);while(dir!==path.dirname(dir)&&!fs.existsSync(path.join(dir,'tsconfig.json'))){dir=path.dirname(dir)}if(fs.existsSync(path.join(dir,'tsconfig.json'))){try{const r=execSync('npx tsc --noEmit --pretty false 2>&1',{cwd:dir,encoding:'utf8',stdio:['pipe','pipe','pipe']});const lines=r.split('\\n').filter(l=>l.includes(p)).slice(0,10);if(lines.length)console.error(lines.join('\\n'))}catch(e){const lines=(e.stdout||'').split('\\n').filter(l=>l.includes(p)).slice(0,10);if(lines.length)console.error(lines.join('\\n'))}}}console.log(d)})\""
159
+ }
160
+ ],
161
+ "description": "TypeScript check after editing .ts/.tsx files"
162
+ },
163
+ {
164
+ "matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(ts|tsx|js|jsx)$\"",
165
+ "hooks": [
166
+ {
167
+ "type": "command",
168
+ "command": "node -e \"const fs=require('fs');let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const i=JSON.parse(d);const p=i.tool_input?.file_path;if(p&&fs.existsSync(p)){const c=fs.readFileSync(p,'utf8');const lines=c.split('\\n');const matches=[];lines.forEach((l,idx)=>{if(/console\\.log/.test(l))matches.push((idx+1)+': '+l.trim())});if(matches.length){console.error('[Hook] WARNING: console.log found in '+p);matches.slice(0,5).forEach(m=>console.error(m));console.error('[Hook] Remove console.log before committing')}}console.log(d)})\""
169
+ }
170
+ ],
171
+ "description": "Warn about console.log statements after edits"
172
+ }
173
+ ],
174
+ "Stop": [
175
+ {
176
+ "matcher": "*",
177
+ "hooks": [
178
+ {
179
+ "type": "command",
180
+ "command": "node -e \"const{execSync}=require('child_process');const fs=require('fs');let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{execSync('git rev-parse --git-dir',{stdio:'pipe'})}catch{console.log(d);process.exit(0)}try{const files=execSync('git diff --name-only HEAD',{encoding:'utf8',stdio:['pipe','pipe','pipe']}).split('\\n').filter(f=>/\\.(ts|tsx|js|jsx)$/.test(f)&&fs.existsSync(f));let hasConsole=false;for(const f of files){if(fs.readFileSync(f,'utf8').includes('console.log')){console.error('[Hook] WARNING: console.log found in '+f);hasConsole=true}}if(hasConsole)console.error('[Hook] Remove console.log statements before committing')}catch(e){}console.log(d)})\""
181
+ }
182
+ ],
183
+ "description": "Check for console.log in modified files after each response"
184
+ }
185
+ ],
186
+ "SessionEnd": [
187
+ {
188
+ "matcher": "*",
189
+ "hooks": [
190
+ {
191
+ "type": "command",
192
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/session-end.js\""
193
+ }
194
+ ],
195
+ "description": "Persist session state on end"
196
+ },
197
+ {
198
+ "matcher": "*",
199
+ "hooks": [
200
+ {
201
+ "type": "command",
202
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/evaluate-session.js\""
203
+ }
204
+ ],
205
+ "description": "Evaluate session for extractable patterns"
206
+ }
207
+ ]
208
+ }
209
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudstreamsoftware/claude-tools",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "CloudStream Claude Code productivity tools - hooks, skills, agents, and knowledge server integration",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -36,6 +36,10 @@
36
36
  "dist/",
37
37
  "config/",
38
38
  "mcp/",
39
+ "scripts/",
40
+ "hooks/",
41
+ "skills/",
42
+ "agents/",
39
43
  "README.md"
40
44
  ],
41
45
  "dependencies": {