@cdoing/core 0.1.0 → 0.1.1
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/README.md +105 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# @cdoing/core
|
|
2
|
+
|
|
3
|
+
Core foundation layer for [Cdoing Agent](https://github.com/awaisshah228/cdoing-agent) — an open-source, multi-provider AI coding assistant.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @cdoing/core
|
|
9
|
+
# or
|
|
10
|
+
yarn add @cdoing/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## What's Included
|
|
14
|
+
|
|
15
|
+
### Tools (20 Built-In)
|
|
16
|
+
|
|
17
|
+
A complete tool system for AI coding agents:
|
|
18
|
+
|
|
19
|
+
- **File Operations** — `file_read`, `file_write`, `file_edit`, `multi_edit`, `file_delete`
|
|
20
|
+
- **Search & Discovery** — `glob_search`, `grep_search`, `list_dir`, `view_diff`, `view_repo_map`, `codebase_search`
|
|
21
|
+
- **Code Execution** — `shell_exec` (with background mode), `file_run`, `code_verify`
|
|
22
|
+
- **Web Access** — `web_fetch`, `web_search`
|
|
23
|
+
- **Agent Control** — `sub_agent`, `todo`, `system_info`
|
|
24
|
+
- **AST Editing** — `ast_edit` for structured code transformations
|
|
25
|
+
|
|
26
|
+
Each tool exports `{ name, description, parameters, execute }` with raw JSON Schema definitions.
|
|
27
|
+
|
|
28
|
+
### Permission System
|
|
29
|
+
|
|
30
|
+
5 permission modes with settings-based rules:
|
|
31
|
+
|
|
32
|
+
| Mode | Behavior |
|
|
33
|
+
|------|----------|
|
|
34
|
+
| `default` | Prompts before every tool that requires permission |
|
|
35
|
+
| `acceptEdits` | Auto-approves file writes/edits, prompts for shell |
|
|
36
|
+
| `plan` | Read-only — all write/exec/delete tools blocked |
|
|
37
|
+
| `dontAsk` | Deny all unless explicitly allowed in settings |
|
|
38
|
+
| `bypassPermissions` | Auto-approve everything |
|
|
39
|
+
|
|
40
|
+
Rules use pattern syntax: `Bash(cmd)`, `Read(path)`, `Edit(path)`, `Delete(path)`, `WebFetch(domain:x)`.
|
|
41
|
+
|
|
42
|
+
Evaluation order: **Deny > Ask > Allow** (deny always wins).
|
|
43
|
+
|
|
44
|
+
### Sandbox
|
|
45
|
+
|
|
46
|
+
Filesystem and network sandboxing:
|
|
47
|
+
|
|
48
|
+
- **Filesystem** — `allowWrite` / `denyWrite` / `denyRead` path rules
|
|
49
|
+
- **Network** — domain allowlisting with `allowedDomains`
|
|
50
|
+
- **Shell** — destructive command detection and path extraction
|
|
51
|
+
|
|
52
|
+
### Context Providers (10)
|
|
53
|
+
|
|
54
|
+
Pluggable `@mention` providers via `ContextProviderRegistry`:
|
|
55
|
+
|
|
56
|
+
`@terminal`, `@tree`, `@url`, `@codebase`, `@open`, `@problems`, `@clipboard`, `@file`, `@git`, `@diff`
|
|
57
|
+
|
|
58
|
+
### Codebase Indexing
|
|
59
|
+
|
|
60
|
+
SQLite FTS5 full-text search with BM25 ranking:
|
|
61
|
+
|
|
62
|
+
- Code-aware chunking (function/class boundaries for 7+ languages)
|
|
63
|
+
- Incremental updates
|
|
64
|
+
- Recent edits cache
|
|
65
|
+
|
|
66
|
+
### Additional Systems
|
|
67
|
+
|
|
68
|
+
- **Hooks** — Pre/post tool execution hooks via `.cdoing/hooks.json`
|
|
69
|
+
- **Rules** — Glob-scoped project rules from `.cdoing/rules/*.md` (YAML frontmatter)
|
|
70
|
+
- **MCP** — Model Context Protocol server support (JSON-RPC 2.0 over stdio)
|
|
71
|
+
- **OAuth** — PKCE flow with platform-specific secure storage
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import {
|
|
77
|
+
ToolRegistry,
|
|
78
|
+
PermissionManager,
|
|
79
|
+
SandboxManager,
|
|
80
|
+
ContextProviderRegistry,
|
|
81
|
+
HookManager,
|
|
82
|
+
} from '@cdoing/core';
|
|
83
|
+
|
|
84
|
+
// Get all available tools
|
|
85
|
+
const tools = ToolRegistry.getAllTools();
|
|
86
|
+
|
|
87
|
+
// Check permissions
|
|
88
|
+
const permissionManager = new PermissionManager({ mode: 'default' });
|
|
89
|
+
const allowed = await permissionManager.check('file_write', { path: 'src/index.ts' });
|
|
90
|
+
|
|
91
|
+
// Execute a tool
|
|
92
|
+
const result = await tools.file_read.execute({ path: 'src/index.ts' });
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Key Patterns
|
|
96
|
+
|
|
97
|
+
- Tool definitions use **raw JSON Schema** (no Zod)
|
|
98
|
+
- **Parallel** tools: file reads, searches, web fetch, sub_agent
|
|
99
|
+
- **Sequential** tools: shell_exec, file_run (due to side effects)
|
|
100
|
+
- **Multi-strategy edit matching**: exact > trimmed > case-insensitive > whitespace-ignored
|
|
101
|
+
- Config layers: `~/.claude/settings.json` (global) > `.claude/settings.json` (project) > `.claude/settings.local.json` (local)
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
MIT
|