Skip to content

Commit fdfd4f1

Browse files
committed
feat(dotagent): initial public release
0 parents  commit fdfd4f1

18 files changed

Lines changed: 1262 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Neovim
16+
uses: rhysd/action-setup-vim@v1
17+
with:
18+
neovim: stable
19+
20+
- name: Setup Node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "22"
24+
25+
- name: Install markdownlint-cli2
26+
run: npm install --global markdownlint-cli2
27+
28+
- name: Run headless tests
29+
run: nvim --headless -u NONE "+lua dofile(\"tests/run.lua\")" +qa!
30+
31+
- name: Run health smoke test
32+
run: |
33+
nvim --headless -u NONE "+set rtp+=$GITHUB_WORKSPACE" \
34+
"+lua require('dotagent').setup({ activation = { mode = 'manual' }, sources = { { type = 'items', items = {} } } })" \
35+
"+lua require('dotagent.completion.blink').provider()" \
36+
"+checkhealth dotagent" +qa!
37+
38+
- name: Lint README
39+
run: markdownlint-cli2 README.md

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
doc/tags

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Brian Le
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# dotagent.nvim
2+
3+
`dotagent.nvim` provides `$`-prefixed completion for local agent commands and skills inside Neovim.
4+
5+
It is intentionally conservative by default. The plugin stays off in normal editing buffers unless you explicitly attach it or launch Neovim through an external-editor flow marked with `DOTAGENT_EDITOR_PROMPT=1`.
6+
7+
## Requirements
8+
9+
- Neovim 0.10+
10+
- `saghen/blink.cmp`
11+
12+
## Release Status
13+
14+
The current recommended first public tag is `v0.1.0`.
15+
16+
The plugin uses git tags for releases. There is no separate version file in the repo.
17+
18+
## Features
19+
20+
- Scans local command markdown files and skill directories
21+
- Provides a Blink source for `$command` and `$skill` completion
22+
- Auto-attaches only when the editor session is launched with `DOTAGENT_EDITOR_PROMPT=1`
23+
- Supports manual `:DotagentAttach` and `:DotagentDetach`
24+
- Includes `:DotagentRefresh`, `:DotagentBrowse`, and `:DotagentHealth`
25+
26+
## Install
27+
28+
Lazy example:
29+
30+
```lua
31+
{
32+
"0xble/dotagent.nvim",
33+
config = function()
34+
require("dotagent").setup({
35+
sources = {
36+
{
37+
type = "commands",
38+
path = vim.fn.expand("~/dotfiles/dot_agent/commands"),
39+
},
40+
{
41+
type = "skills",
42+
path = vim.fn.expand("~/dotfiles/dot_agent/skills"),
43+
},
44+
},
45+
})
46+
end,
47+
}
48+
```
49+
50+
Blink setup:
51+
52+
```lua
53+
{
54+
"saghen/blink.cmp",
55+
opts = function(_, opts)
56+
opts.sources = opts.sources or {}
57+
opts.sources.default = function()
58+
local sources = { "lsp", "path", "snippets" }
59+
if require("dotagent").is_buffer_enabled(0) then
60+
table.insert(sources, 1, "dotagent")
61+
elseif vim.bo.filetype ~= "" and vim.bo.filetype ~= "markdown" and vim.bo.filetype ~= "text" and vim.bo.filetype ~= "gitcommit" then
62+
table.insert(sources, "buffer")
63+
end
64+
return sources
65+
end
66+
67+
opts.sources.providers = opts.sources.providers or {}
68+
opts.sources.providers.dotagent = require("dotagent.completion.blink").provider()
69+
end,
70+
}
71+
```
72+
73+
## Recommended Integration
74+
75+
The best integration is an external-editor flow where Claude Code or a Codex launcher opens Neovim for prompt composition.
76+
77+
Use one shared launcher for those flows:
78+
79+
```sh
80+
#!/bin/sh
81+
export DOTAGENT_EDITOR_PROMPT=1
82+
exec nvim "$@"
83+
```
84+
85+
Then point your agent surface at that launcher:
86+
87+
- Claude Code: configure its external editor, then use `Ctrl+G`
88+
- Codex or an editor-backed wrapper like `ai`: set `EDITOR` to the same launcher
89+
90+
When Neovim starts with `DOTAGENT_EDITOR_PROMPT=1`, `dotagent.nvim` attaches only to the initial prompt buffer. Additional buffers opened later in that session stay unaffected.
91+
92+
## Default Behavior
93+
94+
Without `DOTAGENT_EDITOR_PROMPT=1`, the plugin does not auto-attach in regular buffers.
95+
96+
The fallback path is manual:
97+
98+
- `:DotagentAttach`
99+
- `:DotagentDetach`
100+
101+
That keeps `$` completion out of normal code editing by default.
102+
103+
## Commands
104+
105+
- `:DotagentAttach [bufnr]`
106+
- `:DotagentDetach [bufnr]`
107+
- `:DotagentRefresh`
108+
- `:DotagentBrowse`
109+
- `:DotagentHealth`
110+
111+
## Configuration
112+
113+
```lua
114+
require("dotagent").setup({
115+
prefixes = { "$" },
116+
activation = {
117+
mode = "contextual",
118+
env_var = "DOTAGENT_EDITOR_PROMPT",
119+
},
120+
sources = {
121+
{
122+
type = "commands",
123+
path = vim.fn.expand("~/dotfiles/dot_agent/commands"),
124+
},
125+
{
126+
type = "skills",
127+
path = vim.fn.expand("~/dotfiles/dot_agent/skills"),
128+
},
129+
{
130+
type = "items",
131+
items = {
132+
{
133+
name = "ship",
134+
kind = "command",
135+
description = "Example Lua-defined item",
136+
},
137+
},
138+
},
139+
},
140+
})
141+
```
142+
143+
`activation.mode` values:
144+
145+
- `"contextual"`: attach only when launched with the editor prompt env marker
146+
- `"manual"`: never auto-attach
147+
- `"global"`: enable in every non-terminal buffer

