darkfoo-code 0.1.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/LICENSE +21 -0
- package/README.md +132 -0
- package/bin/darkfoo.mjs +7 -0
- package/dist/chunk-4KTJEE4A.js +1023 -0
- package/dist/chunk-BT7IPQDS.js +19 -0
- package/dist/chunk-GQXUHUV4.js +171 -0
- package/dist/chunk-OBL22IIN.js +400 -0
- package/dist/chunk-VSJKCANO.js +117 -0
- package/dist/main.js +1740 -0
- package/dist/providers-P7Z3JXQH.js +24 -0
- package/dist/query-E6NPBSUX.js +7 -0
- package/dist/system-prompt-YJSDZVOM.js +6 -0
- package/dist/theme-BQAEFGVB.js +6 -0
- package/dist/tools-34S775OZ.js +22 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kenbark42
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Darkfoo Code
|
|
2
|
+
|
|
3
|
+
A local AI coding assistant CLI powered by Ollama. Built with TypeScript, React + Ink, and native Ollama tool calling.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Interactive REPL with streaming responses and Darkfoo-branded terminal UI
|
|
8
|
+
- Non-interactive mode (`-p`) for scripting
|
|
9
|
+
- 14 tools: Bash, Read, Write, Edit, Grep, Glob, WebFetch, Plan mode, Tasks, and more
|
|
10
|
+
- Slash commands: `/model`, `/clear`, `/compact`, `/cost`, `/context`, `/diff`, `/commit`, `/history`
|
|
11
|
+
- `!` bash mode for direct shell execution
|
|
12
|
+
- Arrow-key command history and slash command tab-completion
|
|
13
|
+
- Generator-based conversation loop with multi-turn tool use
|
|
14
|
+
- Plan mode for structured implementation planning
|
|
15
|
+
- Task tracking system (create, update, list tasks)
|
|
16
|
+
- Session persistence with auto-save and resume
|
|
17
|
+
- DARKFOO.md project context system (like CLAUDE.md)
|
|
18
|
+
- Permission system with settings storage
|
|
19
|
+
- Markdown rendering in terminal output
|
|
20
|
+
- Context window usage tracking and compaction
|
|
21
|
+
|
|
22
|
+
## Requirements
|
|
23
|
+
|
|
24
|
+
- Node.js 22+
|
|
25
|
+
- [Ollama](https://ollama.com) running locally
|
|
26
|
+
- A model with tool calling support (e.g. `llama3.1:8b`)
|
|
27
|
+
- ripgrep (`rg`) installed for Grep/Glob tools
|
|
28
|
+
|
|
29
|
+
## Setup
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install
|
|
33
|
+
ollama pull llama3.1:8b # or any tool-calling model
|
|
34
|
+
sudo dnf install ripgrep # Fedora — or your distro's equivalent
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Interactive REPL
|
|
41
|
+
npm run dev
|
|
42
|
+
|
|
43
|
+
# Single prompt
|
|
44
|
+
npm run dev -- -p "Read /etc/hostname"
|
|
45
|
+
|
|
46
|
+
# Global command (after npm link)
|
|
47
|
+
npm link
|
|
48
|
+
darkfoo
|
|
49
|
+
darkfoo -p "What files are in src/?"
|
|
50
|
+
darkfoo -m llama3.1:8b
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Slash Commands
|
|
54
|
+
|
|
55
|
+
| Command | Description |
|
|
56
|
+
|---------|-------------|
|
|
57
|
+
| `/help` | List available commands |
|
|
58
|
+
| `/model [name]` | List or switch Ollama models |
|
|
59
|
+
| `/clear` | Clear conversation history |
|
|
60
|
+
| `/compact` | Compress conversation to save context |
|
|
61
|
+
| `/cost` | Show token usage for session |
|
|
62
|
+
| `/context` | Show context window usage with visual bar |
|
|
63
|
+
| `/diff` | Show uncommitted git changes |
|
|
64
|
+
| `/commit [msg]` | Stage and commit with AI-generated message |
|
|
65
|
+
| `/history` | List saved sessions |
|
|
66
|
+
| `/resume <id>` | Resume a saved session |
|
|
67
|
+
| `/exit` | Exit Darkfoo Code |
|
|
68
|
+
|
|
69
|
+
Prefix with `!` to run shell commands directly (e.g. `!ls -la`, `!git status`).
|
|
70
|
+
|
|
71
|
+
## Tools
|
|
72
|
+
|
|
73
|
+
| Tool | Description |
|
|
74
|
+
|------|-------------|
|
|
75
|
+
| **Bash** | Execute shell commands with timeout and output limits |
|
|
76
|
+
| **Read** | Read files with line numbers, offset/limit support |
|
|
77
|
+
| **Write** | Write files, creating parent directories as needed |
|
|
78
|
+
| **Edit** | Find-and-replace with quote normalization and diff output |
|
|
79
|
+
| **Grep** | Search file contents via ripgrep (regex, glob filtering) |
|
|
80
|
+
| **Glob** | Find files by pattern via ripgrep |
|
|
81
|
+
| **WebFetch** | Fetch URLs and return text content |
|
|
82
|
+
| **EnterPlanMode** | Enter structured planning mode (read-only exploration) |
|
|
83
|
+
| **ExitPlanMode** | Submit plan for user approval |
|
|
84
|
+
| **TaskCreate** | Create a tracked task |
|
|
85
|
+
| **TaskUpdate** | Update task status (pending/in_progress/completed) |
|
|
86
|
+
| **TaskList** | List all tasks |
|
|
87
|
+
| **TaskGet** | Get task details |
|
|
88
|
+
| **AskUserQuestion** | Prompt user for clarification |
|
|
89
|
+
|
|
90
|
+
## Project Context (DARKFOO.md)
|
|
91
|
+
|
|
92
|
+
Place a `DARKFOO.md` file in your project root or `~/.darkfoo/DARKFOO.md` for global instructions. Rules can also go in `.darkfoo/rules/*.md`. These are automatically loaded into the system prompt.
|
|
93
|
+
|
|
94
|
+
## Session Persistence
|
|
95
|
+
|
|
96
|
+
Sessions auto-save to `~/.darkfoo/sessions/`. Use `/history` to browse and `/resume <id>` to continue a previous session.
|
|
97
|
+
|
|
98
|
+
## Project Structure
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
src/
|
|
102
|
+
main.tsx CLI entry (Commander.js)
|
|
103
|
+
app.tsx Ink app wrapper + context
|
|
104
|
+
repl.tsx Interactive REPL screen
|
|
105
|
+
query.ts Generator-based conversation loop
|
|
106
|
+
ollama.ts Ollama /api/chat streaming client
|
|
107
|
+
types.ts Core message and event types
|
|
108
|
+
system-prompt.ts System prompt builder + DARKFOO.md loader
|
|
109
|
+
state.ts App state (plan mode, tasks)
|
|
110
|
+
session.ts Session save/load/list
|
|
111
|
+
context-loader.ts DARKFOO.md discovery and loading
|
|
112
|
+
permissions.ts Permission system + settings
|
|
113
|
+
commands/ Slash command implementations
|
|
114
|
+
tools/ Tool implementations (14 tools)
|
|
115
|
+
components/ React + Ink UI components
|
|
116
|
+
utils/ Theme, formatting, markdown renderer
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Ollama Model Compatibility
|
|
120
|
+
|
|
121
|
+
Models must support Ollama's native tool calling. Tested and working:
|
|
122
|
+
|
|
123
|
+
- `llama3.1:8b` — recommended default, solid tool calling
|
|
124
|
+
- `llama3.2:3b` — works but limited reasoning at 3B
|
|
125
|
+
|
|
126
|
+
Models that do **not** support tool calling: `gemma2`, `phi4`, `deepseek-r1`, `gpt-oss`.
|
|
127
|
+
|
|
128
|
+
## Environment Variables
|
|
129
|
+
|
|
130
|
+
| Variable | Description | Default |
|
|
131
|
+
|----------|-------------|---------|
|
|
132
|
+
| `OLLAMA_HOST` | Ollama API base URL | `http://localhost:11434` |
|