research-buddy 1.0.0__tar.gz
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.
- research_buddy-1.0.0/LICENSE +21 -0
- research_buddy-1.0.0/PKG-INFO +234 -0
- research_buddy-1.0.0/README.md +204 -0
- research_buddy-1.0.0/pyproject.toml +92 -0
- research_buddy-1.0.0/setup.cfg +4 -0
- research_buddy-1.0.0/src/research_buddy/__init__.py +3 -0
- research_buddy-1.0.0/src/research_buddy/build.py +737 -0
- research_buddy-1.0.0/src/research_buddy/css/style.css +234 -0
- research_buddy-1.0.0/src/research_buddy/images/research-buddy.png +0 -0
- research_buddy-1.0.0/src/research_buddy/js/script.js +151 -0
- research_buddy-1.0.0/src/research_buddy/lib/highlight-theme.min.css +1 -0
- research_buddy-1.0.0/src/research_buddy/lib/highlight.min.js +1244 -0
- research_buddy-1.0.0/src/research_buddy/main.py +386 -0
- research_buddy-1.0.0/src/research_buddy/schema.json +779 -0
- research_buddy-1.0.0/src/research_buddy/starter.json +418 -0
- research_buddy-1.0.0/src/research_buddy/validator.py +208 -0
- research_buddy-1.0.0/src/research_buddy.egg-info/PKG-INFO +234 -0
- research_buddy-1.0.0/src/research_buddy.egg-info/SOURCES.txt +25 -0
- research_buddy-1.0.0/src/research_buddy.egg-info/dependency_links.txt +1 -0
- research_buddy-1.0.0/src/research_buddy.egg-info/entry_points.txt +2 -0
- research_buddy-1.0.0/src/research_buddy.egg-info/requires.txt +11 -0
- research_buddy-1.0.0/src/research_buddy.egg-info/top_level.txt +1 -0
- research_buddy-1.0.0/tests/test_build.py +192 -0
- research_buddy-1.0.0/tests/test_errors.py +77 -0
- research_buddy-1.0.0/tests/test_main.py +158 -0
- research_buddy-1.0.0/tests/test_validator.py +131 -0
- research_buddy-1.0.0/tests/test_validators.py +85 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 nuncaeslupus
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: research-buddy
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Structured AI research collaborator — generates high-fidelity HTML from versioned JSON research documents.
|
|
5
|
+
Author-email: nuncaeslupus <imarcos@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: documentation,html-generator,research,single-file,tabbed-docs
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Topic :: Documentation
|
|
15
|
+
Classifier: Topic :: Text Processing :: Markup :: HTML
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: jsonschema>=4.0.0
|
|
20
|
+
Requires-Dist: watchdog>=3.0.0
|
|
21
|
+
Requires-Dist: weasyprint>=60.0
|
|
22
|
+
Requires-Dist: argcomplete>=3.0.0
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
26
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
27
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: types-jsonschema>=4.0.0; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# Research Buddy v1.0
|
|
32
|
+
|
|
33
|
+

