@yeyuan98/opencode-bioresearcher-plugin 1.4.0 → 1.5.0-alpha.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/README.md +35 -20
- package/dist/db-tools/backends/index.d.ts +11 -0
- package/dist/db-tools/backends/index.js +48 -0
- package/dist/db-tools/backends/mongodb/backend.d.ts +15 -0
- package/dist/db-tools/backends/mongodb/backend.js +76 -0
- package/dist/db-tools/backends/mongodb/connection.d.ts +27 -0
- package/dist/db-tools/backends/mongodb/connection.js +107 -0
- package/dist/db-tools/backends/mongodb/index.d.ts +4 -0
- package/dist/db-tools/backends/mongodb/index.js +3 -0
- package/dist/db-tools/backends/mongodb/translator.d.ts +30 -0
- package/dist/db-tools/backends/mongodb/translator.js +407 -0
- package/dist/db-tools/backends/mysql/backend.d.ts +15 -0
- package/dist/db-tools/backends/mysql/backend.js +57 -0
- package/dist/db-tools/backends/mysql/connection.d.ts +25 -0
- package/dist/db-tools/backends/mysql/connection.js +83 -0
- package/dist/db-tools/backends/mysql/index.d.ts +3 -0
- package/dist/db-tools/backends/mysql/index.js +2 -0
- package/dist/db-tools/backends/mysql/translator.d.ts +7 -0
- package/dist/db-tools/backends/mysql/translator.js +67 -0
- package/dist/db-tools/core/base.d.ts +17 -0
- package/dist/db-tools/core/base.js +51 -0
- package/dist/db-tools/core/config-loader.d.ts +3 -0
- package/dist/db-tools/core/config-loader.js +46 -0
- package/dist/db-tools/core/index.d.ts +2 -0
- package/dist/db-tools/core/index.js +2 -0
- package/dist/db-tools/core/jsonc-parser.d.ts +2 -0
- package/dist/db-tools/core/jsonc-parser.js +77 -0
- package/dist/db-tools/core/validator.d.ts +16 -0
- package/dist/db-tools/core/validator.js +118 -0
- package/dist/db-tools/executor.d.ts +13 -0
- package/dist/db-tools/executor.js +54 -0
- package/dist/db-tools/index.d.ts +51 -0
- package/dist/db-tools/index.js +27 -0
- package/dist/db-tools/interface/backend.d.ts +24 -0
- package/dist/db-tools/interface/backend.js +1 -0
- package/dist/db-tools/interface/connection.d.ts +21 -0
- package/dist/db-tools/interface/connection.js +11 -0
- package/dist/db-tools/interface/index.d.ts +4 -0
- package/dist/db-tools/interface/index.js +4 -0
- package/dist/db-tools/interface/query.d.ts +60 -0
- package/dist/db-tools/interface/query.js +1 -0
- package/dist/db-tools/interface/schema.d.ts +22 -0
- package/dist/db-tools/interface/schema.js +1 -0
- package/dist/db-tools/pool.d.ts +8 -0
- package/dist/db-tools/pool.js +49 -0
- package/dist/db-tools/tools/index.d.ts +27 -0
- package/dist/db-tools/tools/index.js +191 -0
- package/dist/db-tools/tools.d.ts +27 -0
- package/dist/db-tools/tools.js +111 -0
- package/dist/db-tools/types.d.ts +94 -0
- package/dist/db-tools/types.js +40 -0
- package/dist/db-tools/utils.d.ts +33 -0
- package/dist/db-tools/utils.js +94 -0
- package/dist/index.js +2 -0
- package/dist/skills/bioresearcher-core/README.md +210 -210
- package/dist/skills/bioresearcher-core/SKILL.md +128 -128
- package/dist/skills/bioresearcher-core/examples/contexts.json +29 -29
- package/dist/skills/bioresearcher-core/examples/data-exchange-example.md +303 -303
- package/dist/skills/bioresearcher-core/examples/template.md +49 -49
- package/dist/skills/bioresearcher-core/patterns/calculator.md +215 -215
- package/dist/skills/bioresearcher-core/patterns/data-exchange.md +406 -406
- package/dist/skills/bioresearcher-core/patterns/json-tools.md +263 -263
- package/dist/skills/bioresearcher-core/patterns/progress.md +127 -127
- package/dist/skills/bioresearcher-core/patterns/retry.md +110 -110
- package/dist/skills/bioresearcher-core/patterns/shell-commands.md +79 -79
- package/dist/skills/bioresearcher-core/patterns/subagent-waves.md +186 -186
- package/dist/skills/bioresearcher-core/patterns/table-tools.md +260 -260
- package/dist/skills/bioresearcher-core/patterns/user-confirmation.md +187 -187
- package/dist/skills/bioresearcher-core/python/template.md +273 -273
- package/dist/skills/bioresearcher-core/python/template.py +323 -323
- package/dist/skills/env-jsonc-setup/SKILL.md +206 -0
- package/package.json +3 -1
|
@@ -1,273 +1,273 @@
|
|
|
1
|
-
# Template Engine Documentation
|
|
2
|
-
|
|
3
|
-
Python script for generating files from templates with placeholder replacement.
|
|
4
|
-
|
|
5
|
-
## Location
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
<skill_path>/python/template.py
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Commands
|
|
12
|
-
|
|
13
|
-
### fill
|
|
14
|
-
|
|
15
|
-
Generate a single file from template and context.
|
|
16
|
-
|
|
17
|
-
**Usage:**
|
|
18
|
-
```bash
|
|
19
|
-
# Unix-like
|
|
20
|
-
uv run python <skill_path>/python/template.py fill \
|
|
21
|
-
--template template.md \
|
|
22
|
-
--context context.json \
|
|
23
|
-
--output output.md
|
|
24
|
-
|
|
25
|
-
# Windows
|
|
26
|
-
uv.exe run python <skill_path>\python\template.py fill ^
|
|
27
|
-
--template template.md ^
|
|
28
|
-
--context context.json ^
|
|
29
|
-
--output output.md
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
**Arguments:**
|
|
33
|
-
| Argument | Required | Description |
|
|
34
|
-
|----------|----------|-------------|
|
|
35
|
-
| `--template` | Yes | Path to template file |
|
|
36
|
-
| `--context` | Yes | Path to context JSON file |
|
|
37
|
-
| `--output` | Yes | Path for output file |
|
|
38
|
-
| `--escape` | No | Escape values for markdown code blocks |
|
|
39
|
-
|
|
40
|
-
**Output:**
|
|
41
|
-
```json
|
|
42
|
-
{
|
|
43
|
-
"success": true,
|
|
44
|
-
"output_path": "output.md",
|
|
45
|
-
"template_path": "template.md"
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### generate-batches
|
|
50
|
-
|
|
51
|
-
Generate multiple files from template and list of contexts.
|
|
52
|
-
|
|
53
|
-
**Usage:**
|
|
54
|
-
```bash
|
|
55
|
-
# Unix-like
|
|
56
|
-
uv run python <skill_path>/python/template.py generate-batches \
|
|
57
|
-
--template template.md \
|
|
58
|
-
--contexts contexts.json \
|
|
59
|
-
--output-dir ./outputs \
|
|
60
|
-
--filename-pattern "batch{index:03d}.md"
|
|
61
|
-
|
|
62
|
-
# Windows
|
|
63
|
-
uv.exe run python <skill_path>\python\template.py generate-batches ^
|
|
64
|
-
--template template.md ^
|
|
65
|
-
--contexts contexts.json ^
|
|
66
|
-
--output-dir .\outputs ^
|
|
67
|
-
--filename-pattern "batch{index:03d}.md"
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**Arguments:**
|
|
71
|
-
| Argument | Required | Description |
|
|
72
|
-
|----------|----------|-------------|
|
|
73
|
-
| `--template` | Yes | Path to template file |
|
|
74
|
-
| `--contexts` | Yes | Path to contexts JSON file (array) |
|
|
75
|
-
| `--output-dir` | Yes | Directory for output files |
|
|
76
|
-
| `--filename-pattern` | No | Filename pattern (default: `output_{index:03d}.md`) |
|
|
77
|
-
| `--escape` | No | Escape values for markdown |
|
|
78
|
-
| `--dry-run` | No | Validate without writing files |
|
|
79
|
-
| `--verbose` | No | Print progress |
|
|
80
|
-
|
|
81
|
-
**Output:**
|
|
82
|
-
```json
|
|
83
|
-
{
|
|
84
|
-
"success": true,
|
|
85
|
-
"total_contexts": 10,
|
|
86
|
-
"generated_count": 10,
|
|
87
|
-
"output_dir": "./outputs",
|
|
88
|
-
"generated_files": [
|
|
89
|
-
"./outputs/batch001.md",
|
|
90
|
-
"./outputs/batch002.md",
|
|
91
|
-
"..."
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### escape
|
|
97
|
-
|
|
98
|
-
Escape text for markdown code blocks.
|
|
99
|
-
|
|
100
|
-
**Usage:**
|
|
101
|
-
```bash
|
|
102
|
-
uv run python <skill_path>/python/template.py escape --text "Text with `backticks` and $variables"
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
**Output:**
|
|
106
|
-
```json
|
|
107
|
-
{
|
|
108
|
-
"success": true,
|
|
109
|
-
"original": "Text with `backticks` and $variables",
|
|
110
|
-
"escaped": "Text with \\`backticks\\` and \\$variables"
|
|
111
|
-
}
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
## Template Syntax
|
|
115
|
-
|
|
116
|
-
### Placeholders
|
|
117
|
-
|
|
118
|
-
Use `{placeholder_name}` for placeholders:
|
|
119
|
-
|
|
120
|
-
```markdown
|
|
121
|
-
# Task for {name}
|
|
122
|
-
|
|
123
|
-
Process {count} items from {source_file}.
|
|
124
|
-
Output to: {output_file}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
### Placeholder Rules
|
|
128
|
-
|
|
129
|
-
1. **Alphanumeric names**: Use letters, numbers, underscores only
|
|
130
|
-
2. **Case-sensitive**: `{Name}` != `{name}`
|
|
131
|
-
3. **No nesting**: `{outer.{inner}}` not supported
|
|
132
|
-
4. **Missing placeholders**: Left unchanged if not in context
|
|
133
|
-
|
|
134
|
-
## Context Format
|
|
135
|
-
|
|
136
|
-
### Single Context (for `fill`)
|
|
137
|
-
|
|
138
|
-
```json
|
|
139
|
-
{
|
|
140
|
-
"name": "Batch 001",
|
|
141
|
-
"count": 30,
|
|
142
|
-
"source_file": "./data/input.xlsx",
|
|
143
|
-
"output_file": "./outputs/batch001.md"
|
|
144
|
-
}
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### Multiple Contexts (for `generate-batches`)
|
|
148
|
-
|
|
149
|
-
```json
|
|
150
|
-
[
|
|
151
|
-
{
|
|
152
|
-
"batch_number": 1,
|
|
153
|
-
"row_start": 2,
|
|
154
|
-
"row_end": 31,
|
|
155
|
-
"output_file": "./outputs/batch001.md"
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
"batch_number": 2,
|
|
159
|
-
"row_start": 32,
|
|
160
|
-
"row_end": 61,
|
|
161
|
-
"output_file": "./outputs/batch002.md"
|
|
162
|
-
}
|
|
163
|
-
]
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
## Escaping for Markdown
|
|
167
|
-
|
|
168
|
-
When `--escape` flag is used, values are escaped for safe use in markdown code blocks:
|
|
169
|
-
|
|
170
|
-
| Character | Escaped To |
|
|
171
|
-
|-----------|------------|
|
|
172
|
-
| `\` | `\\` |
|
|
173
|
-
| `` ` `` | `\`` |
|
|
174
|
-
| `$` | `\$` |
|
|
175
|
-
|
|
176
|
-
This prevents:
|
|
177
|
-
- Backtick interpretation as code
|
|
178
|
-
- Variable substitution in shells
|
|
179
|
-
- Escape sequence issues
|
|
180
|
-
|
|
181
|
-
## Error Handling
|
|
182
|
-
|
|
183
|
-
### Template Not Found
|
|
184
|
-
```json
|
|
185
|
-
{
|
|
186
|
-
"success": false,
|
|
187
|
-
"error": "Template file not found: template.md"
|
|
188
|
-
}
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Context Parse Error
|
|
192
|
-
```json
|
|
193
|
-
{
|
|
194
|
-
"success": false,
|
|
195
|
-
"error": "Failed to read context file: Expecting value: line 1 column 1 (char 0)"
|
|
196
|
-
}
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### Partial Batch Failure
|
|
200
|
-
```json
|
|
201
|
-
{
|
|
202
|
-
"success": false,
|
|
203
|
-
"total_contexts": 10,
|
|
204
|
-
"generated_count": 8,
|
|
205
|
-
"error_count": 2,
|
|
206
|
-
"errors": [
|
|
207
|
-
"Failed to write ./outputs/batch005.md: Permission denied",
|
|
208
|
-
"Failed to write ./outputs/batch009.md: Disk full"
|
|
209
|
-
]
|
|
210
|
-
}
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
## Example Workflow
|
|
214
|
-
|
|
215
|
-
### Step 1: Create Template
|
|
216
|
-
|
|
217
|
-
```markdown
|
|
218
|
-
# Batch {batch_number} Processing
|
|
219
|
-
|
|
220
|
-
## Input
|
|
221
|
-
- File: {input_file}
|
|
222
|
-
- Rows: {row_start} to {row_end}
|
|
223
|
-
|
|
224
|
-
## Output
|
|
225
|
-
Write results to: {output_file}
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### Step 2: Create Contexts
|
|
229
|
-
|
|
230
|
-
```json
|
|
231
|
-
[
|
|
232
|
-
{
|
|
233
|
-
"batch_number": 1,
|
|
234
|
-
"input_file": "./data.xlsx",
|
|
235
|
-
"row_start": 2,
|
|
236
|
-
"row_end": 31,
|
|
237
|
-
"output_file": "./outputs/batch001.md"
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
"batch_number": 2,
|
|
241
|
-
"input_file": "./data.xlsx",
|
|
242
|
-
"row_start": 32,
|
|
243
|
-
"row_end": 61,
|
|
244
|
-
"output_file": "./outputs/batch002.md"
|
|
245
|
-
}
|
|
246
|
-
]
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
### Step 3: Generate Files
|
|
250
|
-
|
|
251
|
-
```bash
|
|
252
|
-
uv run python <skill_path>/python/template.py generate-batches \
|
|
253
|
-
--template batch_template.md \
|
|
254
|
-
--contexts batch_contexts.json \
|
|
255
|
-
--output-dir ./prompts \
|
|
256
|
-
--filename-pattern "batch{index:03d}.md"
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### Step 4: Use Generated Files
|
|
260
|
-
|
|
261
|
-
The generated files can be used as prompts for subagents:
|
|
262
|
-
|
|
263
|
-
```
|
|
264
|
-
task(
|
|
265
|
-
subagent_type="general",
|
|
266
|
-
description="Process batch 001",
|
|
267
|
-
prompt="Read your prompt from ./prompts/batch001.md and perform the task."
|
|
268
|
-
)
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
## Dependencies
|
|
272
|
-
|
|
273
|
-
None - uses only Python standard library.
|
|
1
|
+
# Template Engine Documentation
|
|
2
|
+
|
|
3
|
+
Python script for generating files from templates with placeholder replacement.
|
|
4
|
+
|
|
5
|
+
## Location
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
<skill_path>/python/template.py
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Commands
|
|
12
|
+
|
|
13
|
+
### fill
|
|
14
|
+
|
|
15
|
+
Generate a single file from template and context.
|
|
16
|
+
|
|
17
|
+
**Usage:**
|
|
18
|
+
```bash
|
|
19
|
+
# Unix-like
|
|
20
|
+
uv run python <skill_path>/python/template.py fill \
|
|
21
|
+
--template template.md \
|
|
22
|
+
--context context.json \
|
|
23
|
+
--output output.md
|
|
24
|
+
|
|
25
|
+
# Windows
|
|
26
|
+
uv.exe run python <skill_path>\python\template.py fill ^
|
|
27
|
+
--template template.md ^
|
|
28
|
+
--context context.json ^
|
|
29
|
+
--output output.md
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Arguments:**
|
|
33
|
+
| Argument | Required | Description |
|
|
34
|
+
|----------|----------|-------------|
|
|
35
|
+
| `--template` | Yes | Path to template file |
|
|
36
|
+
| `--context` | Yes | Path to context JSON file |
|
|
37
|
+
| `--output` | Yes | Path for output file |
|
|
38
|
+
| `--escape` | No | Escape values for markdown code blocks |
|
|
39
|
+
|
|
40
|
+
**Output:**
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"success": true,
|
|
44
|
+
"output_path": "output.md",
|
|
45
|
+
"template_path": "template.md"
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### generate-batches
|
|
50
|
+
|
|
51
|
+
Generate multiple files from template and list of contexts.
|
|
52
|
+
|
|
53
|
+
**Usage:**
|
|
54
|
+
```bash
|
|
55
|
+
# Unix-like
|
|
56
|
+
uv run python <skill_path>/python/template.py generate-batches \
|
|
57
|
+
--template template.md \
|
|
58
|
+
--contexts contexts.json \
|
|
59
|
+
--output-dir ./outputs \
|
|
60
|
+
--filename-pattern "batch{index:03d}.md"
|
|
61
|
+
|
|
62
|
+
# Windows
|
|
63
|
+
uv.exe run python <skill_path>\python\template.py generate-batches ^
|
|
64
|
+
--template template.md ^
|
|
65
|
+
--contexts contexts.json ^
|
|
66
|
+
--output-dir .\outputs ^
|
|
67
|
+
--filename-pattern "batch{index:03d}.md"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Arguments:**
|
|
71
|
+
| Argument | Required | Description |
|
|
72
|
+
|----------|----------|-------------|
|
|
73
|
+
| `--template` | Yes | Path to template file |
|
|
74
|
+
| `--contexts` | Yes | Path to contexts JSON file (array) |
|
|
75
|
+
| `--output-dir` | Yes | Directory for output files |
|
|
76
|
+
| `--filename-pattern` | No | Filename pattern (default: `output_{index:03d}.md`) |
|
|
77
|
+
| `--escape` | No | Escape values for markdown |
|
|
78
|
+
| `--dry-run` | No | Validate without writing files |
|
|
79
|
+
| `--verbose` | No | Print progress |
|
|
80
|
+
|
|
81
|
+
**Output:**
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"success": true,
|
|
85
|
+
"total_contexts": 10,
|
|
86
|
+
"generated_count": 10,
|
|
87
|
+
"output_dir": "./outputs",
|
|
88
|
+
"generated_files": [
|
|
89
|
+
"./outputs/batch001.md",
|
|
90
|
+
"./outputs/batch002.md",
|
|
91
|
+
"..."
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### escape
|
|
97
|
+
|
|
98
|
+
Escape text for markdown code blocks.
|
|
99
|
+
|
|
100
|
+
**Usage:**
|
|
101
|
+
```bash
|
|
102
|
+
uv run python <skill_path>/python/template.py escape --text "Text with `backticks` and $variables"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Output:**
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"success": true,
|
|
109
|
+
"original": "Text with `backticks` and $variables",
|
|
110
|
+
"escaped": "Text with \\`backticks\\` and \\$variables"
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Template Syntax
|
|
115
|
+
|
|
116
|
+
### Placeholders
|
|
117
|
+
|
|
118
|
+
Use `{placeholder_name}` for placeholders:
|
|
119
|
+
|
|
120
|
+
```markdown
|
|
121
|
+
# Task for {name}
|
|
122
|
+
|
|
123
|
+
Process {count} items from {source_file}.
|
|
124
|
+
Output to: {output_file}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Placeholder Rules
|
|
128
|
+
|
|
129
|
+
1. **Alphanumeric names**: Use letters, numbers, underscores only
|
|
130
|
+
2. **Case-sensitive**: `{Name}` != `{name}`
|
|
131
|
+
3. **No nesting**: `{outer.{inner}}` not supported
|
|
132
|
+
4. **Missing placeholders**: Left unchanged if not in context
|
|
133
|
+
|
|
134
|
+
## Context Format
|
|
135
|
+
|
|
136
|
+
### Single Context (for `fill`)
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"name": "Batch 001",
|
|
141
|
+
"count": 30,
|
|
142
|
+
"source_file": "./data/input.xlsx",
|
|
143
|
+
"output_file": "./outputs/batch001.md"
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Multiple Contexts (for `generate-batches`)
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
[
|
|
151
|
+
{
|
|
152
|
+
"batch_number": 1,
|
|
153
|
+
"row_start": 2,
|
|
154
|
+
"row_end": 31,
|
|
155
|
+
"output_file": "./outputs/batch001.md"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"batch_number": 2,
|
|
159
|
+
"row_start": 32,
|
|
160
|
+
"row_end": 61,
|
|
161
|
+
"output_file": "./outputs/batch002.md"
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Escaping for Markdown
|
|
167
|
+
|
|
168
|
+
When `--escape` flag is used, values are escaped for safe use in markdown code blocks:
|
|
169
|
+
|
|
170
|
+
| Character | Escaped To |
|
|
171
|
+
|-----------|------------|
|
|
172
|
+
| `\` | `\\` |
|
|
173
|
+
| `` ` `` | `\`` |
|
|
174
|
+
| `$` | `\$` |
|
|
175
|
+
|
|
176
|
+
This prevents:
|
|
177
|
+
- Backtick interpretation as code
|
|
178
|
+
- Variable substitution in shells
|
|
179
|
+
- Escape sequence issues
|
|
180
|
+
|
|
181
|
+
## Error Handling
|
|
182
|
+
|
|
183
|
+
### Template Not Found
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"success": false,
|
|
187
|
+
"error": "Template file not found: template.md"
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Context Parse Error
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"success": false,
|
|
195
|
+
"error": "Failed to read context file: Expecting value: line 1 column 1 (char 0)"
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Partial Batch Failure
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"success": false,
|
|
203
|
+
"total_contexts": 10,
|
|
204
|
+
"generated_count": 8,
|
|
205
|
+
"error_count": 2,
|
|
206
|
+
"errors": [
|
|
207
|
+
"Failed to write ./outputs/batch005.md: Permission denied",
|
|
208
|
+
"Failed to write ./outputs/batch009.md: Disk full"
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Example Workflow
|
|
214
|
+
|
|
215
|
+
### Step 1: Create Template
|
|
216
|
+
|
|
217
|
+
```markdown
|
|
218
|
+
# Batch {batch_number} Processing
|
|
219
|
+
|
|
220
|
+
## Input
|
|
221
|
+
- File: {input_file}
|
|
222
|
+
- Rows: {row_start} to {row_end}
|
|
223
|
+
|
|
224
|
+
## Output
|
|
225
|
+
Write results to: {output_file}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Step 2: Create Contexts
|
|
229
|
+
|
|
230
|
+
```json
|
|
231
|
+
[
|
|
232
|
+
{
|
|
233
|
+
"batch_number": 1,
|
|
234
|
+
"input_file": "./data.xlsx",
|
|
235
|
+
"row_start": 2,
|
|
236
|
+
"row_end": 31,
|
|
237
|
+
"output_file": "./outputs/batch001.md"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"batch_number": 2,
|
|
241
|
+
"input_file": "./data.xlsx",
|
|
242
|
+
"row_start": 32,
|
|
243
|
+
"row_end": 61,
|
|
244
|
+
"output_file": "./outputs/batch002.md"
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Step 3: Generate Files
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
uv run python <skill_path>/python/template.py generate-batches \
|
|
253
|
+
--template batch_template.md \
|
|
254
|
+
--contexts batch_contexts.json \
|
|
255
|
+
--output-dir ./prompts \
|
|
256
|
+
--filename-pattern "batch{index:03d}.md"
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Step 4: Use Generated Files
|
|
260
|
+
|
|
261
|
+
The generated files can be used as prompts for subagents:
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
task(
|
|
265
|
+
subagent_type="general",
|
|
266
|
+
description="Process batch 001",
|
|
267
|
+
prompt="Read your prompt from ./prompts/batch001.md and perform the task."
|
|
268
|
+
)
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Dependencies
|
|
272
|
+
|
|
273
|
+
None - uses only Python standard library.
|