You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scripts/minimal_init.lua ← headless Neovim init used by make test
22
23
CODE-STANDARDS.md ← authoritative coding standards and architecture
24
+
.agents/add-new-agent.md ← step-by-step plan for adding a new agent
25
+
.claude/skills/add-agent/ ← Claude Code skill that automates adding a new agent
23
26
```
24
27
25
28
## Key Entry Points
26
29
27
30
-**Feature work**: start in `lua/askCode/init.lua` — it orchestrates all modules
28
-
-**Adding an agent**: create `lua/askCode/agents/<name>.lua`, register in `agents/init.lua`
31
+
-**Adding an agent**: follow `.agents/add-new-agent.md`, or invoke the `/add-agent` Claude Code skill — create `lua/askCode/agents/<name>.lua`, register in `agents/init.lua`
29
32
-**Config changes**: `lua/askCode/config.lua` — update `M.default` and annotations
30
33
-**UI changes**: `lua/askCode/ui.lua` — `show_window` and `update_window`
31
34
-**Commands/keymaps**: `plugin/askCode.lua`
@@ -55,6 +58,7 @@ Then users set `agent = "myagent"` in their config.
55
58
-**Conversation history is a temp file**, not in-memory — `vim.fn.tempname()` path stored in `state.history_file`; full history is re-read and re-sent on every follow-up.
56
59
-**Config merging uses `"keep"` strategy** — `vim.tbl_deep_extend("keep", changes, current)` means user values win over defaults, not the other way around.
57
60
-**`opencode` agent uses a temp file for the prompt** — multiline prompts can't be safely passed via `shellescape` through `sh -c`; the agent writes the prompt to a temp file and uses `"$(cat <tmpfile>)"` in the command. It also requires `--format json` so the process exits cleanly.
61
+
-**`claude` agent uses a temp file for the prompt** — same rationale as opencode; the prompt is written to a temp file and passed to `claude -p "$(cat <tmpfile>)"`. The `-p` flag makes Claude CLI non-interactive and outputs plain text, so `parse_response` only trims whitespace with no JSON parsing.
58
62
59
63
## Repo-Specific Tools
60
64
@@ -82,6 +86,24 @@ Tests use `MiniTest.new_child_neovim()` — each test case restarts a fresh chil
82
86
-`vim.g.askcode_range` is set in `plugin/askCode.lua` for `AskCodeReplace` but never read — dead code.
83
87
-`debug` logging only covers `init.lua`; agents and ui emit no debug output.
84
88
89
+
## Adding a New Agent
90
+
91
+
Use the `/add-agent` Claude Code skill to add a new agent in one step:
92
+
93
+
```
94
+
/add-agent <agent_name> <cli_invocation>
95
+
```
96
+
97
+
Example:
98
+
99
+
```
100
+
/add-agent claude "claude -p"
101
+
```
102
+
103
+
The skill reads the full implementation plan from `.agents/add-new-agent.md` and executes all steps automatically: creates the agent module, registers it, updates docs, writes unit tests, and verifies with `make test`.
104
+
105
+
To add an agent manually without the skill, follow `.agents/add-new-agent.md` step by step.
Copy file name to clipboardExpand all lines: README.md
+25-8Lines changed: 25 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# AskCode.nvim
2
2
3
-
AskCode is a Neovim plugin that helps developers explore and understand codebases by connecting to CLI-based AI assistants like `gemini-cli`, `kiro-cli`, and `opencode`. It acts as your in-editor guide, letting you ask context-aware questions about selected code and receive answers without leaving Neovim.
3
+
AskCode is a Neovim plugin that helps developers explore and understand codebases by connecting to CLI-based AI assistants like `gemini-cli`, `kiro-cli`, `opencode`, and `claude`. It acts as your in-editor guide, letting you ask context-aware questions about selected code and receive answers without leaving Neovim.
vim.keymap.set("v", "<leader>ar", ":AskCodeReplace \"Refactor this code\"<CR>", { noremap=true, silent=true })
146
147
```
147
148
149
+
## Adding a New Agent
150
+
151
+
Use the `/add-agent` Claude Code skill to integrate any CLI-based AI assistant:
152
+
153
+
```
154
+
/add-agent <agent_name> <cli_invocation>
155
+
```
156
+
157
+
For example:
158
+
159
+
```
160
+
/add-agent myagent "myagent ask"
161
+
```
162
+
163
+
This skill creates the agent module, registers it, updates docs, and writes a full unit test suite — all verified by `make test`. See `.agents/add-new-agent.md` for the step-by-step plan if you prefer to do it manually.
164
+
148
165
## Development
149
166
150
167
Contributions are welcome! To get started with development:
@@ -179,7 +196,7 @@ The project uses `mini.nvim` for its testing framework. You can find more inform
179
196
## Todo
180
197
181
198
- [ ] **Support Prompt Templates**: Allow users to define custom prompt templates in the configuration.
182
-
- [] **Integrate Claude-Code Agent**: Add a new agent forClaudeCode by implementing the `prepare_command`functionfor its CLI.
199
+
- [x] **Integrate Claude Agent**: Add a new agent forClaude CLI using `claude -p` non-interactive mode.
183
200
- [ ] **Support Streaming JSON**: Improve the stream processor to parse chunked JSON responses for real-time display.
184
201
- [x] **Support Follow-up Questions**: Maintain conversation history to allow for follow-up questions.
185
202
- [x] **Integrate Kiro Agent**: Add a new agent for Kiro by implementing the `prepare_command`functionfor its CLI.
0 commit comments