@yeyuan98/opencode-bioresearcher-plugin 1.5.0 → 1.5.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 +50 -50
- package/dist/index.js +6 -6
- package/dist/skills/bioresearcher-tests/README.md +90 -0
- package/dist/skills/bioresearcher-tests/SKILL.md +255 -0
- package/dist/skills/bioresearcher-tests/pyproject.toml +6 -0
- package/dist/skills/bioresearcher-tests/resources/json_samples/in_markdown.md.gz +0 -0
- package/dist/skills/bioresearcher-tests/resources/json_samples/nested_object.json.gz +0 -0
- package/dist/skills/bioresearcher-tests/resources/json_samples/schema_draft7.json.gz +0 -0
- package/dist/skills/bioresearcher-tests/resources/json_samples/simple_array.json.gz +0 -0
- package/dist/skills/bioresearcher-tests/resources/json_samples/simple_object.json.gz +0 -0
- package/dist/skills/bioresearcher-tests/resources/obo_sample.obo.gz +0 -0
- package/dist/skills/bioresearcher-tests/resources/pubmed_sample.xml.gz +0 -0
- package/dist/skills/bioresearcher-tests/resources/table_sample.xlsx.gz +0 -0
- package/dist/skills/bioresearcher-tests/test_cases/json_tests.md +137 -0
- package/dist/skills/bioresearcher-tests/test_cases/misc_tests.md +141 -0
- package/dist/skills/bioresearcher-tests/test_cases/parser_tests.md +80 -0
- package/dist/skills/bioresearcher-tests/test_cases/skill_tests.md +59 -0
- package/dist/skills/bioresearcher-tests/test_cases/table_tests.md +194 -0
- package/dist/skills/bioresearcher-tests/test_runner.py +607 -0
- package/dist/skills/env-jsonc-setup/SKILL.md +206 -206
- package/dist/skills/long-table-summary/SKILL.md +224 -153
- package/dist/skills/long-table-summary/combine_outputs.py +55 -9
- package/dist/skills/long-table-summary/generate_prompts.py +9 -0
- package/dist/skills/pubmed-weekly/pubmed_weekly.py +130 -29
- package/dist/{db-tools → tools/db}/backends/mysql/translator.js +23 -23
- package/dist/{db-tools → tools/db}/tools.js +34 -34
- package/dist/{misc-tools → tools/misc}/json-validate.js +4 -5
- package/dist/{skill-tools → tools/skill}/registry.js +1 -1
- package/package.json +1 -1
- package/dist/db-tools/executor.d.ts +0 -13
- package/dist/db-tools/executor.js +0 -54
- package/dist/db-tools/pool.d.ts +0 -8
- package/dist/db-tools/pool.js +0 -49
- package/dist/db-tools/tools/index.d.ts +0 -27
- package/dist/db-tools/tools/index.js +0 -191
- package/dist/db-tools/types.d.ts +0 -94
- package/dist/db-tools/types.js +0 -40
- package/dist/misc-tools/json-tools.d.ts +0 -33
- package/dist/misc-tools/json-tools.js +0 -187
- package/dist/skill/frontmatter.d.ts +0 -2
- package/dist/skill/frontmatter.js +0 -65
- package/dist/skill/index.d.ts +0 -3
- package/dist/skill/index.js +0 -2
- package/dist/skill/registry.d.ts +0 -11
- package/dist/skill/registry.js +0 -64
- package/dist/skill/tool.d.ts +0 -9
- package/dist/skill/tool.js +0 -115
- package/dist/skill/types.d.ts +0 -22
- package/dist/skill/types.js +0 -7
- /package/dist/{db-tools → tools/db}/backends/index.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/index.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/backend.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/backend.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/connection.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/connection.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/index.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/index.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/translator.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/translator.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mysql/backend.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/mysql/backend.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mysql/connection.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/mysql/connection.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mysql/index.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/mysql/index.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mysql/translator.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/core/base.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/core/base.js +0 -0
- /package/dist/{db-tools → tools/db}/core/config-loader.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/core/config-loader.js +0 -0
- /package/dist/{db-tools → tools/db}/core/index.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/core/index.js +0 -0
- /package/dist/{db-tools → tools/db}/core/jsonc-parser.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/core/jsonc-parser.js +0 -0
- /package/dist/{db-tools → tools/db}/core/validator.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/core/validator.js +0 -0
- /package/dist/{db-tools → tools/db}/index.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/index.js +0 -0
- /package/dist/{db-tools → tools/db}/interface/backend.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/interface/backend.js +0 -0
- /package/dist/{db-tools → tools/db}/interface/connection.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/interface/connection.js +0 -0
- /package/dist/{db-tools → tools/db}/interface/index.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/interface/index.js +0 -0
- /package/dist/{db-tools → tools/db}/interface/query.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/interface/query.js +0 -0
- /package/dist/{db-tools → tools/db}/interface/schema.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/interface/schema.js +0 -0
- /package/dist/{db-tools → tools/db}/tools.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/utils.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/utils.js +0 -0
- /package/dist/{misc-tools → tools/misc}/calculator.d.ts +0 -0
- /package/dist/{misc-tools → tools/misc}/calculator.js +0 -0
- /package/dist/{misc-tools → tools/misc}/index.d.ts +0 -0
- /package/dist/{misc-tools → tools/misc}/index.js +0 -0
- /package/dist/{misc-tools → tools/misc}/json-extract.d.ts +0 -0
- /package/dist/{misc-tools → tools/misc}/json-extract.js +0 -0
- /package/dist/{misc-tools → tools/misc}/json-infer.d.ts +0 -0
- /package/dist/{misc-tools → tools/misc}/json-infer.js +0 -0
- /package/dist/{misc-tools → tools/misc}/json-validate.d.ts +0 -0
- /package/dist/{misc-tools → tools/misc}/timer.d.ts +0 -0
- /package/dist/{misc-tools → tools/misc}/timer.js +0 -0
- /package/dist/{parser-tools → tools/parser}/obo/index.d.ts +0 -0
- /package/dist/{parser-tools → tools/parser}/obo/index.js +0 -0
- /package/dist/{parser-tools → tools/parser}/obo/obo.d.ts +0 -0
- /package/dist/{parser-tools → tools/parser}/obo/obo.js +0 -0
- /package/dist/{parser-tools → tools/parser}/obo/types.d.ts +0 -0
- /package/dist/{parser-tools → tools/parser}/obo/types.js +0 -0
- /package/dist/{parser-tools → tools/parser}/obo/utils.d.ts +0 -0
- /package/dist/{parser-tools → tools/parser}/obo/utils.js +0 -0
- /package/dist/{parser-tools → tools/parser}/pubmed/index.d.ts +0 -0
- /package/dist/{parser-tools → tools/parser}/pubmed/index.js +0 -0
- /package/dist/{parser-tools → tools/parser}/pubmed/pubmed.d.ts +0 -0
- /package/dist/{parser-tools → tools/parser}/pubmed/pubmed.js +0 -0
- /package/dist/{parser-tools → tools/parser}/pubmed/types.d.ts +0 -0
- /package/dist/{parser-tools → tools/parser}/pubmed/types.js +0 -0
- /package/dist/{parser-tools → tools/parser}/pubmed/utils.d.ts +0 -0
- /package/dist/{parser-tools → tools/parser}/pubmed/utils.js +0 -0
- /package/dist/{skill-tools → tools/skill}/frontmatter.d.ts +0 -0
- /package/dist/{skill-tools → tools/skill}/frontmatter.js +0 -0
- /package/dist/{skill-tools → tools/skill}/index.d.ts +0 -0
- /package/dist/{skill-tools → tools/skill}/index.js +0 -0
- /package/dist/{skill-tools → tools/skill}/registry.d.ts +0 -0
- /package/dist/{skill-tools → tools/skill}/tool.d.ts +0 -0
- /package/dist/{skill-tools → tools/skill}/tool.js +0 -0
- /package/dist/{skill-tools → tools/skill}/types.d.ts +0 -0
- /package/dist/{skill-tools → tools/skill}/types.js +0 -0
- /package/dist/{table-tools → tools/table}/index.d.ts +0 -0
- /package/dist/{table-tools → tools/table}/index.js +0 -0
- /package/dist/{table-tools → tools/table}/tools.d.ts +0 -0
- /package/dist/{table-tools → tools/table}/tools.js +0 -0
- /package/dist/{table-tools → tools/table}/utils.d.ts +0 -0
- /package/dist/{table-tools → tools/table}/utils.js +0 -0
package/README.md
CHANGED
|
@@ -75,47 +75,47 @@ Parse PubMed XML files to markdown or Excel format. Supports `.xml` and `.xml.gz
|
|
|
75
75
|
Download pubmed article data from https://ftp.ncbi.nlm.nih.gov/pubmed/updatefiles/pubmed26n1340.xml.gz and parse to Excel format.
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
Reference: [PubMed Download Data](https://pubmed.ncbi.nlm.nih.gov/download/).
|
|
79
|
-
|
|
80
|
-
### OBO Parser
|
|
81
|
-
|
|
82
|
-
Parse OBO (Open Biological and Biomedical Ontology) files to CSV format. Handles Term, Typedef, and Instance frames.
|
|
83
|
-
|
|
84
|
-
**Flatten complex ontologies into analysis-ready tables.**
|
|
85
|
-
|
|
86
|
-
```text
|
|
87
|
-
Parse go.obo file and convert to CSV using parse_obo_file tool.
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Reference: [OBO Format](http://owlcollab.github.io/oboformat/doc/obo-syntax.html).
|
|
91
|
-
|
|
92
|
-
### JSON Tools
|
|
93
|
-
|
|
94
|
-
Extract, validate, and infer JSON schemas from data.
|
|
95
|
-
|
|
96
|
-
**Robust JSON handling for LLM workflows.**
|
|
97
|
-
|
|
98
|
-
```text
|
|
99
|
-
Extract JSON from output.md using jsonExtract tool.
|
|
100
|
-
Validate data.json against schema.json using jsonValidate tool.
|
|
101
|
-
Infer schema from sample.json using jsonInfer tool.
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Database Tools
|
|
105
|
-
|
|
106
|
-
Query MySQL and MongoDB databases with read-only access.
|
|
107
|
-
|
|
108
|
-
**Explore your data warehouse without leaving the conversation.**
|
|
109
|
-
|
|
110
|
-
```text
|
|
111
|
-
List all tables in the database.
|
|
112
|
-
Describe the schema for table users.
|
|
113
|
-
Query orders placed in the last 30 days.
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
Configuration via `env.jsonc` in working directory. Use the `env-jsonc-setup` skill for guided setup.
|
|
117
|
-
|
|
118
|
-
## Skills
|
|
78
|
+
Reference: [PubMed Download Data](https://pubmed.ncbi.nlm.nih.gov/download/).
|
|
79
|
+
|
|
80
|
+
### OBO Parser
|
|
81
|
+
|
|
82
|
+
Parse OBO (Open Biological and Biomedical Ontology) files to CSV format. Handles Term, Typedef, and Instance frames.
|
|
83
|
+
|
|
84
|
+
**Flatten complex ontologies into analysis-ready tables.**
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
Parse go.obo file and convert to CSV using parse_obo_file tool.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Reference: [OBO Format](http://owlcollab.github.io/oboformat/doc/obo-syntax.html).
|
|
91
|
+
|
|
92
|
+
### JSON Tools
|
|
93
|
+
|
|
94
|
+
Extract, validate, and infer JSON schemas from data.
|
|
95
|
+
|
|
96
|
+
**Robust JSON handling for LLM workflows.**
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
Extract JSON from output.md using jsonExtract tool.
|
|
100
|
+
Validate data.json against schema.json using jsonValidate tool.
|
|
101
|
+
Infer schema from sample.json using jsonInfer tool.
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Database Tools
|
|
105
|
+
|
|
106
|
+
Query MySQL and MongoDB databases with read-only access.
|
|
107
|
+
|
|
108
|
+
**Explore your data warehouse without leaving the conversation.**
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
List all tables in the database.
|
|
112
|
+
Describe the schema for table users.
|
|
113
|
+
Query orders placed in the last 30 days.
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Configuration via `env.jsonc` in working directory. Use the `env-jsonc-setup` skill for guided setup.
|
|
117
|
+
|
|
118
|
+
## Skills
|
|
119
119
|
|
|
120
120
|
Skills are reusable prompt templates discovered from multiple paths:
|
|
121
121
|
|
|
@@ -128,16 +128,16 @@ Skills are reusable prompt templates discovered from multiple paths:
|
|
|
128
128
|
|
|
129
129
|
This plugin provides a skill tool that overrides Opencode's built-in to support plugin-shipped skills.
|
|
130
130
|
|
|
131
|
-
See
|
|
131
|
+
See README in `tools/skill` for full documentation.
|
|
132
|
+
|
|
133
|
+
### Supplied skills
|
|
132
134
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
- `
|
|
136
|
-
- `
|
|
137
|
-
- `
|
|
138
|
-
- `
|
|
139
|
-
- `bioresearcher-core`: core patterns and utilities (retry, JSON tools, subagent waves) for skill development.
|
|
140
|
-
- `env-jsonc-setup`: guided setup for database connection configuration (db-tools).
|
|
135
|
+
- `demo-skill`: showcase skill tool mechanisms.
|
|
136
|
+
- `python-setup-uv`: setup python runtime in your working directory with uv.
|
|
137
|
+
- `pubmed-weekly`: automated download of pubmed daily update files over the past one week.
|
|
138
|
+
- `long-table-summary`: batch-process large tables using parallel subagents for summarization.
|
|
139
|
+
- `bioresearcher-core`: core patterns and utilities (retry, JSON tools, subagent waves) for skill development.
|
|
140
|
+
- `env-jsonc-setup`: guided setup for database connection configuration (db-tools).
|
|
141
141
|
|
|
142
142
|
Prompt the following and follow along:
|
|
143
143
|
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createBioResearcherAgent } from "./agents/bioresearcher/index";
|
|
2
2
|
import { createBioResearcherDRAgent } from "./agents/bioresearcherDR/index";
|
|
3
3
|
import { createBioResearcherDRWorkerAgent } from "./agents/bioresearcherDR_worker/index";
|
|
4
|
-
import { tableTools } from "./
|
|
5
|
-
import { dbTools } from "./
|
|
6
|
-
import { blockingTimer, calculator, jsonExtract, jsonValidate, jsonInfer } from "./
|
|
7
|
-
import { parse_pubmed_articleSet } from "./
|
|
8
|
-
import { parse_obo_file } from "./
|
|
9
|
-
import { SkillTool } from "./skill
|
|
4
|
+
import { tableTools } from "./tools/table/index";
|
|
5
|
+
import { dbTools } from "./tools/db/index";
|
|
6
|
+
import { blockingTimer, calculator, jsonExtract, jsonValidate, jsonInfer } from "./tools/misc/index";
|
|
7
|
+
import { parse_pubmed_articleSet } from "./tools/parser/pubmed";
|
|
8
|
+
import { parse_obo_file } from "./tools/parser/obo";
|
|
9
|
+
import { SkillTool } from "./tools/skill";
|
|
10
10
|
export const BioResearcherPlugin = async () => {
|
|
11
11
|
return {
|
|
12
12
|
config: async (config) => {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# BioResearcher Tests Skill
|
|
2
|
+
|
|
3
|
+
Comprehensive test suite for the bioresearcher plugin.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
skill bioresearcher-tests
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Then follow the workflow steps in SKILL.md.
|
|
12
|
+
|
|
13
|
+
## Test Coverage
|
|
14
|
+
|
|
15
|
+
### Parser Tools
|
|
16
|
+
- `parse_pubmed_articleSet` - PubMed XML parsing (single/excel/individual modes)
|
|
17
|
+
- `parse_obo_file` - OBO ontology parsing
|
|
18
|
+
|
|
19
|
+
### Table Tools (13 tools)
|
|
20
|
+
- `tableListSheets` - List worksheets
|
|
21
|
+
- `tableGetSheetPreview` - Preview first 6 rows
|
|
22
|
+
- `tableGetHeaders` - Get column headers
|
|
23
|
+
- `tableGetCell` - Get cell by address
|
|
24
|
+
- `tableGetRange` - Get range of cells
|
|
25
|
+
- `tableFilterRows` - Filter with conditions
|
|
26
|
+
- `tableSearch` - Search across cells
|
|
27
|
+
- `tableSummarize` - Statistical summary
|
|
28
|
+
- `tableGroupBy` - Group aggregation
|
|
29
|
+
- `tablePivotSummary` - Pivot tables
|
|
30
|
+
- `tableCreateFile` - Create new file
|
|
31
|
+
- `tableAppendRows` - Append rows
|
|
32
|
+
- `tableUpdateCell` - Update cell
|
|
33
|
+
|
|
34
|
+
### JSON Tools
|
|
35
|
+
- `jsonExtract` - Extract JSON from files
|
|
36
|
+
- `jsonValidate` - Validate against schema
|
|
37
|
+
- `jsonInfer` - Infer schema from data
|
|
38
|
+
|
|
39
|
+
### Misc Tools
|
|
40
|
+
- `blockingTimer` - Blocking delays
|
|
41
|
+
- `calculator` - Math expressions
|
|
42
|
+
|
|
43
|
+
### Skills
|
|
44
|
+
- `demo-skill` - Full execution
|
|
45
|
+
- `bioresearcher-core` - Full execution
|
|
46
|
+
- Other skills - Metadata only (use Question tool)
|
|
47
|
+
|
|
48
|
+
## Not Tested
|
|
49
|
+
|
|
50
|
+
### Database Tools
|
|
51
|
+
Require live database connection:
|
|
52
|
+
- `dbQuery`
|
|
53
|
+
- `dbListTables`
|
|
54
|
+
- `dbDescribeTable`
|
|
55
|
+
|
|
56
|
+
### Interactive Skills
|
|
57
|
+
Use Question tool (user interaction):
|
|
58
|
+
- `python-setup-uv`
|
|
59
|
+
- `long-table-summary`
|
|
60
|
+
- `env-jsonc-setup`
|
|
61
|
+
- `pubmed-weekly`
|
|
62
|
+
|
|
63
|
+
## Report Output
|
|
64
|
+
|
|
65
|
+
Tests generate `.bioresearcher-tests/test_report.md` containing:
|
|
66
|
+
- Pass/fail summary by category
|
|
67
|
+
- List of skipped tests with reasons
|
|
68
|
+
- Detailed failure diagnostics
|
|
69
|
+
- Validator results for each test
|
|
70
|
+
|
|
71
|
+
## File Structure
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
bioresearcher-tests/
|
|
75
|
+
├── SKILL.md # Main skill with workflow
|
|
76
|
+
├── README.md # This file
|
|
77
|
+
├── pyproject.toml # Python project config
|
|
78
|
+
├── test_runner.py # Test structure generator
|
|
79
|
+
├── resources/ # Gzipped test inputs
|
|
80
|
+
│ ├── pubmed_sample.xml.gz
|
|
81
|
+
│ ├── obo_sample.obo.gz
|
|
82
|
+
│ ├── table_sample.xlsx.gz
|
|
83
|
+
│ └── json_samples/*.gz
|
|
84
|
+
└── test_cases/ # Test definitions
|
|
85
|
+
├── parser_tests.md
|
|
86
|
+
├── table_tests.md
|
|
87
|
+
├── json_tests.md
|
|
88
|
+
├── misc_tests.md
|
|
89
|
+
└── skill_tests.md
|
|
90
|
+
```
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bioresearcher-tests
|
|
3
|
+
description: Comprehensive tests for bioresearcher plugin tools and skills
|
|
4
|
+
allowedTools:
|
|
5
|
+
- Bash
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- jsonExtract
|
|
9
|
+
- jsonValidate
|
|
10
|
+
- jsonInfer
|
|
11
|
+
- tableListSheets
|
|
12
|
+
- tableGetSheetPreview
|
|
13
|
+
- tableGetHeaders
|
|
14
|
+
- tableGetRange
|
|
15
|
+
- tableGetCell
|
|
16
|
+
- tableFilterRows
|
|
17
|
+
- tableSearch
|
|
18
|
+
- tableSummarize
|
|
19
|
+
- tableGroupBy
|
|
20
|
+
- tablePivotSummary
|
|
21
|
+
- tableAppendRows
|
|
22
|
+
- tableUpdateCell
|
|
23
|
+
- tableCreateFile
|
|
24
|
+
- blockingTimer
|
|
25
|
+
- calculator
|
|
26
|
+
- parse_pubmed_articleSet
|
|
27
|
+
- parse_obo_file
|
|
28
|
+
- skill
|
|
29
|
+
- Question
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
# BioResearcher Plugin Tests
|
|
33
|
+
|
|
34
|
+
Comprehensive test suite for bioresearcher plugin tools and skills.
|
|
35
|
+
|
|
36
|
+
## Test Scope
|
|
37
|
+
|
|
38
|
+
| Category | Tools | Status |
|
|
39
|
+
|----------|-------|--------|
|
|
40
|
+
| Parser | `parse_pubmed_articleSet`, `parse_obo_file` | Full tests |
|
|
41
|
+
| Table | All 13 `table*` tools | Full tests + negative tests |
|
|
42
|
+
| JSON | `jsonExtract`, `jsonValidate`, `jsonInfer` | Full tests |
|
|
43
|
+
| Misc | `blockingTimer`, `calculator` | Full tests |
|
|
44
|
+
| Skills | `demo-skill` | Full execution |
|
|
45
|
+
| Skills | `bioresearcher-core` | Metadata only |
|
|
46
|
+
| Skills | With Question tool | Metadata only |
|
|
47
|
+
| **Database** | `dbQuery`, `dbListTables`, `dbDescribeTable` | **NOT TESTED** |
|
|
48
|
+
|
|
49
|
+
> **Note:** Database tools are not tested because they require a live database connection configured via `env.jsonc`. These tools should be tested separately with a proper database environment.
|
|
50
|
+
|
|
51
|
+
## Workflow
|
|
52
|
+
|
|
53
|
+
### Step 1: Extract Skill Path
|
|
54
|
+
|
|
55
|
+
After loading this skill, extract `<skill_path>` from the `<skill_files>` section. Use this path in subsequent steps.
|
|
56
|
+
|
|
57
|
+
### Step 2: Prepare Test Workspace
|
|
58
|
+
|
|
59
|
+
Create workspace and extract all gzipped resources using Python (cross-platform):
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
python -c "
|
|
63
|
+
import gzip, shutil
|
|
64
|
+
from pathlib import Path
|
|
65
|
+
resources = Path('<skill_path>/resources')
|
|
66
|
+
workspace = Path('.bioresearcher-tests/workspace')
|
|
67
|
+
(workspace / 'json_samples').mkdir(parents=True, exist_ok=True)
|
|
68
|
+
files = [
|
|
69
|
+
('pubmed_sample.xml.gz', 'pubmed_sample.xml'),
|
|
70
|
+
('obo_sample.obo.gz', 'obo_sample.obo'),
|
|
71
|
+
('table_sample.xlsx.gz', 'table_sample.xlsx'),
|
|
72
|
+
('json_samples/simple_object.json.gz', 'json_samples/simple_object.json'),
|
|
73
|
+
('json_samples/simple_array.json.gz', 'json_samples/simple_array.json'),
|
|
74
|
+
('json_samples/nested_object.json.gz', 'json_samples/nested_object.json'),
|
|
75
|
+
('json_samples/in_markdown.md.gz', 'json_samples/in_markdown.md'),
|
|
76
|
+
('json_samples/schema_draft7.json.gz', 'json_samples/schema_draft7.json'),
|
|
77
|
+
]
|
|
78
|
+
for src, dst in files:
|
|
79
|
+
with gzip.open(resources / src, 'rb') as f_in:
|
|
80
|
+
with open(workspace / dst, 'wb') as f_out:
|
|
81
|
+
shutil.copyfileobj(f_in, f_out)
|
|
82
|
+
print('Workspace prepared successfully')
|
|
83
|
+
"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Step 3: Run Parser Tests
|
|
87
|
+
|
|
88
|
+
Execute tests from `<skill_path>/test_cases/parser_tests.md`:
|
|
89
|
+
|
|
90
|
+
1. **PubMed XML - Single Mode**: Call `parse_pubmed_articleSet` with `filePath`, `outputMode: "single"`
|
|
91
|
+
2. **PubMed XML - Excel Mode**: Call with `outputMode: "excel"`
|
|
92
|
+
3. **PubMed XML - Individual Mode**: Call with `outputMode: "individual"`
|
|
93
|
+
4. **OBO - Basic Parsing**: Call `parse_obo_file` with sample OBO
|
|
94
|
+
5. **PubMed - Nonexistent File**: Test error handling
|
|
95
|
+
|
|
96
|
+
Record pass/fail for each test.
|
|
97
|
+
|
|
98
|
+
### Step 4: Run Table Tests
|
|
99
|
+
|
|
100
|
+
Execute tests from `<skill_path>/test_cases/table_tests.md`:
|
|
101
|
+
|
|
102
|
+
1. `tableListSheets` - List sheets in sample Excel
|
|
103
|
+
2. `tableGetSheetPreview` - Get first 6 rows
|
|
104
|
+
3. `tableGetHeaders` - Get column headers
|
|
105
|
+
4. `tableGetCell` - Get specific cell value
|
|
106
|
+
5. `tableGetRange` - Get A1:C3 range
|
|
107
|
+
6. `tableFilterRows` - Filter by Age > 25
|
|
108
|
+
7. `tableSearch` - Search for "test"
|
|
109
|
+
8. `tableSummarize` - Get stats for numeric columns
|
|
110
|
+
9. `tableGroupBy` - Group by Category
|
|
111
|
+
10. `tableCreateFile` - Create new Excel file
|
|
112
|
+
11. `tableAppendRows` - Append row to file
|
|
113
|
+
12. `tableUpdateCell` - Update cell A1
|
|
114
|
+
13. `tablePivotSummary` - Create pivot table
|
|
115
|
+
|
|
116
|
+
Record pass/fail for each test.
|
|
117
|
+
|
|
118
|
+
### Step 5: Run JSON Tests
|
|
119
|
+
|
|
120
|
+
Execute tests from `<skill_path>/test_cases/json_tests.md`:
|
|
121
|
+
|
|
122
|
+
1. `jsonExtract` - Simple object
|
|
123
|
+
2. `jsonExtract` - Array
|
|
124
|
+
3. `jsonExtract` - Nested object
|
|
125
|
+
4. `jsonExtract` - JSON in markdown code block
|
|
126
|
+
5. `jsonExtract` - Return all mode
|
|
127
|
+
6. `jsonExtract` - File not found error
|
|
128
|
+
7. `jsonValidate` - Valid data
|
|
129
|
+
8. `jsonValidate` - Invalid data
|
|
130
|
+
9. `jsonValidate` - Schema from file
|
|
131
|
+
10. `jsonInfer` - Object inference
|
|
132
|
+
11. `jsonInfer` - Array inference
|
|
133
|
+
12. `jsonInfer` - Strict mode
|
|
134
|
+
|
|
135
|
+
Record pass/fail for each test.
|
|
136
|
+
|
|
137
|
+
### Step 6: Run Misc Tests
|
|
138
|
+
|
|
139
|
+
Execute tests from `<skill_path>/test_cases/misc_tests.md`:
|
|
140
|
+
|
|
141
|
+
1. `blockingTimer` - 1 second delay
|
|
142
|
+
2. `blockingTimer` - Zero delay
|
|
143
|
+
3. `calculator` - Basic arithmetic (2 + 3 * 4)
|
|
144
|
+
4. `calculator` - Power (2 ^ 10)
|
|
145
|
+
5. `calculator` - Brackets ((2 + 3) * 4)
|
|
146
|
+
6. `calculator` - Scientific notation (1e3 + 500)
|
|
147
|
+
7. `calculator` - Division by zero
|
|
148
|
+
8. `calculator` - Invalid syntax (2(3))
|
|
149
|
+
9. `calculator` - Precision (10 / 3 with precision 2)
|
|
150
|
+
|
|
151
|
+
Record pass/fail for each test.
|
|
152
|
+
|
|
153
|
+
### Step 7: Run Skill Tests
|
|
154
|
+
|
|
155
|
+
Execute tests from `<skill_path>/test_cases/skill_tests.md`:
|
|
156
|
+
|
|
157
|
+
1. Load `demo-skill` - Verify content returned
|
|
158
|
+
2. Load `bioresearcher-core` - Verify allowedTools present
|
|
159
|
+
3. Execute demo-skill script (no Question tool)
|
|
160
|
+
4. Test nonexistent skill error
|
|
161
|
+
|
|
162
|
+
**Skip these skills (use Question tool):**
|
|
163
|
+
- `python-setup-uv`
|
|
164
|
+
- `long-table-summary`
|
|
165
|
+
- `env-jsonc-setup`
|
|
166
|
+
- `pubmed-weekly`
|
|
167
|
+
|
|
168
|
+
### Step 8: Generate Report
|
|
169
|
+
|
|
170
|
+
Create `.bioresearcher-tests/test_report.md` with:
|
|
171
|
+
|
|
172
|
+
```markdown
|
|
173
|
+
# BioResearcher Plugin Test Report
|
|
174
|
+
|
|
175
|
+
**Run Date:** <timestamp>
|
|
176
|
+
**Total Tests:** <count>
|
|
177
|
+
**Passed:** <count>
|
|
178
|
+
**Failed:** <count>
|
|
179
|
+
|
|
180
|
+
## Summary by Category
|
|
181
|
+
|
|
182
|
+
| Category | Passed | Failed |
|
|
183
|
+
|----------|--------|--------|
|
|
184
|
+
| Parser | X/Y | Z |
|
|
185
|
+
| Table | X/Y | Z |
|
|
186
|
+
| JSON | X/Y | Z |
|
|
187
|
+
| Misc | X/Y | Z |
|
|
188
|
+
| Skills | X/Y | Z |
|
|
189
|
+
|
|
190
|
+
## Skipped Tests
|
|
191
|
+
|
|
192
|
+
### Database Tools (Not Tested)
|
|
193
|
+
- `dbQuery` - Requires live database connection
|
|
194
|
+
- `dbListTables` - Requires live database connection
|
|
195
|
+
- `dbDescribeTable` - Requires live database connection
|
|
196
|
+
|
|
197
|
+
### Skills with User Interaction (Metadata Only)
|
|
198
|
+
- `python-setup-uv` - Uses Question tool
|
|
199
|
+
- `long-table-summary` - Uses Question tool
|
|
200
|
+
- `env-jsonc-setup` - Uses Question tool
|
|
201
|
+
- `pubmed-weekly` - Uses Question tool
|
|
202
|
+
|
|
203
|
+
## Failed Tests
|
|
204
|
+
|
|
205
|
+
<For each failed test:>
|
|
206
|
+
### <Category>: <Test Name>
|
|
207
|
+
- **Tool:** `<tool_name>`
|
|
208
|
+
- **Expected:** <expected>
|
|
209
|
+
- **Actual:** <actual>
|
|
210
|
+
- **Error:** <error if any>
|
|
211
|
+
|
|
212
|
+
## Detailed Results
|
|
213
|
+
|
|
214
|
+
| Test | Tool | Status |
|
|
215
|
+
|------|------|--------|
|
|
216
|
+
| <name> | `<tool>` | PASS/FAIL |
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Test Case Format
|
|
220
|
+
|
|
221
|
+
Each test case follows this format:
|
|
222
|
+
|
|
223
|
+
```markdown
|
|
224
|
+
## Test: <test_name>
|
|
225
|
+
- Tool: <tool_name>
|
|
226
|
+
- Input:
|
|
227
|
+
```json
|
|
228
|
+
{<input_params>}
|
|
229
|
+
```
|
|
230
|
+
- Validators:
|
|
231
|
+
- <validation_rule>
|
|
232
|
+
- Expected: <expected_outcome>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Validation Rules
|
|
236
|
+
|
|
237
|
+
| Rule | Description |
|
|
238
|
+
|------|-------------|
|
|
239
|
+
| `success_is_true` | Result has `success: true` |
|
|
240
|
+
| `success_is_false` | Result has `success: false` |
|
|
241
|
+
| `file_exists` | Output file exists |
|
|
242
|
+
| `json_valid` | Output is valid JSON |
|
|
243
|
+
| `stats.total === N` | Stats total equals N |
|
|
244
|
+
| `array_length >= N` | Array has at least N items |
|
|
245
|
+
| `contains_string("x")` | Output contains string |
|
|
246
|
+
| `error.code === "X"` | Error has specific code |
|
|
247
|
+
| `result === N` | Result equals N |
|
|
248
|
+
|
|
249
|
+
### Step 9: Cleanup (Optional)
|
|
250
|
+
|
|
251
|
+
Remove test workspace:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
rm -rf .bioresearcher-tests/
|
|
255
|
+
```
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# JSON Tool Tests
|
|
2
|
+
|
|
3
|
+
## Test: Extract - Simple Object
|
|
4
|
+
- Tool: jsonExtract
|
|
5
|
+
- Input:
|
|
6
|
+
```json
|
|
7
|
+
{"file_path": ".bioresearcher-tests/workspace/json_samples/simple_object.json", "return_all": false}
|
|
8
|
+
```
|
|
9
|
+
- Validators:
|
|
10
|
+
- success_is_true
|
|
11
|
+
- has data object
|
|
12
|
+
- data.name === "test"
|
|
13
|
+
- data.value === 42
|
|
14
|
+
- Expected: Parsed JSON object with name="test", value=42
|
|
15
|
+
|
|
16
|
+
## Test: Extract - Array
|
|
17
|
+
- Tool: jsonExtract
|
|
18
|
+
- Input:
|
|
19
|
+
```json
|
|
20
|
+
{"file_path": ".bioresearcher-tests/workspace/json_samples/simple_array.json", "return_all": false}
|
|
21
|
+
```
|
|
22
|
+
- Validators:
|
|
23
|
+
- success_is_true
|
|
24
|
+
- isArray(data)
|
|
25
|
+
- array_length >= 3
|
|
26
|
+
- Expected: Parsed JSON array [1, 2, 3]
|
|
27
|
+
|
|
28
|
+
## Test: Extract - Nested Object
|
|
29
|
+
- Tool: jsonExtract
|
|
30
|
+
- Input:
|
|
31
|
+
```json
|
|
32
|
+
{"file_path": ".bioresearcher-tests/workspace/json_samples/nested_object.json", "return_all": false}
|
|
33
|
+
```
|
|
34
|
+
- Validators:
|
|
35
|
+
- success_is_true
|
|
36
|
+
- has data.nested
|
|
37
|
+
- Expected: Nested object parsed with data.nested.deep
|
|
38
|
+
|
|
39
|
+
## Test: Extract - From Markdown
|
|
40
|
+
- Tool: jsonExtract
|
|
41
|
+
- Input:
|
|
42
|
+
```json
|
|
43
|
+
{"file_path": ".bioresearcher-tests/workspace/json_samples/in_markdown.md", "return_all": false}
|
|
44
|
+
```
|
|
45
|
+
- Validators:
|
|
46
|
+
- success_is_true
|
|
47
|
+
- data.embedded === "true"
|
|
48
|
+
- method === "json_code_block"
|
|
49
|
+
- Expected: JSON extracted from markdown code block
|
|
50
|
+
|
|
51
|
+
## Test: Extract - Return All
|
|
52
|
+
- Tool: jsonExtract
|
|
53
|
+
- Input:
|
|
54
|
+
```json
|
|
55
|
+
{"file_path": ".bioresearcher-tests/workspace/json_samples/simple_array.json", "return_all": true}
|
|
56
|
+
```
|
|
57
|
+
- Validators:
|
|
58
|
+
- success_is_true
|
|
59
|
+
- has count
|
|
60
|
+
- Expected: Array with count metadata
|
|
61
|
+
|
|
62
|
+
## Test: Extract - File Not Found
|
|
63
|
+
- Tool: jsonExtract
|
|
64
|
+
- Input:
|
|
65
|
+
```json
|
|
66
|
+
{"file_path": ".bioresearcher-tests/workspace/nonexistent.json", "return_all": false}
|
|
67
|
+
```
|
|
68
|
+
- Validators:
|
|
69
|
+
- success_is_false
|
|
70
|
+
- error.code === "FILE_NOT_FOUND"
|
|
71
|
+
- Expected: File not found error
|
|
72
|
+
|
|
73
|
+
## Test: Validate - Valid Data
|
|
74
|
+
- Tool: jsonValidate
|
|
75
|
+
- Input:
|
|
76
|
+
```json
|
|
77
|
+
{"data": "{\"name\": \"test\", \"value\": 42}", "schema": "{\"type\": \"object\", \"properties\": {\"name\": {\"type\": \"string\"}, \"value\": {\"type\": \"number\"}}, \"required\": [\"name\"]}"}
|
|
78
|
+
```
|
|
79
|
+
- Validators:
|
|
80
|
+
- success_is_true
|
|
81
|
+
- valid === true OR has data
|
|
82
|
+
- Expected: Validation passes
|
|
83
|
+
|
|
84
|
+
## Test: Validate - Invalid Data
|
|
85
|
+
- Tool: jsonValidate
|
|
86
|
+
- Input:
|
|
87
|
+
```json
|
|
88
|
+
{"data": "{\"name\": 123}", "schema": "{\"type\": \"object\", \"properties\": {\"name\": {\"type\": \"string\"}}, \"required\": [\"name\"]}"}
|
|
89
|
+
```
|
|
90
|
+
- Validators:
|
|
91
|
+
- success_is_true
|
|
92
|
+
- has errors
|
|
93
|
+
- Expected: Validation errors (name should be string)
|
|
94
|
+
|
|
95
|
+
## Test: Validate - From Schema File
|
|
96
|
+
- Tool: jsonValidate
|
|
97
|
+
- Input:
|
|
98
|
+
```json
|
|
99
|
+
{"data": "{\"name\": \"test\", \"value\": 42}", "schema": ".bioresearcher-tests/workspace/json_samples/schema_draft7.json"}
|
|
100
|
+
```
|
|
101
|
+
- Validators:
|
|
102
|
+
- success_is_true
|
|
103
|
+
- Expected: Schema loaded from file and validation passes
|
|
104
|
+
|
|
105
|
+
## Test: Infer - Object
|
|
106
|
+
- Tool: jsonInfer
|
|
107
|
+
- Input:
|
|
108
|
+
```json
|
|
109
|
+
{"data": "{\"name\": \"test\", \"count\": 5, \"active\": true}", "strict": false}
|
|
110
|
+
```
|
|
111
|
+
- Validators:
|
|
112
|
+
- success_is_true
|
|
113
|
+
- has data object
|
|
114
|
+
- inferredType === "object"
|
|
115
|
+
- Expected: JSON Schema inferred for object
|
|
116
|
+
|
|
117
|
+
## Test: Infer - Array
|
|
118
|
+
- Tool: jsonInfer
|
|
119
|
+
- Input:
|
|
120
|
+
```json
|
|
121
|
+
{"data": "[1, 2, 3, 4, 5]", "strict": false}
|
|
122
|
+
```
|
|
123
|
+
- Validators:
|
|
124
|
+
- success_is_true
|
|
125
|
+
- inferredType === "array"
|
|
126
|
+
- Expected: Array schema inferred
|
|
127
|
+
|
|
128
|
+
## Test: Infer - Strict Mode
|
|
129
|
+
- Tool: jsonInfer
|
|
130
|
+
- Input:
|
|
131
|
+
```json
|
|
132
|
+
{"data": "{\"name\": \"test\"}", "strict": true}
|
|
133
|
+
```
|
|
134
|
+
- Validators:
|
|
135
|
+
- success_is_true
|
|
136
|
+
- strictMode === "true"
|
|
137
|
+
- Expected: Schema with required fields
|