doc/dotagent.txt

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
*dotagent.nvim* $-prefixed local agent completion
2+
3+
INTRODUCTION *dotagent-intro*
4+
5+
dotagent.nvim indexes local command markdown files and skill directories and
6+
exposes them as a Blink completion source.
7+
8+
The plugin is conservative by default. It only auto-attaches when Neovim is
9+
started with DOTAGENT_EDITOR_PROMPT=1. Otherwise use |:DotagentAttach|.
10+
11+
SETUP *dotagent-setup*
12+
13+
>
14+
require("dotagent").setup({
15+
activation = {
16+
mode = "contextual",
17+
env_var = "DOTAGENT_EDITOR_PROMPT",
18+
},
19+
sources = {
20+
{
21+
type = "commands",
22+
path = vim.fn.expand("~/dotfiles/dot_agent/commands"),
23+
},
24+
{
25+
type = "skills",
26+
path = vim.fn.expand("~/dotfiles/dot_agent/skills"),
27+
},
28+
},
29+
})
30+
<
31+
32+
Blink provider:
33+
34+
>
35+
opts.sources.providers.dotagent = require("dotagent.completion.blink").provider()
36+
<
37+
38+
RECOMMENDED INTEGRATION *dotagent-integration*
39+
40+
Use one external-editor launcher for Claude Code, Codex wrappers, or any other
41+
editor-backed agent surface:
42+
43+
>
44+
#!/bin/sh
45+
export DOTAGENT_EDITOR_PROMPT=1
46+
exec nvim "$@"
47+
<
48+
49+
Then point the agent tool at that launcher.
50+
51+
Claude Code already has an external editor flow reachable with Ctrl+G.
52+
Editor-backed Codex launchers should use the same launcher through EDITOR.
53+
54+
COMMANDS *dotagent-cmds*
55+
56+
:DotagentAttach [bufnr]
57+
Attach dotagent.nvim to the current buffer or the given buffer.
58+
59+
:DotagentDetach [bufnr]
60+
Detach dotagent.nvim from the current buffer or the given buffer.
61+
62+
:DotagentRefresh
63+
Rebuild the indexed command and skill list.
64+
65+
:DotagentBrowse
66+
Show indexed items with vim.ui.select and insert the chosen token.
67+
68+
:DotagentHealth
69+
Run |:checkhealth| for dotagent.nvim.
70+
71+
CONFIGURATION *dotagent-config*
72+
73+
prefixes~
74+
List of valid command prefixes. Default: ["$"]
75+
76+
activation.mode~
77+
"contextual", "manual", or "global"
78+
79+
activation.env_var~
80+
Default: "DOTAGENT_EDITOR_PROMPT"
81+
82+
sources~
83+
List of source definitions:
84+
- { type = "commands", path = "..." }
85+
- { type = "skills", path = "..." }
86+
- { type = "items", items = { ... } }
87+
88+
vim:tw=78:ts=8:noet:ft=help:norl:

lua/dotagent/action/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
return {}

0 commit comments

Comments
 (0)