Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/fix-workflow-tool-display.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"kilo-code": patch


Fix workflow tool display bug - always send tool message to webview even when auto-execute is enabled


When AUTO_EXECUTE_WORKFLOW experiment is enabled, the workflow tool message was created in the backend but never sent to the webview. This caused the workflow UI to not appear. The fix ensures that the tool message is always sent to the webview via task.ask() regardless of the auto-execute setting, so users can see what workflow is being executed.
7 changes: 7 additions & 0 deletions .changeset/fix-workflow-translation-key.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"kilo-code": patch
---

Fix translation key mismatch for workflow access experimental setting

Changed translation key from RUN_SLASH_COMMAND to AUTO_EXECUTE_WORKFLOW to match the experiment constant. Updated name from "Enable model-initiated slash commands" to "Enable workflow access" and description to better reflect the feature's actual behavior of accessing workflow content without approval.
5 changes: 5 additions & 0 deletions .changeset/remove-workflow-discovery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---

Remove WORKFLOW_DISCOVERY experiment and consolidate to AUTO_EXECUTE_WORKFLOW
5 changes: 5 additions & 0 deletions .changeset/workflow-auto-experiment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---

Separate workflow discovery from auto-execution. Workflow discovery is now always available, while auto-execution without approval is controlled by the `autoExecuteWorkflow` experiment flag.
5 changes: 5 additions & 0 deletions .changeset/workflow-discovery-feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": minor
---

Add automatic workflow discovery feature for Kilo agent to discover available workflows from global and workspace directories without manual directory exploration.
5 changes: 5 additions & 0 deletions .changeset/workflow-execution-tool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---

Implement workflow execution tool for Kilo Code. Added workflow discovery service in `.kilocode/workflows/`, adapted RunSlashCommandTool to use workflows instead of commands, and created sample workflows for common tasks.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

#
.pnpm-store
dist
out
Expand Down Expand Up @@ -29,6 +31,9 @@ docs/_site/
.env.*
!.env.*.sample

# venv
env/

# Logging
logs
*.log
Expand Down
28 changes: 24 additions & 4 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Add node_modules/.bin to PATH for local binaries
# Use git to find the repository root reliably
# Use git to find repository root reliably
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo "$(dirname -- "$0")/../..")"
if [ -d "$REPO_ROOT/node_modules/.bin" ]; then
export PATH="$REPO_ROOT/node_modules/.bin:$PATH"
fi

# kilocode_change - optimized pre-push hook with memory limits and timeout

branch="$(git rev-parse --abbrev-ref HEAD)"

if [ "$branch" = "main" ]; then
echo "You can't push directly to main - please check out a branch."
exit 1
fi

# Set memory limits to prevent excessive resource usage
export NODE_OPTIONS="--max-old-space-size=3072 --max-semi-space-size=256"

# Detect if running on Windows and use pnpm.cmd, otherwise use pnpm.
if [ "$OS" = "Windows_NT" ]; then
pnpm_cmd="pnpm.cmd"
Expand All @@ -24,18 +31,31 @@ else
fi
fi

$pnpm_cmd run check-types
# Add timeout to prevent infinite hanging (5 minutes)
echo "πŸ” Running optimized type checks..."
timeout 300 $pnpm_cmd run check-types || {
echo "❌ Type check timed out or failed"
exit 1
}

# Use dotenvx to securely load .env.local and run commands that depend on it
if [ -f ".env.local" ]; then
# Check if RUN_TESTS_ON_PUSH is set to true and run tests with dotenvx
if npx dotenvx get RUN_TESTS_ON_PUSH -f .env.local 2>/dev/null | grep -q "^true$"; then
npx dotenvx run -f .env.local -- $pnpm_cmd run test
echo "πŸ§ͺ Running tests with optimized settings..."
timeout 600 npx dotenvx run -f .env.local -- $pnpm_cmd run test || {
echo "❌ Tests timed out or failed"
exit 1
}
fi
else
# Fallback: run tests if RUN_TESTS_ON_PUSH is set in regular environment
if [ "$RUN_TESTS_ON_PUSH" = "true" ]; then
$pnpm_cmd run test
echo "πŸ§ͺ Running tests with optimized settings..."
timeout 600 $pnpm_cmd run test || {
echo "❌ Tests timed out or failed"
exit 1
}
fi
fi

Expand Down
762 changes: 724 additions & 38 deletions .kilocodemodes

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/types/src/experiment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const experimentIds = [
"multiFileApplyDiff",
"preventFocusDisruption",
"imageGeneration",
"runSlashCommand",
"autoExecuteWorkflow",
"multipleNativeToolCalls",
"customTools",
] as const
Expand All @@ -32,7 +32,7 @@ export const experimentsSchema = z.object({
multiFileApplyDiff: z.boolean().optional(),
preventFocusDisruption: z.boolean().optional(),
imageGeneration: z.boolean().optional(),
runSlashCommand: z.boolean().optional(),
autoExecuteWorkflow: z.boolean().optional(),
multipleNativeToolCalls: z.boolean().optional(),
customTools: z.boolean().optional(),
})
Expand Down
30 changes: 29 additions & 1 deletion src/core/environment/getEnvironmentDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ import { getGitStatus } from "../../utils/git"

import { Task } from "../task/Task"
import { formatReminderSection } from "./reminder"
// kilocode_change start
import { getWorkflowsForEnvironment } from "../workflow-discovery/getWorkflowsForEnvironment"
import { refreshWorkflowToggles } from "../context/instructions/workflows"
// kilocode_change end

// kilocode_change start
import { OpenRouterHandler } from "../../api/providers/openrouter"
Expand Down Expand Up @@ -381,5 +385,29 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo
? state.apiConfiguration.todoListEnabled
: true
const reminderSection = todoListEnabled ? formatReminderSection(cline.todoList) : ""
return `<environment_details>\n${details.trim()}\n${reminderSection}\n</environment_details>`

// kilocode_change start
// Add workflow discovery information if experiment is enabled
let localWorkflowToggles: Record<string, boolean> = {}
let globalWorkflowToggles: Record<string, boolean> = {}

if (clineProvider?.context) {
const toggles = await refreshWorkflowToggles(clineProvider.context, cline.cwd)
localWorkflowToggles = toggles.localWorkflowToggles
globalWorkflowToggles = toggles.globalWorkflowToggles
}
// kilocode_change end

const enabledWorkflows = new Map<string, boolean>()
Object.entries(localWorkflowToggles || {}).forEach(([path, enabled]) => {
enabledWorkflows.set(path, enabled)
})
Object.entries(globalWorkflowToggles || {}).forEach(([path, enabled]) => {
enabledWorkflows.set(path, enabled)
})

const workflowSection = await getWorkflowsForEnvironment(cline.cwd, experiments, enabledWorkflows)
// kilocode_change end

return `<environment_details>\n${details.trim()}\n${reminderSection}\n${workflowSection}\n</environment_details>`
}
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ describe("filterNativeToolsForMode", () => {
toolsWithSlashCommand,
"code",
[codeMode],
{ runSlashCommand: false },
{ autoExecuteWorkflow: false },
undefined,
{},
undefined,
Expand Down
4 changes: 2 additions & 2 deletions src/core/prompts/tools/filter-tools-for-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export function filterNativeToolsForMode(
}

// Conditionally exclude run_slash_command if experiment is not enabled
if (!experiments?.runSlashCommand) {
if (!experiments?.autoExecuteWorkflow) {
allowedToolNames.delete("run_slash_command")
}

Expand Down Expand Up @@ -415,7 +415,7 @@ export function isToolAllowedInMode(
return experiments?.imageGeneration === true
}
if (toolName === "run_slash_command") {
return experiments?.runSlashCommand === true
return experiments?.autoExecuteWorkflow === true
}
return true
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/prompts/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export function getToolDescriptionsForMode(
}

// Conditionally exclude run_slash_command if experiment is not enabled
if (!experiments?.runSlashCommand) {
if (!experiments?.autoExecuteWorkflow) {
tools.delete("run_slash_command")
}

Expand Down
8 changes: 5 additions & 3 deletions src/core/prompts/tools/native-tools/run_slash_command.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// kilocode_change start
import type OpenAI from "openai"

const RUN_SLASH_COMMAND_DESCRIPTION = `Execute a slash command to get specific instructions or content. Slash commands are predefined templates that provide detailed guidance for common tasks.`
const RUN_SLASH_COMMAND_DESCRIPTION = `Execute a workflow to get specific instructions or content. Workflows are predefined templates stored in .kilocode/workflows/ that provide detailed guidance for common tasks. Always shows workflow content; requires user approval unless auto-execute experiment is enabled.`

const COMMAND_PARAMETER_DESCRIPTION = `Name of the slash command to run (e.g., init, test, deploy)`
const COMMAND_PARAMETER_DESCRIPTION = `Name of the workflow to execute (without .md extension)`

const ARGS_PARAMETER_DESCRIPTION = `Optional additional context or arguments for the command`
const ARGS_PARAMETER_DESCRIPTION = `Optional additional arguments or context to pass to the workflow`
// kilocode_change end

export default {
type: "function",
Expand Down
Loading