Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6837bab
wip: start to split out tools
olimorris Feb 20, 2025
5b7d163
wip: rename `tools.init` to `agents.init`
olimorris Feb 20, 2025
26af6f6
wip: add back other agent tests
olimorris Feb 20, 2025
b4e9d7e
wip: move test files
olimorris Feb 20, 2025
6ed6967
Merge branch 'main' into refactor/tools
olimorris Feb 20, 2025
a989a5b
wip: update tests
olimorris Feb 20, 2025
48c67bb
wip: on_exit only called once + more test cases
olimorris Feb 21, 2025
3a26555
wip: add test for stdout
olimorris Feb 21, 2025
df7f43b
wip: update tests
olimorris Feb 21, 2025
ebb418a
wip: add `handlers.setup` test
olimorris Feb 21, 2025
f22993c
wip: update docs
olimorris Feb 21, 2025
3dfee68
wip: update doc
olimorris Feb 21, 2025
02fbee1
wip: re-enable tests
olimorris Feb 21, 2025
3cdbe96
wip: add tests for editor
olimorris Feb 22, 2025
80a72f3
wip: update func
olimorris Feb 22, 2025
52f786c
wip: first pass at new commands
olimorris Feb 23, 2025
067af01
wip: cleanup comments
olimorris Feb 23, 2025
92075b1
wip: add tests for commands
olimorris Feb 23, 2025
fac277f
wip: add more tests and clean up flow
olimorris Feb 24, 2025
8d8dde0
wip: can call multiple commands
olimorris Feb 24, 2025
5a9f563
wip: add more test coverage
olimorris Feb 24, 2025
905eee3
wip: remove unused method
olimorris Feb 25, 2025
919592a
wip: add integration test
olimorris Feb 25, 2025
3d8fcb5
Merge branch 'main' into refactor/tools
olimorris Feb 25, 2025
c246689
wip: update test names
olimorris Feb 25, 2025
ed04276
wip: update test names
olimorris Feb 25, 2025
c65f88f
wip: finalize queue implementation
olimorris Mar 1, 2025
72640d7
wip: start adding back user approvals
olimorris Mar 2, 2025
bead0fd
wip: add back human approval
olimorris Mar 2, 2025
e0b127c
wip: fix stylua
olimorris Mar 2, 2025
b6a0b47
wip: update readme
olimorris Mar 2, 2025
0de1aed
wip: add back autocmds
olimorris Mar 2, 2025
93894fa
wip: approval prompt updates
olimorris Mar 3, 2025
7355ff1
wip: add custom prompts
olimorris Mar 3, 2025
215667a
wip: update docs
olimorris Mar 3, 2025
17ab6fb
wip: breaking config changes
olimorris Mar 3, 2025
cb4b7f4
update docs
olimorris Mar 3, 2025
f06940e
wip: remove mocks
olimorris Mar 3, 2025
efbcdd1
wip: add events for agent
olimorris Mar 4, 2025
0394b72
wip: fix groups
olimorris Mar 4, 2025
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,7 @@ buffer
- [Aerial.nvim](https://github.com/stevearc/aerial.nvim) for the Tree-sitter parsing which inspired the symbols Slash
Command
- [Saghen](https://github.com/Saghen) for the fantastic docs inspiration from [blink.cmp](https://github.com/Saghen/blink.cmp)
- [Catwell](https://github.com/catwell) for the [queue](https://github.com/catwell/cw-lua/blob/master/deque/deque.lua)
inspiration that I use to stack agents and tools

<!-- panvimdoc-ignore-end -->
36 changes: 36 additions & 0 deletions codecompanion-workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,42 @@
"url": "https://raw.githubusercontent.com/olimorris/codecompanion.nvim/refs/heads/main/lua/codecompanion/strategies/inline/init.lua"
}
]
},
{
"name": "Tools",
"system_prompt": "In the CodeCompanion plugin, tools can be leveraged by an LLM to execute lua functions or shell commands on the users machine. By responding with XML, CodeCompanion will pass the response, call the corresponding tool. This feature has been implemented via the agent/init.lua file, which passes all of the tools and adds them to a queue. Then those tools are run consecutively by the executor/init.lua file.",
"opts": {
"remove_config_system_prompt": true
},
"vars": {
"base_dir": "lua/codecompanion/strategies/chat/agents"
},
"files": [
{
"description": "This is the entry point for the agent. If XML is detected in an LLM's response then this file is triggered which in turns add tools to a queue before calling the executor",
"path": "${base_dir}/init.lua"
},
{
"description": "The executor file then runs the tools in the queue, whether they're functions or commands:",
"path": "${base_dir}/executor/init.lua"
},
{
"description": "This is how function tools are run:",
"path": "${base_dir}/executor/func.lua"
},
{
"description": "This is how command tools are run:",
"path": "${base_dir}/executor/cmd.lua"
},
{
"description": "This is the queue implementation",
"path": "${base_dir}/executor/queue.lua"
},
{
"description": "This is how the queue object can look. This is an example of a function tool, a command tool, followed by a function tool:",
"path": "tests/stubs/queue.txt"
}
]
}
]
}
199 changes: 105 additions & 94 deletions doc/.vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineConfig } from "vitepress";
import { execSync } from "node:child_process";
import { withMermaid } from "vitepress-plugin-mermaid";

const inProd = process.env.NODE_ENV === "production";

Expand Down Expand Up @@ -28,103 +29,113 @@ const headers = inProd ? [baseHeaders, umamiScript] : baseHeaders;
const siteUrl = "https://codecompanion.olimorris.dev";

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "CodeCompanion",
description: "AI-powered coding, seamlessly in Neovim",
head: headers,
sitemap: { hostname: siteUrl },
themeConfig: {
logo: "https://github.com/user-attachments/assets/825fc040-9bc8-4743-be2a-71e257f8a7be",
nav: [
{
text: `${version}`,
items: [
{
text: "Changelog",
link: "https://github.com/olimorris/codecompanion.nvim/blob/main/CHANGELOG.md",
},
{
text: "Contributing",
link: "https://github.com/olimorris/codecompanion.nvim/blob/main/.github/contributing.md",
},
],
},
],
export default withMermaid(
defineConfig({
mermaid: {
securityLevel: "loose", // Allows more flexibility
theme: "base", // Use base theme to allow CSS variables to take effect
},
// optionally set additional config for plugin itself with MermaidPluginConfig
title: "CodeCompanion",
description: "AI-powered coding, seamlessly in Neovim",
head: headers,
sitemap: { hostname: siteUrl },
themeConfig: {
logo: "https://github.com/user-attachments/assets/825fc040-9bc8-4743-be2a-71e257f8a7be",
nav: [
{
text: `${version}`,
items: [
{
text: "Changelog",
link: "https://github.com/olimorris/codecompanion.nvim/blob/main/CHANGELOG.md",
},
{
text: "Contributing",
link: "https://github.com/olimorris/codecompanion.nvim/blob/main/.github/contributing.md",
},
],
},
],

sidebar: [
{ text: "Introduction", link: "/" },
{ text: "Installation", link: "/installation" },
{ text: "Getting Started", link: "/getting-started" },
{
text: "Configuration",
collapsed: true,
items: [
{ text: "Introduction", link: "/configuration/introduction" },
{ text: "Action Palette", link: "/configuration/action-palette" },
{ text: "Adapters", link: "/configuration/adapters" },
{ text: "Chat Buffer", link: "/configuration/chat-buffer" },
{ text: "Inline Assistant", link: "/configuration/inline-assistant" },
{ text: "Prompt Library", link: "/configuration/prompt-library" },
{ text: "System Prompt", link: "/configuration/system-prompt" },
{ text: "Others", link: "/configuration/others" },
],
},
{
text: "Usage",
collapsed: false,
items: [
{ text: "Introduction", link: "/usage/introduction" },
{ text: "Action Palette", link: "/usage/action-palette" },
{
text: "Chat Buffer",
link: "/usage/chat-buffer/",
collapsed: true,
items: [
{ text: "Agents/Tools", link: "/usage/chat-buffer/agents" },
{
text: "Slash Commands",
link: "/usage/chat-buffer/slash-commands",
},
{ text: "Variables", link: "/usage/chat-buffer/variables" },
],
},
{ text: "Events", link: "/usage/events" },
{ text: "Inline Assistant", link: "/usage/inline-assistant" },
{ text: "User Interface", link: "/usage/ui" },
{ text: "Workflows", link: "/usage/workflows" },
],
sidebar: [
{ text: "Introduction", link: "/" },
{ text: "Installation", link: "/installation" },
{ text: "Getting Started", link: "/getting-started" },
{
text: "Configuration",
collapsed: true,
items: [
{ text: "Introduction", link: "/configuration/introduction" },
{ text: "Action Palette", link: "/configuration/action-palette" },
{ text: "Adapters", link: "/configuration/adapters" },
{ text: "Chat Buffer", link: "/configuration/chat-buffer" },
{
text: "Inline Assistant",
link: "/configuration/inline-assistant",
},
{ text: "Prompt Library", link: "/configuration/prompt-library" },
{ text: "System Prompt", link: "/configuration/system-prompt" },
{ text: "Others", link: "/configuration/others" },
],
},
{
text: "Usage",
collapsed: false,
items: [
{ text: "Introduction", link: "/usage/introduction" },
{ text: "Action Palette", link: "/usage/action-palette" },
{
text: "Chat Buffer",
link: "/usage/chat-buffer/",
collapsed: true,
items: [
{ text: "Agents/Tools", link: "/usage/chat-buffer/agents" },
{
text: "Slash Commands",
link: "/usage/chat-buffer/slash-commands",
},
{ text: "Variables", link: "/usage/chat-buffer/variables" },
],
},
{ text: "Events", link: "/usage/events" },
{ text: "Inline Assistant", link: "/usage/inline-assistant" },
{ text: "User Interface", link: "/usage/ui" },
{ text: "Workflows", link: "/usage/workflows" },
],
},
{
text: "Extending the Plugin",
collapsed: false,
items: [
{ text: "Creating Adapters", link: "/extending/adapters" },
{ text: "Creating Prompts", link: "/extending/prompts" },
{ text: "Creating Tools", link: "/extending/tools" },
{ text: "Creating Workflows", link: "/extending/workflows" },
{ text: "Creating Workspaces", link: "/extending/workspace" },
],
},
],

editLink: {
pattern:
"https://github.com/olimorris/codecompanion.nvim/edit/main/doc/:path",
text: "Edit this page on GitHub",
},
{
text: "Extending the Plugin",
collapsed: false,
items: [
{ text: "Creating Adapters", link: "/extending/adapters" },
{ text: "Creating Prompts", link: "/extending/prompts" },
{ text: "Creating Tools", link: "/extending/tools" },
{ text: "Creating Workflows", link: "/extending/workflows" },
{ text: "Creating Workspaces", link: "/extending/workspace" },
],

footer: {
message: "Released under the MIT License.",
copyright: "Copyright © 2024-present Oli Morris",
},
],

editLink: {
pattern:
"https://github.com/olimorris/codecompanion.nvim/edit/main/doc/:path",
text: "Edit this page on GitHub",
},
socialLinks: [
{
icon: "github",
link: "https://github.com/olimorris/codecompanion.nvim",
},
],

footer: {
message: "Released under the MIT License.",
copyright: "Copyright © 2024-present Oli Morris",
search: { provider: "local" },
},

socialLinks: [
{
icon: "github",
link: "https://github.com/olimorris/codecompanion.nvim",
},
],

search: { provider: "local" },
},
});
}),
);
78 changes: 78 additions & 0 deletions doc/.vitepress/theme/vaporwave.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,81 @@
/* Override base background for dark mode */
--vw-base-bg-mixer: 20%;
}

