@sureliving/n8n-nodes-claudecode 0.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.
package/LICENSE.md ADDED
@@ -0,0 +1,19 @@
1
+ Copyright 2022 n8n
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,362 @@
1
+ # 🚀 Claude Code for n8n
2
+
3
+ **Bring the power of Claude Code directly into your n8n automation workflows!**
4
+
5
+ Imagine having an AI coding assistant that can analyze your codebase, fix bugs, write new features, manage databases, interact with APIs, and automate your entire development workflow - all within n8n. That's exactly what this node enables.
6
+
7
+ [![n8n](https://img.shields.io/badge/n8n-community_node-orange.svg)](https://n8n.io/)
8
+ [![Claude Code](https://img.shields.io/badge/Claude%20Code-Powered-blue.svg)](https://claude.ai/code)
9
+ [![npm](https://img.shields.io/npm/v/@sureliving/n8n-nodes-claudecode.svg)](https://www.npmjs.com/package/@sureliving/n8n-nodes-claudecode)
10
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE.md)
11
+
12
+ ## 🌟 What Can You Build?
13
+
14
+ ### 🔧 **Automated Code Reviews**
15
+ Create workflows that automatically review pull requests, suggest improvements, and even fix issues before merging.
16
+
17
+ ### 🐛 **Intelligent Bug Fixing**
18
+ Connect error monitoring tools to Claude Code - automatically diagnose and fix production issues in real-time.
19
+
20
+ ### 📊 **Database Management**
21
+ Let Claude Code write complex SQL queries, optimize database schemas, and generate migration scripts based on your requirements.
22
+
23
+ ### 🤖 **Self-Improving Workflows**
24
+ Build n8n workflows that can modify and improve themselves using Claude Code's capabilities.
25
+
26
+ ### 📝 **Documentation Generation**
27
+ Automatically generate and update documentation for your entire codebase, APIs, or databases.
28
+
29
+ ### 🔄 **Code Migration**
30
+ Automate the migration of legacy codebases to modern frameworks with intelligent refactoring.
31
+
32
+ ### 🎫 **Customer Support Automation**
33
+ Transform support tickets into code fixes automatically:
34
+ - Analyze customer bug reports and reproduce issues
35
+ - Generate fixes for reported problems
36
+ - Create test cases to prevent regression
37
+ - Update documentation based on common questions
38
+ - Auto-respond with workarounds while fixes are deployed
39
+
40
+ ## ⚡ Quick Start
41
+
42
+ ### Prerequisites
43
+ 1. **Claude Code runtime**
44
+
45
+ This node uses `@anthropic-ai/claude-agent-sdk`, which bundles a Node-based Claude Code entrypoint. You do **not** need a global `claude` binary in `$PATH` for the node to run.
46
+
47
+ If you prefer using the native Claude Code binary/installer instead, install it on your n8n server and configure the SDK accordingly.
48
+
49
+ 2. **Authentication**
50
+
51
+ You can authenticate in two ways:
52
+
53
+ - **n8n Credentials (required)**: Create an **Anthropic API** credential in n8n and select it on the Claude Code node. The API key is injected only into the spawned Claude Code process environment for that execution. The node intentionally strips any Claude/Anthropic auth environment variables from the container environment to ensure auth comes only from n8n credentials.
54
+
55
+ ### Install in n8n
56
+
57
+ #### Option 1: Via n8n UI (Recommended)
58
+ 1. Open your n8n instance
59
+ 2. Go to **Settings** → **Community Nodes**
60
+ 3. Click **Install a community node**
61
+ 4. Enter: `@sureliving/n8n-nodes-claudecode`
62
+ 5. Click **Install**
63
+ 6. Restart n8n when prompted
64
+
65
+ #### Option 2: Manual Installation
66
+ ```bash
67
+ cd ~/.n8n/nodes
68
+ npm install @sureliving/n8n-nodes-claudecode
69
+ # Restart n8n
70
+ ```
71
+
72
+ #### Option 3: Docker
73
+ ```bash
74
+ docker run -it --rm \
75
+ -p 5678:5678 \
76
+ -e N8N_COMMUNITY_NODE_PACKAGES=@sureliving/n8n-nodes-claudecode \
77
+ -v ~/.n8n:/home/node/.n8n \
78
+ n8nio/n8n
79
+ ```
80
+
81
+ **Note**: For Docker, you'll need to ensure Claude Code CLI is installed inside the container. Consider creating a custom Dockerfile.
82
+
83
+ 📦 **NPM Package**: [@sureliving/n8n-nodes-claudecode](https://www.npmjs.com/package/@sureliving/n8n-nodes-claudecode)
84
+
85
+ ## 🎯 Real-World Use Cases
86
+
87
+ ### 1. **GitHub Issue to Code**
88
+ ```
89
+ Webhook (GitHub Issue) → Claude Code → Create PR → Notify Slack
90
+ ```
91
+ Automatically implement features or fix bugs when issues are created.
92
+
93
+ ### 2. **Database Query Builder**
94
+ ```
95
+ Form Trigger → Claude Code → Execute Query → Send Results
96
+ ```
97
+ Natural language to SQL - let non-technical users query databases safely.
98
+
99
+ ### 3. **Code Quality Guardian**
100
+ ```
101
+ Git Push → Claude Code → Analyze Code → Block/Approve → Notify
102
+ ```
103
+ Enforce coding standards and catch issues before they reach production.
104
+
105
+ ### 4. **API Integration Builder**
106
+ ```
107
+ HTTP Request → Claude Code → Generate Integration → Test → Deploy
108
+ ```
109
+ Automatically create integrations with third-party APIs.
110
+
111
+ ### 5. **Intelligent Log Analysis**
112
+ ```
113
+ Error Logs → Claude Code → Diagnose → Create Fix → Open PR
114
+ ```
115
+ Turn error logs into actionable fixes automatically.
116
+
117
+ ### 6. **Customer Support to Code Fix**
118
+ ```
119
+ Support Ticket → Claude Code → Reproduce Issue → Generate Fix → Test → Deploy → Auto-Reply
120
+ ```
121
+ Transform customer complaints into deployed fixes in minutes, not days.
122
+
123
+ ## 🛠️ Powerful Features
124
+
125
+ ### **Project Context Awareness**
126
+ Set a project path and Claude Code understands your entire codebase context:
127
+ - Analyzes existing code patterns
128
+ - Follows your coding standards
129
+ - Understands your architecture
130
+ - Respects your dependencies
131
+
132
+ ### **Tool Arsenal**
133
+ Claude Code comes equipped with powerful tools:
134
+ - 📁 **File Operations**: Read, write, edit multiple files
135
+ - 💻 **Bash Commands**: Execute any command
136
+ - 🔍 **Smart Search**: Find patterns across your codebase
137
+ - 🌐 **Web Access**: Fetch documentation and resources
138
+ - 📊 **Database Access**: Via MCP servers
139
+ - 🔗 **API Integration**: GitHub, Slack, and more via MCP
140
+
141
+ ### **Advanced SDK Options**
142
+ Fine-tune Claude Code's behavior with these powerful options:
143
+ - 🚫 **Disallowed Tools**: Explicitly block specific tools for security
144
+ - 🔄 **Fallback Model**: Automatically switch models when primary is overloaded
145
+ - 🧠 **Max Thinking Tokens**: Control Claude's internal reasoning depth
146
+ - 🔐 **Permission Modes**: Choose from `default`, `acceptEdits`, `bypassPermissions`, or `plan`
147
+
148
+ ### **Model Context Protocol (MCP)**
149
+ Extend Claude Code with specialized capabilities:
150
+ - PostgreSQL/MySQL database access
151
+ - GitHub repository management
152
+ - Slack workspace integration
153
+ - Custom tool development
154
+
155
+ ## 📋 Configuration Examples
156
+
157
+ ### Simple Code Analysis
158
+ ```javascript
159
+ {
160
+ "operation": "query",
161
+ "prompt": "Analyze this codebase and suggest performance improvements",
162
+ "projectPath": "/path/to/your/project",
163
+ "model": "sonnet"
164
+ }
165
+ ```
166
+
167
+ ### Advanced Database Operations
168
+ ```javascript
169
+ {
170
+ "operation": "query",
171
+ "prompt": "Create an optimized query to find users who haven't logged in for 30 days",
172
+ "projectPath": "/path/to/project",
173
+ "model": "opus"
174
+ }
175
+ ```
176
+
177
+ ### Customer Support Automation
178
+ ```javascript
179
+ {
180
+ "operation": "query",
181
+ "prompt": "Customer reports: 'Login button not working on mobile devices'\n\nAnalyze this issue, find the root cause, and create a fix",
182
+ "projectPath": "/path/to/web-app",
183
+ "model": "opus",
184
+ "allowedTools": ["Read", "Write", "Edit", "Bash", "Grep"],
185
+ "additionalOptions": {
186
+ "systemPrompt": "Focus on mobile compatibility issues. Check responsive CSS and JavaScript event handlers."
187
+ }
188
+ }
189
+ ```
190
+
191
+ ### Advanced Configuration with SDK Options
192
+ ```javascript
193
+ {
194
+ "operation": "query",
195
+ "prompt": "Refactor this legacy code to use modern patterns",
196
+ "projectPath": "/path/to/legacy-app",
197
+ "model": "opus",
198
+ "allowedTools": ["Read", "Write", "Edit", "MultiEdit", "Grep"],
199
+ "disallowedTools": ["Bash"], // Prevent command execution for safety
200
+ "additionalOptions": {
201
+ "permissionMode": "plan", // Claude will plan before executing
202
+ "fallbackModel": "sonnet", // Auto-switch if Opus is overloaded
203
+ "maxThinkingTokens": 50000, // Allow deep reasoning for complex refactoring
204
+ "systemPrompt": "Preserve all existing functionality while modernizing the code"
205
+ }
206
+ }
207
+ ```
208
+
209
+ With MCP configuration (`.mcp.json`):
210
+ ```json
211
+ {
212
+ "mcpServers": {
213
+ "postgres": {
214
+ "command": "npx",
215
+ "args": ["-y", "@modelcontextprotocol/server-postgres", "${DATABASE_URL}"]
216
+ }
217
+ }
218
+ }
219
+ ```
220
+
221
+ ## 🔄 Workflow Patterns
222
+
223
+ ### Pattern 1: Continuous Code Improvement
224
+ ```
225
+ Schedule Trigger (Daily)
226
+
227
+ Claude Code (Analyze codebase for improvements)
228
+
229
+ Create GitHub Issues
230
+
231
+ Assign to Team
232
+ ```
233
+
234
+ ### Pattern 2: Natural Language to Code
235
+ ```
236
+ Slack Command
237
+
238
+ Claude Code (Generate code from description)
239
+
240
+ Create Pull Request
241
+
242
+ Run Tests
243
+
244
+ Notify Results
245
+ ```
246
+
247
+ ### Pattern 3: Intelligent Monitoring
248
+ ```
249
+ Error Webhook
250
+
251
+ Claude Code (Diagnose issue)
252
+
253
+ If (Can fix automatically)
254
+ ├─ Yes: Create Fix PR
255
+ └─ No: Create Detailed Issue
256
+ ```
257
+
258
+ ## 🚦 Getting Started
259
+
260
+ ### 1. **Verify Prerequisites**
261
+ Make sure Claude Code CLI is installed and authenticated on your n8n server:
262
+ ```bash
263
+ claude --version # Should show the version
264
+ ```
265
+
266
+ If not installed, see the [Quick Start](#-quick-start) section above.
267
+
268
+ ### 2. **Create Your First Workflow**
269
+ 1. In n8n, create a new workflow
270
+ 2. Add a **Manual Trigger** node (for testing)
271
+ 3. Add the **Claude Code** node
272
+ 4. Configure:
273
+ - **Operation**: Query
274
+ - **Prompt**: "Analyze the code in this directory and suggest improvements"
275
+ - **Project Path**: `/path/to/your/project`
276
+ - **Model**: Sonnet (faster) or Opus (more powerful)
277
+ 5. Click **Execute Workflow**
278
+ 6. Watch Claude Code analyze your project!
279
+
280
+ ### 3. **Explore Advanced Features**
281
+ - Check out the [workflow templates](./workflow-templates/) for ready-to-use examples
282
+ - See the [examples directory](./examples/) for configuration options
283
+ - Read about [MCP servers](#model-context-protocol-mcp) for database and API access
284
+
285
+ ## 💡 Pro Tips
286
+
287
+ ### 🎯 **Use Project Paths**
288
+ Always set a project path for better context and results:
289
+ ```
290
+ /home/user/projects/my-app
291
+ ```
292
+
293
+ ### 🔒 **Configure Permissions**
294
+ Control what Claude Code can do in `.claude/settings.json`:
295
+ ```json
296
+ {
297
+ "permissions": {
298
+ "allow": ["Read(*)", "Write(*)", "Bash(npm test)"],
299
+ "deny": ["Bash(rm -rf *)"]
300
+ }
301
+ }
302
+ ```
303
+
304
+ ### 🔗 **Chain Operations**
305
+ Use "Continue" operation to build complex multi-step workflows while maintaining context.
306
+
307
+ ### 📊 **Output Formats**
308
+ - **Structured**: Full details with metrics
309
+ - **Messages**: For debugging
310
+ - **Text**: Simple results for chaining
311
+
312
+ ## 🤝 Community & Support
313
+
314
+ - 📖 [Documentation](https://github.com/johnlindquist/n8n-nodes-claudecode)
315
+ - 🐛 [Report Issues](https://github.com/johnlindquist/n8n-nodes-claudecode/issues)
316
+ - 💬 [Discussions](https://github.com/johnlindquist/n8n-nodes-claudecode/discussions)
317
+ - 🌟 [Star on GitHub](https://github.com/johnlindquist/n8n-nodes-claudecode)
318
+
319
+ ## 📈 What's Next?
320
+
321
+ We're constantly improving! Upcoming features:
322
+ - Visual workflow builder for Claude Code operations
323
+ - Pre-built workflow templates
324
+ - Enhanced debugging tools
325
+ - More MCP server integrations
326
+
327
+ ## 🔄 Development & Contributing
328
+
329
+ ### Commit Conventions
330
+
331
+ This project uses [Conventional Commits](https://www.conventionalcommits.org/) and automated semantic versioning:
332
+
333
+ - `feat:` New features (minor version bump)
334
+ - `fix:` Bug fixes (patch version bump)
335
+ - `docs:` Documentation changes
336
+ - `chore:` Maintenance tasks
337
+ - `test:` Adding or updating tests
338
+
339
+ Use `npm run commit` for an interactive commit message builder.
340
+
341
+ ### Release Process
342
+
343
+ Releases are **fully automated** using semantic-release:
344
+ 1. Push commits to `main` branch
345
+ 2. CI analyzes commit messages
346
+ 3. Version is automatically bumped based on commit types
347
+ 4. Package is published to npm
348
+ 5. GitHub release is created with changelog
349
+
350
+ No manual version management required!
351
+
352
+ ## 📄 License
353
+
354
+ MIT - Build amazing things!
355
+
356
+ ---
357
+
358
+ **Ready to revolutionize your development workflow?** Install Claude Code for n8n today and join the future of automated software development!
359
+
360
+ Originally created by [Adam Holt](https://github.com/holt-web-ai) - [Original Repository](https://github.com/holt-web-ai/n8n-nodes-claudecode)
361
+
362
+ Forked and maintained by [John Lindquist](https://github.com/johnlindquist)
@@ -0,0 +1,7 @@
1
+ import type { ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class AnthropicApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AnthropicApi = void 0;
4
+ class AnthropicApi {
5
+ constructor() {
6
+ this.name = 'anthropicApi';
7
+ this.displayName = 'Anthropic API';
8
+ this.documentationUrl = 'https://docs.anthropic.com/en/api/getting-started';
9
+ this.properties = [
10
+ {
11
+ displayName: 'API Key',
12
+ name: 'apiKey',
13
+ type: 'string',
14
+ typeOptions: {
15
+ password: true,
16
+ },
17
+ default: '',
18
+ required: true,
19
+ },
20
+ ];
21
+ }
22
+ }
23
+ exports.AnthropicApi = AnthropicApi;
24
+ //# sourceMappingURL=AnthropicApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnthropicApi.credentials.js","sourceRoot":"","sources":["../../credentials/AnthropicApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,YAAY;IAAzB;QACC,SAAI,GAAG,cAAc,CAAC;QACtB,gBAAW,GAAG,eAAe,CAAC;QAC9B,qBAAgB,GAAG,mDAAmD,CAAC;QAEvE,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACd;SACD,CAAC;IACH,CAAC;CAAA;AAjBD,oCAiBC"}
@@ -0,0 +1,5 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class ClaudeCode implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }