-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathllms.txt
More file actions
145 lines (107 loc) · 3.33 KB
/
llms.txt
File metadata and controls
145 lines (107 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# channelcoder
A streamlined SDK and CLI wrapper for Claude Code that enhances prompt engineering capabilities through multi-place variable interpolation, schema validation, and file-based prompts.
## Quick Start
```typescript
import { claude, stream, interactive } from 'channelcoder';
// Simple usage
const result = await claude('Hello, Claude!');
// Streaming responses
await stream('Tell me a story', {
onChunk: (chunk) => process.stdout.write(chunk)
});
// Interactive mode (replaces current process)
await interactive('Start a conversation...');
```
## Key Features
- Function-based API with `claude()`, `stream()`, `interactive()`, and `run()`
- Variable interpolation: `{varName}` or `${varName}` (both supported)
- Conditional prompts: `{#if condition}...{#endif}`
- Ternary expressions: `{age ? age : 'not specified'}`
- File-based prompts with YAML frontmatter
- YAML-based schema validation (converted to Zod)
- True process replacement in interactive mode
- Compatible with both Node.js and Bun
## Variable Interpolation
- Both `{variable}` and `${variable}` syntax supported
- Nested access: `{user.name}` or `${user.name}`
- Ternary expressions: `{isLoggedIn ? 'Welcome' : 'Please login'}`
- Escape with backslash: `\{literal}` or `\${literal}`
## File-based Prompts
Create markdown files with YAML frontmatter:
```markdown
---
systemPrompt: "You are a helpful assistant"
allowedTools:
- Read
- Write
- Bash(git:*)
input:
name: string
age?: number # Optional field (? suffix)
tags: string[] # Array type
---
Hello {name}, you are {age ? age : 'unknown'} years old.
{#if showDetails}
Additional details here...
{#endif}
```
## Schema Validation
Uses YAML notation that's converted to Zod schemas:
```yaml
input:
name: string # Required string
age?: number # Optional number
tags: string[] # Array of strings
settings: # Nested object
theme: string
notifications?: boolean
```
Supported types: `string`, `number`, `boolean`, `array`, `object`, `any`
## CLI Usage
```bash
# Run a prompt file with data
channelcoder prompts/analyze.md -d taskId=FEAT-123
# Inline prompt with variables
channelcoder -p "Summarize: {text}" -d text="Hello world"
# With tools and system prompt
channelcoder prompt.md -t "Read Write" -s "Be concise"
# Resume session
channelcoder -r session-id
```
## SDK Options
```typescript
await claude('Your prompt', {
// Data interpolation
data: { key: 'value' },
// System configuration
system: 'You are a helpful assistant',
appendSystem: 'Be concise',
// Tool configuration
tools: ['Read', 'Write', 'Bash(git:*)'],
disallowedTools: ['Bash(rm:*)'],
// Session management
resume: 'session-id',
continue: true,
// Execution control
maxTurns: 10,
timeout: 60000,
verbose: true
});
```
## Execution Modes
- **Run mode** (default): Get complete results programmatically
- **Stream mode**: Real-time streaming responses
- **Interactive mode**: Replace process with Claude (no return)
## Installation
```bash
npm install channelcoder
# or
bun add channelcoder
```
## Requirements
- Claude Code CLI installed and configured
- Node.js 18+ or Bun runtime
## Links
- GitHub: https://github.com/davidpp/channelcoder
- npm: https://www.npmjs.com/package/channelcoder
- Issues: https://github.com/davidpp/channelcoder/issues