/* Mermaid */
.mermaid * {
font-family: var(--vp-font-family-base) !important;
font-weight: var(--vp-font-weight-regular, 400) !important;
}

.mermaid .noteText,
.mermaid .loopText {
font-size: 0.9em !important;
}

.mermaid .note {
fill: color-mix(in srgb, var(--vw-purple) 40%, var(--vw-base-bg)) !important;
stroke: var(--vw-purple) !important;
}

.mermaid .actor {
fill: color-mix(in srgb, var(--vw-blue) 20%, var(--vw-base-bg)) !important;
stroke: var(--vw-blue) !important;
font-weight: var(--vp-font-weight-medium, 500) !important;
}

.mermaid text.actor > tspan {
fill: var(--vw-base-fg) !important;
stroke: none !important;
font-weight: var(--vp-font-weight-medium, 500) !important;
}

.mermaid .messageText {
fill: var(--vw-base-fg) !important;
stroke: none !important;
}

.mermaid .messageLine0,
.mermaid .messageLine1 {
stroke: var(--vw-green) !important;
}

.mermaid .sequenceNumber {
fill: var(--vw-base-bg) !important;
}

.mermaid .loopLine {
stroke: var(--vw-yellow) !important;
}

.mermaid .loopText > tspan {
fill: var(--vw-base-fg) !important;
stroke: none !important;
}

.mermaid .labelBox {
fill: color-mix(in srgb, var(--vw-yellow) 20%, var(--vw-base-bg)) !important;
stroke: var(--vw-yellow) !important;
}

.mermaid .labelText {
fill: var(--vw-base-fg) !important;
}

.mermaid line.divider {
stroke: var(--vw-purple) !important;
}

.mermaid .noteText > tspan {
fill: var(--vw-base-fg) !important;
stroke: none !important;
font-weight: var(--vp-font-weight-regular, 400) !important;
}

/* Adds styling for the activation boxes */
.mermaid .activation0,
.mermaid .activation1,
.mermaid .activation2 {
fill: color-mix(in srgb, var(--vw-green) 20%, var(--vw-base-bg)) !important;
stroke: var(--vw-green) !important;
}
Loading