n8n-nodes-claude-code-cli 1.5.0 → 1.6.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/dist/index.js CHANGED
@@ -174003,6 +174003,142 @@ var modelDescription = [
174003
174003
  }
174004
174004
  ];
174005
174005
 
174006
+ // nodes/ClaudeCode/descriptions/agentsDescription.ts
174007
+ var agentsDescription = [
174008
+ {
174009
+ displayName: "Subagents",
174010
+ name: "agents",
174011
+ type: "fixedCollection",
174012
+ typeOptions: {
174013
+ multipleValues: true,
174014
+ multipleValueButtonText: "Add Subagent"
174015
+ },
174016
+ default: { agentsList: [] },
174017
+ displayOptions: {
174018
+ show: {
174019
+ operation: ["executePrompt", "executeWithContext"]
174020
+ }
174021
+ },
174022
+ options: [
174023
+ {
174024
+ name: "agentsList",
174025
+ displayName: "Agents",
174026
+ values: [
174027
+ {
174028
+ displayName: "Agent Name",
174029
+ name: "name",
174030
+ type: "string",
174031
+ default: "",
174032
+ required: true,
174033
+ placeholder: "code-reviewer",
174034
+ description: "Unique identifier for this agent. Lowercase letters, numbers, and hyphens only (3-50 chars)."
174035
+ },
174036
+ {
174037
+ displayName: "Description",
174038
+ name: "description",
174039
+ type: "string",
174040
+ typeOptions: { rows: 2 },
174041
+ default: "",
174042
+ required: true,
174043
+ placeholder: "Expert code reviewer. Use proactively when code changes are made.",
174044
+ description: "When Claude should delegate to this agent."
174045
+ },
174046
+ {
174047
+ displayName: "System Prompt",
174048
+ name: "prompt",
174049
+ type: "string",
174050
+ typeOptions: { rows: 5 },
174051
+ default: "",
174052
+ required: true,
174053
+ placeholder: "You are a senior code reviewer. Focus on...",
174054
+ description: "System prompt governing this agent's behavior."
174055
+ },
174056
+ {
174057
+ displayName: "Model",
174058
+ name: "model",
174059
+ type: "options",
174060
+ options: [
174061
+ {
174062
+ name: "Inherit (Parent Model)",
174063
+ value: "inherit"
174064
+ },
174065
+ { name: "Sonnet", value: "sonnet" },
174066
+ { name: "Opus", value: "opus" },
174067
+ { name: "Haiku", value: "haiku" }
174068
+ ],
174069
+ default: "inherit",
174070
+ description: "Model to use for this agent."
174071
+ },
174072
+ {
174073
+ displayName: "Allowed Tools",
174074
+ name: "tools",
174075
+ type: "string",
174076
+ default: "",
174077
+ placeholder: "Read, Grep, Glob, Bash(git:*)",
174078
+ description: "Tools this agent can use (comma-separated). Leave empty to inherit all tools."
174079
+ },
174080
+ {
174081
+ displayName: "Disallowed Tools",
174082
+ name: "disallowedTools",
174083
+ type: "string",
174084
+ default: "",
174085
+ placeholder: "Write, Edit, Bash(rm:*)",
174086
+ description: "Tools this agent cannot use (comma-separated). Takes precedence over allowed tools."
174087
+ },
174088
+ {
174089
+ displayName: "Permission Mode",
174090
+ name: "permissionMode",
174091
+ type: "options",
174092
+ options: [
174093
+ { name: "Default", value: "" },
174094
+ { name: "Accept Edits", value: "acceptEdits" },
174095
+ { name: "Plan (Read-Only)", value: "plan" },
174096
+ { name: "Don't Ask", value: "dontAsk" },
174097
+ {
174098
+ name: "Bypass Permissions",
174099
+ value: "bypassPermissions"
174100
+ },
174101
+ { name: "Delegate", value: "delegate" }
174102
+ ],
174103
+ default: "",
174104
+ description: "Permission mode for this agent. Leave empty to use default."
174105
+ },
174106
+ {
174107
+ displayName: "Max Turns",
174108
+ name: "maxTurns",
174109
+ type: "number",
174110
+ default: 0,
174111
+ description: "Maximum agentic turns before stopping. 0 = unlimited."
174112
+ },
174113
+ {
174114
+ displayName: "Memory",
174115
+ name: "memory",
174116
+ type: "options",
174117
+ options: [
174118
+ { name: "None", value: "" },
174119
+ {
174120
+ name: "User (Cross-Project)",
174121
+ value: "user"
174122
+ },
174123
+ {
174124
+ name: "Project (Shareable)",
174125
+ value: "project"
174126
+ },
174127
+ {
174128
+ name: "Local (Not Committed)",
174129
+ value: "local"
174130
+ }
174131
+ ],
174132
+ default: "",
174133
+ description: "Memory persistence mode for this agent."
174134
+ }
174135
+ ]
174136
+ }
174137
+ ],
174138
+ description: "Define custom subagents that Claude can delegate to during execution. Useful for specialized workflows (reviewer, debugger, architect...)."
174139
+ }
174140
+ ];
174141
+
174006
174142
  // nodes/ClaudeCode/descriptions/optionsDescription.ts
