Skip to content

Commit bbc1ed5

Browse files
merge upstream v0.1.20
2 parents f3554df + 55bb8b4 commit bbc1ed5

29 files changed

Lines changed: 272 additions & 91 deletions

.deepcode/AGENTS.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,23 @@ src/
88
├── session.ts # SessionManager — LLM loop, compaction, tool orchestration
99
├── settings.ts # Settings resolution from ~/.deepcode/settings.json
1010
├── prompt.ts # System prompt builder, tool definitions, agent-drift-guard skill
11-
├── model-capabilities.ts # Model detection and thinking-mode defaults
11+
├── common/
12+
│ ├── model-capabilities.ts # Model detection and thinking-mode defaults
13+
│ ├── file-utils.ts # File read/write with encoding and diff preview
14+
│ ├── shell-utils.ts # Shell path resolution (Git Bash, zsh, bash)
15+
│ ├── state.ts # In-memory file state and snippet tracking
16+
│ └── runtime.ts # Tool validation runtime helpers
1217
├── ui/
1318
│ ├── App.tsx # Root Ink component — state, routing, session orchestration
1419
│ ├── PromptInput.tsx # Multi-line input with slash commands, image paste, skills
1520
│ ├── MessageView.tsx # Renders assistant/tool messages with markdown
21+
│ ├── DropdownMenu.tsx # Reusable dropdown for skill/model selection
1622
│ ├── SessionList.tsx # Session picker for /resume
23+
│ ├── promptUndoRedo.ts # Ctrl+- undo / Ctrl+Shift+- redo for prompt input
1724
│ └── ...
1825
├── mcp/
1926
│ ├── mcp-client.ts # MCP client — JSON-RPC communication with MCP servers
2027
│ └── mcp-manager.ts # MCP manager — lifecycle, tool registration, execution
21-
├── common/
22-
│ ├── file-utils.ts # File read/write with encoding and diff preview
23-
│ ├── shell-utils.ts # Shell path resolution (Git Bash, zsh, bash)
24-
│ ├── state.ts # In-memory file state and snippet tracking
25-
│ └── runtime.ts # Tool validation runtime helpers (executeValidatedTool, semanticBoolean)
2628
├── tools/
2729
│ ├── executor.ts # ToolExecutor — dispatches tool calls to handlers
2830
│ ├── bash-handler.ts # Executes shell commands
@@ -32,9 +34,10 @@ src/
3234
│ ├── web-search-handler.ts # Web search tool
3335
│ └── ask-user-question-handler.ts # Interactive user prompts
3436
├── tests/ # Test suite — one *.test.ts per module
35-
docs/
37+
templates/
3638
├── tools/ # Tool descriptions fed to the LLM
3739
├── prompts/ # EJS templates (e.g., init_command.md.ejs)
40+
docs/ # User-facing documentation
3841
dist/ # Bundled CLI output (gitignored)
3942
```
4043

@@ -49,7 +52,7 @@ dist/ # Bundled CLI output (gitignored)
4952
| `npm run format:check` | Prettier in check-only mode |
5053
| `npm run check` | Runs typecheck + lint + format:check together |
5154
| `npm run bundle` | esbuild bundles `src/cli.tsx``dist/cli.js` (ESM, Node 18) |
52-
| `npm run build` | `check` + `bundle` — full CI gate before publish |
55+
| `npm run build` | `check` + `bundle` + chmod 755 — full CI gate before publish |
5356
| `npm test` | Runs all tests via `tsx --test src/tests/*.test.ts` |
5457
| `npm run test:single -- <file>` | Run a single test file (e.g., `npm run test:single -- src/tests/session.test.ts`) |
5558

@@ -87,7 +90,8 @@ Run the CLI locally for manual testing: `node dist/cli.js` (after `npm run bundl
8790
- `fix:` — bug fix (e.g., `fix(ui): redraw cleanly after terminal resize`)
8891
- `chore:` — tooling, deps, hooks (e.g., `chore: add husky + lint-staged`)
8992
- `refactor:` — code restructuring (e.g., `refactor(ui): optimize App hooks`)
90-
- `style:` — formatting-only changes
93+
- `style:` — formatting-only changes (e.g., `style: adjust the tree structure symbols`)
94+
- `docs:` — documentation (e.g., `docs: add MCP configuration guide`)
9195

9296
**Pull requests** should include:
9397
- A clear description of what changed and why
@@ -100,7 +104,7 @@ Run the CLI locally for manual testing: `node dist/cli.js` (after `npm run bundl
100104

101105
The CLI renders a terminal UI using [Ink](https://github.com/vadimdemedes/ink) (React for terminals). `SessionManager` drives the LLM interaction loop: it builds system prompts, sends user messages with optional skills/images, streams responses, executes tool calls via `ToolExecutor`, and compacts context when token thresholds are exceeded (512K for DeepSeek V4 models, 128K for others).
102106

103-
Six tools are available to the LLM: `bash`, `read`, `write`, `edit`, `AskUserQuestion`, and `WebSearch`. Tool definitions are registered in `src/tools/executor.ts` and described to the LLM via `src/prompt.ts` and `docs/tools/`.
107+
Six tools are available to the LLM: `bash`, `read`, `write`, `edit`, `AskUserQuestion`, and `WebSearch`. Tool definitions are registered in `src/tools/executor.ts` and described to the LLM via `src/prompt.ts` and `templates/tools/`.
104108

105109
## Agent-Specific Instructions
106110

.lintstagedrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"*.{ts,tsx,js,mjs,cjs,ejs,jsx}": [
2+
"*.{ts,tsx,js,mjs,cjs,jsx}": [
33
"eslint --fix",
44
"prettier --write"
55
],

AGENTS.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
5+
- `src/` contains the TypeScript CLI implementation, with tool handlers in `src/tools/`, MCP integration in `src/mcp/`, UI components in `src/ui/`, and shared helpers in `src/common/`.
6+
- `src/tests/` contains Node test files named `*.test.ts`.
7+
- `templates/` contains runtime prompt assets: `templates/prompts/` for EJS prompt templates and `templates/tools/` for tool instruction Markdown loaded into the system prompt.
8+
- `docs/` is reserved for user-facing documentation such as configuration and MCP guides.
9+
- `resources/` stores static images used by the documentation or UI.
10+
11+
## Build, Test, and Development Commands
12+
13+
- `npm test` runs all test files with `tsx --test`.
14+
- `npm run test:single -- src/tests/<name>.test.ts` runs one test file.
15+
- `npm run typecheck` verifies TypeScript types without emitting files.
16+
- `npm run lint` checks ESLint rules for `src/`.
17+
- `npm run build` runs checks, bundles `src/cli.tsx` to `dist/cli.js`, and marks the bundle executable.
18+
19+
## Coding Style & Naming Conventions
20+
21+
- Use TypeScript ES modules and keep imports explicit.
22+
- Prefer small, focused functions; keep filesystem path construction centralized when a path is reused.
23+
- Use two-space indentation and Prettier-compatible formatting.
24+
- Respond in standard technical English. Avoid nonstandard phrasing and corporate jargon.
25+
26+
## Testing Guidelines
27+
28+
- Add or update tests in `src/tests/` when changing command behavior, prompt rendering, session flow, tools, or settings.
29+
- Prefer Node's built-in `node:test` and `node:assert/strict` APIs, matching the existing tests.
30+
- Keep tests deterministic by using temporary directories and mocked network calls where needed.
31+
32+
## Commit & Pull Request Guidelines
33+
34+
- Keep commits focused on a single change and use concise, imperative commit messages.
35+
- In pull requests, describe the behavior change, list verification commands, and note any packaging or template path changes.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vegamo/deepcode-cli",
3-
"version": "0.1.19",
3+
"version": "0.1.20",
44
"description": "Deep Code CLI - Vibe coding for the deepseek-v4 model in your terminal",
55
"license": "MIT",
66
"type": "module",
@@ -15,8 +15,8 @@
1515
"main": "./dist/cli.js",
1616
"files": [
1717
"dist/cli.js",
18-
"docs/tools/**",
19-
"docs/prompts/**",
18+
"templates/tools/**",
19+
"templates/prompts/**",
2020
"README.md",
2121
"LICENSE"
2222
],

src/common/model-capabilities.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export const DEEPSEEK_V4_MODELS = new Set(["deepseek-v4-flash", "deepseek-v4-pro"]);
2+
3+
export const NON_MULTIMODAL_MODELS = new Set([
4+
"deepseek-v4-pro",
5+
"deepseek-v4-flash",
6+
"deepseek-chat",
7+
"deepseek-reasoner",
8+
]);
9+
10+
export function defaultsToThinkingMode(model: string): boolean {
11+
return DEEPSEEK_V4_MODELS.has(model);
12+
}
13+
14+
export function supportsMultimodal(model: string): boolean {
15+
return !NON_MULTIMODAL_MODELS.has(model.trim());
16+
}
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ReasoningEffort } from "./settings";
1+
import type { ReasoningEffort } from "../settings";
22

33
type ThinkingConfig = {
44
type: "enabled" | "disabled";

0 commit comments

Comments
 (0)