|
|
34
|
+
|
|
35
|
+
A structured AI research collaborator for any domain. Research Buddy pairs an AI agent with a versioned JSON document to conduct professional, multi-session research on any topic — from machine learning systems and medical research to physical product design, diet planning, patent research, and beyond.
|
|
36
|
+
|
|
37
|
+
## How it works
|
|
38
|
+
|
|
39
|
+
The AI agent reads `agent_guidelines` embedded in the JSON and behaves as a Research Buddy for the full lifetime of the project. Every session produces an updated, versioned JSON file — the source of truth — and optionally a rendered HTML document for reading.
|
|
40
|
+
|
|
41
|
+
**Session zero** (first session with a new document): the agent introduces itself, asks 5 questions to understand the project, does discovery research, and proposes the initial structure — tabs, source tiers, queue items, and methodology rules tailored to your domain. Output: `[project_name]_v1.0.json`.
|
|
42
|
+
|
|
43
|
+
**Subsequent sessions**: upload the latest JSON, say *"Continue research"* — the agent picks up exactly where you left off and works through the queue one topic at a time in ≤3 turns.
|
|
44
|
+
|
|
45
|
+
## Install
|
|
46
|
+
|
|
47
|
+
### For users (pip)
|
|
48
|
+
```bash
|
|
49
|
+
pip install research-buddy
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### For development
|
|
53
|
+
```bash
|
|
54
|
+
uv sync
|
|
55
|
+
# or:
|
|
56
|
+
pip install -e .
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
For PDF export (optional):
|
|
60
|
+
```bash
|
|
61
|
+
pip install weasyprint
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## For AI Agents
|
|
65
|
+
|
|
66
|
+
If you are an AI agent looking for the initial research template, it is located in:
|
|
67
|
+
- **Package path**: `research_buddy.starter.json` (when installed via pip)
|
|
68
|
+
- **Source path**: `src/research_buddy/starter.json` (in this repository)
|
|
69
|
+
|
|
70
|
+
### Generating HTML
|
|
71
|
+
|
|
72
|
+
After each research session, to give the user a readable HTML document:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install research-buddy
|
|
76
|
+
research-buddy build your-project.json
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The output will be `your-project.html` in the same directory.
|
|
80
|
+
|
|
81
|
+
### Workflow
|
|
82
|
+
|
|
83
|
+
1. **Session start**: User uploads their JSON file. If new, ask them to run `research-buddy init <project-name>` first to get the starter template.
|
|
84
|
+
2. **Session end**: After making changes, run `research-buddy build <json-file>` to generate HTML. Tell the user the HTML is ready and they can download it.
|
|
85
|
+
3. **Next session**: Ask the user to upload the latest JSON file and say "Continue research".
|
|
86
|
+
|
|
87
|
+
The JSON file is always the source of truth — never the HTML.
|
|
88
|
+
|
|
89
|
+
## Quick start
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Scaffold a new project
|
|
93
|
+
research-buddy init my-project/
|
|
94
|
+
|
|
95
|
+
# Upload my-project/source/research-document.json to your AI assistant
|
|
96
|
+
# The agent runs session_zero and produces [project_name]_v1.0.json
|
|
97
|
+
|
|
98
|
+
# Build HTML from the versioned output
|
|
99
|
+
research-buddy build my-project_v1.0.json
|
|
100
|
+
|
|
101
|
+
# Or point at the project directory — it finds the latest version automatically
|
|
102
|
+
research-buddy build my-project/
|
|
103
|
+
|
|
104
|
+
# Watch for changes
|
|
105
|
+
research-buddy build my-project/ --watch
|
|
106
|
+
|
|
107
|
+
# Open the result
|
|
108
|
+
open docs.html
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Research protocol
|
|
112
|
+
|
|
113
|
+
Every session follows the same high-integrity workflow:
|
|
114
|
+
|
|
115
|
+
1. **Preflight checks** — silent scan of rejected alternatives and tracker status.
|
|
116
|
+
2. **Research** — agent uses domain-appropriate Tier 1 sources with inline citations.
|
|
117
|
+
3. **Second-opinion brief** — printed at the end of Turn 1, ready to copy to other AI tools or human experts.
|
|
118
|
+
4. **Second-opinion review** — user submits research from ChatGPT, Gemini, Grok, human experts, or papers. The agent evaluates, labels each source (`Gemini-1`, `Human-1`, etc.), and integrates or discards findings with explicit rationale. The agent never generates second opinions itself.
|
|
119
|
+
5. **Confirmation gate** — agent presents all proposed decisions and waits for go-ahead before writing.
|
|
120
|
+
6. **Atomic write** — all update targets in a single operation, including version bump, queue update, and blue callout pointing to the next topic.
|
|
121
|
+
|
|
122
|
+
**Failure modes are explicit**: the document includes a failure_modes list that agents use to self-check before and after every action.
|
|
123
|
+
|
|
124
|
+
## File naming
|
|
125
|
+
|
|
126
|
+
| File | Purpose |
|
|
127
|
+
|---|---|
|
|
128
|
+
| `research-document.json` | Unversioned template — never modified after init |
|
|
129
|
+
| `[project_name]_v1.0.json` | First project file, produced by session_zero |
|
|
130
|
+
| `[project_name]_v1.1.json` | After first research session |
|
|
131
|
+
| `[project_name]_vX.Y.json` | Each subsequent session bumps MINOR |
|
|
132
|
+
|
|
133
|
+
The builder picks up any `*_vX.Y.json` file automatically. It falls back to `research-document.json` for the unversioned template.
|
|
134
|
+
|
|
135
|
+
## Commands
|
|
136
|
+
|
|
137
|
+
### `research-buddy init <dir>`
|
|
138
|
+
|
|
139
|
+
Scaffold a new project. Creates `source/research-document.json` (Research Buddy v1.0 template) and `versions/`.
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
research-buddy init my-project/ [--title "Project Name"] [--subtitle "..."]
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### `research-buddy build <path...>`
|
|
146
|
+
|
|
147
|
+
Build HTML from document JSON(s). Accepts files, directories, or both.
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
research-buddy build my-project/ # latest version in source/
|
|
151
|
+
research-buddy build myproject_v1.5.json # specific file
|
|
152
|
+
research-buddy build my-project/ --watch # rebuild on change
|
|
153
|
+
research-buddy build my-project/ --pdf # + PDF export (requires weasyprint)
|
|
154
|
+
research-buddy build my-project/ --output report.html
|
|
155
|
+
research-buddy build my-project/ --validate-only # check only, no HTML output
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### `research-buddy validate <path...>`
|
|
159
|
+
|
|
160
|
+
Validate JSON schema + semantic rules (reference ordering, required fields, language format, `research_buddy_version` presence).
|
|
161
|
+
|
|
162
|
+
## Project layout
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
my-project/
|
|
166
|
+
├── source/
|
|
167
|
+
│ └── research-document.json # Template (agent uploads this for session_zero)
|
|
168
|
+
├── versions/ # Versioned HTML builds
|
|
169
|
+
│ └── v1.0.html
|
|
170
|
+
├── docs.html # Latest stable build (copy of most recent version)
|
|
171
|
+
└── theme.css # Optional CSS overrides
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
After session_zero, the AI produces `myproject_v1.0.json`. Place it in `source/` and build:
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
my-project/
|
|
178
|
+
└── source/
|
|
179
|
+
├── research-document.json # Original template
|
|
180
|
+
└── myproject_v1.0.json # First project output from agent
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Multi-language support
|
|
184
|
+
|
|
185
|
+
The document language is set in session_zero based on the user's preference. `meta.language` accepts a string (`"English"`) or an object (`{"code": "es", "label": "Español"}`). The HTML `lang` attribute is set automatically. `agent_guidelines` always stays in English.
|
|
186
|
+
|
|
187
|
+
UI labels (`"OPEN"`, `"✦ Researched"`, `"Next Topic"`, etc.) are stored in `meta.ui_strings` and translated by the agent in session_zero — no hard-coded strings in document content.
|
|
188
|
+
|
|
189
|
+
## Document format
|
|
190
|
+
|
|
191
|
+
The JSON schema is bundled with the package. For reference, see `src/research_buddy/schema.json` or install the package and run `research-buddy validate --help`.
|
|
192
|
+
|
|
193
|
+
### Block types
|
|
194
|
+
|
|
195
|
+
| Type | Key fields |
|
|
196
|
+
|---|---|
|
|
197
|
+
| `p` | `md` |
|
|
198
|
+
| `h3`, `h4` | `md`, `id`, `badge` |
|
|
199
|
+
| `code` | `text`, `lang` |
|
|
200
|
+
| `callout` | `md`, `variant` (blue\|green\|amber\|red\|purple), `title` |
|
|
201
|
+
| `verdict` | `badge` (adopt\|reject\|defer\|pending), `label`, `md` |
|
|
202
|
+
| `table` | `headers[]`, `rows[][]` |
|
|
203
|
+
| `ul`, `ol` | `items[]` |
|
|
204
|
+
| `card_grid` | `cols` (2\|3), `cards[{title, md}]` |
|
|
205
|
+
| `phase_cards` | `cards[{phase, title, items[]}]` |
|
|
206
|
+
| `usage_banner` | `title`, `items[]` |
|
|
207
|
+
| `references` | `items[{version, date, text}]` |
|
|
208
|
+
| `svg` | `html` (raw SVG string) |
|
|
209
|
+
|
|
210
|
+
### Schema compatibility
|
|
211
|
+
|
|
212
|
+
`meta.research_buddy_version` is required in all documents. The validator warns if it is missing. When this version changes, schema or build script behaviour may change — always use the template that matches your installed version.
|
|
213
|
+
|
|
214
|
+
## Development
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
make sync # Install dev dependencies
|
|
218
|
+
make lint # ruff + mypy
|
|
219
|
+
make format # Auto-fix + format
|
|
220
|
+
make test # Run full test suite
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Examples
|
|
224
|
+
|
|
225
|
+
The `starter-example/` directory contains a pre-built HTML output from the starter template. Regenerate it with:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
pip install research-buddy
|
|
229
|
+
research-buddy build --help
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## License
|
|
233
|
+
|
|
234
|
+
MIT
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Research Buddy v1.0
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
A structured AI research collaborator for any domain. Research Buddy pairs an AI agent with a versioned JSON document to conduct professional, multi-session research on any topic — from machine learning systems and medical research to physical product design, diet planning, patent research, and beyond.
|
|
6
|
+
|
|
7
|
+
## How it works
|
|
8
|
+
|
|
9
|
+
The AI agent reads `agent_guidelines` embedded in the JSON and behaves as a Research Buddy for the full lifetime of the project. Every session produces an updated, versioned JSON file — the source of truth — and optionally a rendered HTML document for reading.
|
|
10
|
+
|
|
11
|
+
**Session zero** (first session with a new document): the agent introduces itself, asks 5 questions to understand the project, does discovery research, and proposes the initial structure — tabs, source tiers, queue items, and methodology rules tailored to your domain. Output: `[project_name]_v1.0.json`.
|
|
12
|
+
|
|
13
|
+
**Subsequent sessions**: upload the latest JSON, say *"Continue research"* — the agent picks up exactly where you left off and works through the queue one topic at a time in ≤3 turns.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
### For users (pip)
|
|
18
|
+
```bash
|
|
19
|
+
pip install research-buddy
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### For development
|
|
23
|
+
```bash
|
|
24
|
+
uv sync
|
|
25
|
+
# or:
|
|
26
|
+
pip install -e .
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
For PDF export (optional):
|
|
30
|
+
```bash
|
|
31
|
+
pip install weasyprint
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## For AI Agents
|
|
35
|
+
|
|
36
|
+
If you are an AI agent looking for the initial research template, it is located in:
|
|
37
|
+
- **Package path**: `research_buddy.starter.json` (when installed via pip)
|
|
38
|
+
- **Source path**: `src/research_buddy/starter.json` (in this repository)
|
|
39
|
+
|
|
40
|
+
### Generating HTML
|
|
41
|
+
|
|
42
|
+
After each research session, to give the user a readable HTML document:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install research-buddy
|
|
46
|
+
research-buddy build your-project.json
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The output will be `your-project.html` in the same directory.
|
|
50
|
+
|
|
51
|
+
### Workflow
|
|
52
|
+
|
|
53
|
+
1. **Session start**: User uploads their JSON file. If new, ask them to run `research-buddy init <project-name>` first to get the starter template.
|
|
54
|
+
2. **Session end**: After making changes, run `research-buddy build <json-file>` to generate HTML. Tell the user the HTML is ready and they can download it.
|
|
55
|
+
3. **Next session**: Ask the user to upload the latest JSON file and say "Continue research".
|
|
56
|
+
|
|
57
|
+
The JSON file is always the source of truth — never the HTML.
|
|
58
|
+
|
|
59
|
+
## Quick start
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Scaffold a new project
|
|
63
|
+
research-buddy init my-project/
|
|
64
|
+
|
|
65
|
+
# Upload my-project/source/research-document.json to your AI assistant
|
|
66
|
+
# The agent runs session_zero and produces [project_name]_v1.0.json
|
|
67
|
+
|
|
68
|
+
# Build HTML from the versioned output
|
|
69
|
+
research-buddy build my-project_v1.0.json
|
|
70
|
+
|
|
71
|
+
# Or point at the project directory — it finds the latest version automatically
|
|
72
|
+
research-buddy build my-project/
|
|
73
|
+
|
|
74
|
+
# Watch for changes
|
|
75
|
+
research-buddy build my-project/ --watch
|
|
76
|
+
|
|
77
|
+
# Open the result
|
|
78
|
+
open docs.html
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Research protocol
|
|
82
|
+
|
|
83
|
+
Every session follows the same high-integrity workflow:
|
|
84
|
+
|
|
85
|
+
1. **Preflight checks** — silent scan of rejected alternatives and tracker status.
|
|
86
|
+
2. **Research** — agent uses domain-appropriate Tier 1 sources with inline citations.
|
|
87
|
+
3. **Second-opinion brief** — printed at the end of Turn 1, ready to copy to other AI tools or human experts.
|
|
88
|
+
4. **Second-opinion review** — user submits research from ChatGPT, Gemini, Grok, human experts, or papers. The agent evaluates, labels each source (`Gemini-1`, `Human-1`, etc.), and integrates or discards findings with explicit rationale. The agent never generates second opinions itself.
|
|
89
|
+
5. **Confirmation gate** — agent presents all proposed decisions and waits for go-ahead before writing.
|
|
90
|
+
6. **Atomic write** — all update targets in a single operation, including version bump, queue update, and blue callout pointing to the next topic.
|
|
91
|
+
|
|
92
|
+
**Failure modes are explicit**: the document includes a failure_modes list that agents use to self-check before and after every action.
|
|
93
|
+
|
|
94
|
+
## File naming
|
|
95
|
+
|
|
96
|
+
| File | Purpose |
|
|
97
|
+
|---|---|
|
|
98
|
+
| `research-document.json` | Unversioned template — never modified after init |
|
|
99
|
+
| `[project_name]_v1.0.json` | First project file, produced by session_zero |
|
|
100
|
+
| `[project_name]_v1.1.json` | After first research session |
|
|
101
|
+
| `[project_name]_vX.Y.json` | Each subsequent session bumps MINOR |
|
|
102
|
+
|
|
103
|
+
The builder picks up any `*_vX.Y.json` file automatically. It falls back to `research-document.json` for the unversioned template.
|
|
104
|
+
|
|
105
|
+
## Commands
|
|
106
|
+
|
|
107
|
+
### `research-buddy init <dir>`
|
|
108
|
+
|
|
109
|
+
Scaffold a new project. Creates `source/research-document.json` (Research Buddy v1.0 template) and `versions/`.
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
research-buddy init my-project/ [--title "Project Name"] [--subtitle "..."]
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `research-buddy build <path...>`
|
|
116
|
+
|
|
117
|
+
Build HTML from document JSON(s). Accepts files, directories, or both.
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
research-buddy build my-project/ # latest version in source/
|
|
121
|
+
research-buddy build myproject_v1.5.json # specific file
|
|
122
|
+
research-buddy build my-project/ --watch # rebuild on change
|
|
123
|
+
research-buddy build my-project/ --pdf # + PDF export (requires weasyprint)
|
|
124
|
+
research-buddy build my-project/ --output report.html
|
|
125
|
+
research-buddy build my-project/ --validate-only # check only, no HTML output
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### `research-buddy validate <path...>`
|
|
129
|
+
|
|
130
|
+
Validate JSON schema + semantic rules (reference ordering, required fields, language format, `research_buddy_version` presence).
|
|
131
|
+
|
|
132
|
+
## Project layout
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
my-project/
|
|
136
|
+
├── source/
|
|
137
|
+
│ └── research-document.json # Template (agent uploads this for session_zero)
|
|
138
|
+
├── versions/ # Versioned HTML builds
|
|
139
|
+
│ └── v1.0.html
|
|
140
|
+
├── docs.html # Latest stable build (copy of most recent version)
|
|
141
|
+
└── theme.css # Optional CSS overrides
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
After session_zero, the AI produces `myproject_v1.0.json`. Place it in `source/` and build:
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
my-project/
|
|
148
|
+
└── source/
|
|
149
|
+
├── research-document.json # Original template
|
|
150
|
+
└── myproject_v1.0.json # First project output from agent
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Multi-language support
|
|
154
|
+
|
|
155
|
+
The document language is set in session_zero based on the user's preference. `meta.language` accepts a string (`"English"`) or an object (`{"code": "es", "label": "Español"}`). The HTML `lang` attribute is set automatically. `agent_guidelines` always stays in English.
|
|
156
|
+
|
|
157
|
+
UI labels (`"OPEN"`, `"✦ Researched"`, `"Next Topic"`, etc.) are stored in `meta.ui_strings` and translated by the agent in session_zero — no hard-coded strings in document content.
|
|
158
|
+
|
|
159
|
+
## Document format
|
|
160
|
+
|
|
161
|
+
The JSON schema is bundled with the package. For reference, see `src/research_buddy/schema.json` or install the package and run `research-buddy validate --help`.
|
|
162
|
+
|
|
163
|
+
### Block types
|
|
164
|
+
|
|
165
|
+
| Type | Key fields |
|
|
166
|
+
|---|---|
|
|
167
|
+
| `p` | `md` |
|
|
168
|
+
| `h3`, `h4` | `md`, `id`, `badge` |
|
|
169
|
+
| `code` | `text`, `lang` |
|
|
170
|
+
| `callout` | `md`, `variant` (blue\|green\|amber\|red\|purple), `title` |
|
|
171
|
+
| `verdict` | `badge` (adopt\|reject\|defer\|pending), `label`, `md` |
|
|
172
|
+
| `table` | `headers[]`, `rows[][]` |
|
|
173
|
+
| `ul`, `ol` | `items[]` |
|
|
174
|
+
| `card_grid` | `cols` (2\|3), `cards[{title, md}]` |
|
|
175
|
+
| `phase_cards` | `cards[{phase, title, items[]}]` |
|
|
176
|
+
| `usage_banner` | `title`, `items[]` |
|
|
177
|
+
| `references` | `items[{version, date, text}]` |
|
|
178
|
+
| `svg` | `html` (raw SVG string) |
|
|
179
|
+
|
|
180
|
+
### Schema compatibility
|
|
181
|
+
|
|
182
|
+
`meta.research_buddy_version` is required in all documents. The validator warns if it is missing. When this version changes, schema or build script behaviour may change — always use the template that matches your installed version.
|
|
183
|
+
|
|
184
|
+
## Development
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
make sync # Install dev dependencies
|
|
188
|
+
make lint # ruff + mypy
|
|
189
|
+
make format # Auto-fix + format
|
|
190
|
+
make test # Run full test suite
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Examples
|
|
194
|
+
|
|
195
|
+
The `starter-example/` directory contains a pre-built HTML output from the starter template. Regenerate it with:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
pip install research-buddy
|
|
199
|
+
research-buddy build --help
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
MIT
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "research-buddy"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Structured AI research collaborator — generates high-fidelity HTML from versioned JSON research documents."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "nuncaeslupus", email = "imarcos@gmail.com" }
|
|
14
|
+
]
|
|
15
|
+
keywords = ["documentation", "html-generator", "research", "single-file", "tabbed-docs"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 5 - Production/Stable",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Topic :: Documentation",
|
|
24
|
+
"Topic :: Text Processing :: Markup :: HTML",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"jsonschema>=4.0.0",
|
|
28
|
+
"watchdog>=3.0.0",
|
|
29
|
+
"weasyprint>=60.0",
|
|
30
|
+
"argcomplete>=3.0.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
dev = [
|
|
35
|
+
"pytest>=7.0.0",
|
|
36
|
+
"pytest-cov>=4.0.0",
|
|
37
|
+
"ruff>=0.1.0",
|
|
38
|
+
"mypy>=1.0.0",
|
|
39
|
+
"types-jsonschema>=4.0.0",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
research-buddy = "research_docs.main:main"
|
|
44
|
+
|
|
45
|
+
[tool.setuptools]
|
|
46
|
+
package-dir = {"" = "src"}
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.packages.find]
|
|
49
|
+
where = ["src"]
|
|
50
|
+
|
|
51
|
+
[tool.setuptools.package-data]
|
|
52
|
+
research_buddy = ["css/*", "js/*", "lib/*", "images/*", "*.json"]
|
|
53
|
+
|
|
54
|
+
[tool.ruff]
|
|
55
|
+
line-length = 100
|
|
56
|
+
target-version = "py311"
|
|
57
|
+
exclude = [".claude/", ".venv/", "tmp/"]
|
|
58
|
+
|
|
59
|
+
[tool.ruff.lint]
|
|
60
|
+
select = [
|
|
61
|
+
"E", # pycodestyle errors
|
|
62
|
+
"W", # pycodestyle warnings
|
|
63
|
+
"F", # pyflakes
|
|
64
|
+
"I", # isort
|
|
65
|
+
"UP", # pyupgrade
|
|
66
|
+
"RUF", # ruff-specific
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
[tool.pytest.ini_options]
|
|
70
|
+
testpaths = ["tests"]
|
|
71
|
+
python_files = ["test_*.py"]
|
|
72
|
+
python_classes = ["Test*"]
|
|
73
|
+
python_functions = ["test_*"]
|
|
74
|
+
addopts = "--strict-markers --tb=short"
|
|
75
|
+
markers = [
|
|
76
|
+
"slow: marks tests as slow",
|
|
77
|
+
"integration: marks tests as integration tests",
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[tool.mypy]
|
|
81
|
+
python_version = "3.11"
|
|
82
|
+
warn_return_any = true
|
|
83
|
+
warn_unused_configs = true
|
|
84
|
+
disallow_untyped_defs = true
|
|
85
|
+
disallow_incomplete_defs = true
|
|
86
|
+
check_untyped_defs = true
|
|
87
|
+
warn_redundant_casts = true
|
|
88
|
+
warn_unused_ignores = true
|
|
89
|
+
warn_no_return = true
|
|
90
|
+
show_error_codes = true
|
|
91
|
+
exclude = ["tests/", ".claude/", "tmp/"]
|
|
92
|
+
mypy_path = ["src"]
|