174007
174143
  var optionsDescription = [
174008
174144
  {
@@ -174057,6 +174193,74 @@ var optionsDescription = [
174057
174193
  placeholder: "You are a helpful code reviewer...",
174058
174194
  description: "Additional system prompt to append to Claude Code default system prompt"
174059
174195
  },
174196
+ {
174197
+ displayName: "System Prompt File",
174198
+ name: "systemPromptFile",
174199
+ type: "string",
174200
+ default: "",
174201
+ placeholder: "/path/to/system-prompt.txt",
174202
+ description: "Path to a file containing additional system prompt text to append to Claude Code default system prompt. Use this instead of inline System Prompt for long or reusable prompts."
174203
+ },
174204
+ {
174205
+ displayName: "Verbose",
174206
+ name: "verbose",
174207
+ type: "boolean",
174208
+ default: false,
174209
+ description: "Enable verbose logging. Automatically enabled when Output Format is Stream JSON. Useful for debugging in JSON or Text output modes."
174210
+ },
174211
+ {
174212
+ displayName: "Max Budget (USD)",
174213
+ name: "maxBudgetUsd",
174214
+ type: "number",
174215
+ default: 0,
174216
+ description: "Maximum dollar amount to spend before stopping execution. 0 means unlimited. Critical for controlling costs in automated workflows."
174217
+ },
174218
+ {
174219
+ displayName: "JSON Schema",
174220
+ name: "jsonSchema",
174221
+ type: "string",
174222
+ typeOptions: {
174223
+ rows: 4
174224
+ },
174225
+ default: "",
174226
+ placeholder: '{"type":"object","properties":{"summary":{"type":"string"}}}',
174227
+ description: "JSON schema for validated structured output. Claude will return JSON matching this schema. Must be a valid JSON schema string."
174228
+ },
174229
+ {
174230
+ displayName: "Fallback Model",
174231
+ name: "fallbackModel",
174232
+ type: "string",
174233
+ default: "",
174234
+ placeholder: "claude-sonnet-4-20250514",
174235
+ description: "Fallback model to use when the primary model is overloaded or unavailable. Improves resilience in production workflows."
174236
+ },
174237
+ {
174238
+ displayName: "Extended Context (1M Tokens)",
174239
+ name: "extendedContext",
174240
+ type: "boolean",
174241
+ default: true,
174242
+ description: "Enable 1M token context window for analyzing very large codebases in a single pass. Only supported by Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, and Sonnet 4. Has no effect on other models."
174243
+ },
174244
+ {
174245
+ displayName: "Worktree Isolation",
174246
+ name: "worktreeEnabled",
174247
+ type: "boolean",
174248
+ default: false,
174249
+ description: "Run Claude Code in an isolated git worktree. Each execution works on a separate copy of the repository, preventing conflicts with the main workspace. The worktree is automatically cleaned up if no changes are made."
174250
+ },
174251
+ {
174252
+ displayName: "Worktree Name",
174253
+ name: "worktreeName",
174254
+ type: "string",
174255
+ default: "",
174256
+ placeholder: "feature-auth",
174257
+ description: "Optional name for the worktree. If empty, Claude Code auto-generates a unique name. The worktree is created at <repo>/.claude/worktrees/<name>/.",
174258
+ displayOptions: {
174259
+ show: {
174260
+ worktreeEnabled: [true]
174261
+ }
174262
+ }
174263
+ },
174060
174264
  {
174061
174265
  displayName: "Additional Arguments",
174062
174266
  name: "additionalArgs",
@@ -174110,6 +174314,28 @@ function buildCommand(options, credentials) {
174110
174314
  if (options.systemPrompt) {
174111
174315
  args.push("--append-system-prompt", options.systemPrompt);
174112
174316
  }
174317
+ if (options.systemPromptFile) {
174318
+ args.push("--append-system-prompt-file", options.systemPromptFile);
174319
+ }
174320
+ if (options.verbose && options.outputFormat !== "stream-json") {
174321
+ args.push("--verbose");
174322
+ }
174323
+ if (options.maxBudgetUsd && options.maxBudgetUsd > 0) {
174324
+ args.push("--max-budget-usd", String(options.maxBudgetUsd));
174325
+ }
174326
+ if (options.jsonSchema) {
174327
+ args.push("--json-schema", options.jsonSchema);
174328
+ }
174329
+ if (options.fallbackModel) {
174330
+ args.push("--fallback-model", options.fallbackModel);
174331
+ }
174332
+ if (options.worktree !== void 0) {
174333
+ if (options.worktree) {
174334
+ args.push("--worktree", options.worktree);
174335
+ } else {
174336
+ args.push("--worktree");
174337
+ }
174338
+ }
174113
174339
  if (options.contextFiles && options.contextFiles.length > 0) {
174114
174340
  const uniqueDirs = /* @__PURE__ */ new Set();
174115
174341
  options.contextFiles.forEach((file) => {
@@ -174122,9 +174348,15 @@ function buildCommand(options, credentials) {
174122
174348
  args.push("--add-dir", dir);
174123
174349
  });
174124
174350
  }
174351
+ if (options.agents && Object.keys(options.agents).length > 0) {
174352
+ args.push("--agents", JSON.stringify(options.agents));
174353
+ }
174125
174354
  if (options.additionalArgs && options.additionalArgs.length > 0) {
174126
174355
  args.push(...options.additionalArgs);
174127
174356
  }
174357
+ if (options.extendedContext === false) {
174358
+ env.CLAUDE_CODE_DISABLE_1M_CONTEXT = "1";
174359
+ }
174128
174360
  if ("envVars" in credentials && credentials.envVars) {
174129
174361
  const envVarsString = credentials.envVars;
174130
174362
  if (envVarsString && envVarsString !== "{}") {
@@ -174325,6 +174557,38 @@ function buildExecutionOptions(context, itemIndex, operation) {
174325
174557
  "default"
174326
174558
  );
174327
174559
  const permissionMode = permissionModeRaw && permissionModeRaw !== "default" ? permissionModeRaw : void 0;
174560
+ const agentsData = context.getNodeParameter("agents", itemIndex, {
174561
+ agentsList: []
174562
+ });
174563
+ let agents;
174564
+ if (agentsData.agentsList && agentsData.agentsList.length > 0) {
174565
+ agents = {};
174566
+ for (const agent of agentsData.agentsList) {
174567
+ const def = {
174568
+ description: agent.description,
174569
+ prompt: agent.prompt
174570
+ };
174571
+ if (agent.tools) {
174572
+ def.tools = agent.tools.split(",").map((t) => t.trim()).filter(Boolean);
174573
+ }
174574
+ if (agent.disallowedTools) {
174575
+ def.disallowedTools = agent.disallowedTools.split(",").map((t) => t.trim()).filter(Boolean);
174576
+ }
174577
+ if (agent.model && agent.model !== "inherit") {
174578
+ def.model = agent.model;
174579
+ }
174580
+ if (agent.permissionMode) {
174581
+ def.permissionMode = agent.permissionMode;
174582
+ }
174583
+ if (agent.maxTurns && agent.maxTurns > 0) {
174584
+ def.maxTurns = agent.maxTurns;
174585
+ }
174586
+ if (agent.memory) {
174587
+ def.memory = agent.memory;
174588
+ }
174589
+ agents[agent.name] = def;
174590
+ }
174591
+ }
174328
174592
  return {
174329
174593
  prompt,
174330
174594
  workingDirectory: options.workingDirectory,
@@ -174337,7 +174601,15 @@ function buildExecutionOptions(context, itemIndex, operation) {
174337
174601
  contextFiles,
174338
174602
  additionalArgs: additionalArgs.length > 0 ? additionalArgs : void 0,
174339
174603
  timeout: options.timeout || 300,
174340
- systemPrompt: options.systemPrompt || void 0
174604
+ systemPrompt: options.systemPrompt || void 0,
174605
+ systemPromptFile: options.systemPromptFile || void 0,
174606
+ verbose: options.verbose || void 0,
174607
+ maxBudgetUsd: options.maxBudgetUsd || void 0,
174608
+ jsonSchema: options.jsonSchema || void 0,
174609
+ fallbackModel: options.fallbackModel || void 0,
174610
+ agents,
174611
+ extendedContext: options.extendedContext !== false,
174612
+ worktree: options.worktreeEnabled ? options.worktreeName || "" : void 0
174341
174613
  };
174342
174614
  }
174343
174615
 
@@ -174949,6 +175221,12 @@ function buildEphemeralPodSpec(credentials, options, podName) {
174949
175221
  const claudeArgs = buildClaudeArgs(options);
174950
175222
  const envVars = buildEnvVars(credentials);
174951
175223
  const limits = buildResourceLimits(credentials);
175224
+ if (options.extendedContext === false) {
175225
+ envVars.push({
175226
+ name: "CLAUDE_CODE_DISABLE_1M_CONTEXT",
175227
+ value: "1"
175228
+ });
175229
+ }
174952
175230
  const credentialPrefix = buildCredentialInjectionPrefix(credentials);
174953
175231
  const container = credentialPrefix ? {
174954
175232
  name: "claude-code",
@@ -175081,6 +175359,9 @@ function buildClaudeArgs(options) {
175081
175359
  args.push("--add-dir", dir);
175082
175360
  });
175083
175361
  }
175362
+ if (options.agents && Object.keys(options.agents).length > 0) {
175363
+ args.push("--agents", JSON.stringify(options.agents));
175364
+ }
175084
175365
  if (options.additionalArgs && options.additionalArgs.length > 0) {
175085
175366
  args.push(...options.additionalArgs);
175086
175367
  }
@@ -175377,10 +175658,11 @@ var K8sPersistentExecutor = class {
175377
175658
  const claudePath = this.credentials.claudePath || "claude";
175378
175659
  const claudeArgs = buildClaudeArgs(options);
175379
175660
  const workDir = options.workingDirectory || this.credentials.defaultWorkingDir || "/workspace";
175661
+ const envPrefix = options.extendedContext === false ? "export CLAUDE_CODE_DISABLE_1M_CONTEXT=1 && " : "";
175380
175662
  const command = [
175381
175663
  "sh",
175382
175664
  "-c",
175383
- `cd ${workDir} && ${claudePath} ${claudeArgs.map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ")}`
175665
+ `${envPrefix}cd ${workDir} && ${claudePath} ${claudeArgs.map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ")}`
175384
175666
  ];
175385
175667
  return this.execInPod(clients, namespace, command).then(
175386
175668
  ({ stdout, stderr, exitCode }) => {
@@ -175525,6 +175807,8 @@ var ClaudeCode = class {
175525
175807
  ...toolPermissionsDescription,
175526
175808
  // Model selection
175527
175809
  ...modelDescription,
175810
+ // Custom subagents
175811
+ ...agentsDescription,
175528
175812
  // Additional options
175529
175813
  ...optionsDescription
175530
175814
  ]