@cubocompany/opengem 0.1.0 → 0.2.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 +97 -97
- package/dist/cli.js +1511 -0
- package/package.json +12 -2
package/README.md
CHANGED
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OpenGem
|
|
2
2
|
|
|
3
|
-
OpenCode plugin
|
|
3
|
+
> OpenCode plugin for Obsidian — turn your vault into a compounding knowledge base powered by AI.
|
|
4
|
+
|
|
5
|
+
OpenGem connects [OpenCode](https://opencode.ai) to your [Obsidian](https://obsidian.md) vault via the official Obsidian CLI. You can read and write notes, build a structured wiki, ingest articles, query with citations, and more — all from natural language inside OpenCode.
|
|
4
6
|
|
|
5
7
|
## Requirements
|
|
6
8
|
|
|
7
|
-
- [OpenCode](https://opencode.ai) installed
|
|
8
|
-
- [Obsidian](https://obsidian.md) desktop app running
|
|
9
|
-
- [
|
|
9
|
+
- [OpenCode](https://opencode.ai) installed and on PATH
|
|
10
|
+
- [Obsidian](https://obsidian.md) desktop app installed and running
|
|
11
|
+
- [Obsidian CLI](https://obsidian.md/cli) installed and on PATH (`obsidian --version` should work)
|
|
10
12
|
|
|
11
13
|
## Install
|
|
12
14
|
|
|
13
|
-
### From npm (recommended)
|
|
14
|
-
|
|
15
|
-
Add the plugin to your `opencode.json`:
|
|
16
|
-
|
|
17
|
-
```json
|
|
18
|
-
{
|
|
19
|
-
"plugin": ["obsidian-opencode-plugin"]
|
|
20
|
-
}
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Local development
|
|
24
|
-
|
|
25
|
-
Clone the repository and link it via `.opencode/plugins/`:
|
|
26
|
-
|
|
27
15
|
```bash
|
|
28
|
-
|
|
29
|
-
cd obsidian-opencode-plugin
|
|
30
|
-
bun install
|
|
16
|
+
npx @cubocompany/opengem init
|
|
31
17
|
```
|
|
32
18
|
|
|
33
|
-
|
|
19
|
+
The setup wizard will:
|
|
20
|
+
- Check that the Obsidian CLI and app are available
|
|
21
|
+
- Let you pick your vault
|
|
22
|
+
- Write the config to `~/.opencode/opencode.json` (or your project folder)
|
|
23
|
+
- Initialize the wiki folder structure inside your vault
|
|
34
24
|
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
"plugin": ["/absolute/path/to/obsidian-opencode-plugin/src/index.ts"]
|
|
38
|
-
}
|
|
39
|
-
```
|
|
25
|
+
That's it — no JSON editing required.
|
|
40
26
|
|
|
41
|
-
##
|
|
27
|
+
## Wiki structure
|
|
42
28
|
|
|
43
|
-
|
|
29
|
+
`opengem init` creates the following inside your vault:
|
|
44
30
|
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
31
|
+
```
|
|
32
|
+
wiki/
|
|
33
|
+
INDEX.md ← auto-generated index of all wiki pages
|
|
34
|
+
LOG.md ← append-only log of every ingest and query
|
|
35
|
+
schema/
|
|
36
|
+
SCHEMA.md ← conventions for wiki pages (edit to customize)
|
|
37
|
+
raw/
|
|
38
|
+
.keep ← original sources go here, untouched
|
|
53
39
|
```
|
|
54
40
|
|
|
55
|
-
|
|
56
|
-
|---|---|---|---|
|
|
57
|
-
| `defaultVault` | `string` | `null` | Default vault for write operations |
|
|
58
|
-
|
|
59
|
-
## Skills
|
|
41
|
+
Safe to re-run — existing files are skipped unless you pass `force: true` inside OpenCode.
|
|
60
42
|
|
|
61
|
-
|
|
43
|
+
## Usage
|
|
62
44
|
|
|
63
|
-
|
|
45
|
+
Once initialized, just talk to OpenCode naturally:
|
|
64
46
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
bun run sync:skills --source=/path/to/obsidian-skills
|
|
73
|
-
```
|
|
47
|
+
| What you say | What happens |
|
|
48
|
+
|---|---|
|
|
49
|
+
| "Add this article to my wiki: https://..." | Fetches, ingests to `raw/` and `wiki/` |
|
|
50
|
+
| "What do I know about X?" | Searches wiki, answers with citations, saves to `wiki/answers/` |
|
|
51
|
+
| "Update my wiki page on Y" | Rewrites the page with new information |
|
|
52
|
+
| "Check my wiki for issues" | Runs lint — broken links, missing metadata |
|
|
53
|
+
| "Refresh my wiki index" | Rebuilds `wiki/INDEX.md` |
|
|
74
54
|
|
|
75
|
-
##
|
|
55
|
+
## Configuration
|
|
76
56
|
|
|
77
|
-
|
|
|
57
|
+
| Option | Type | Default | Description |
|
|
78
58
|
|---|---|---|---|
|
|
79
|
-
| `
|
|
80
|
-
| `obsidian_skills_check` | Validate discoverable skills | no | no |
|
|
81
|
-
| `obsidian_read` | Read a note by name or path | yes | yes |
|
|
82
|
-
| `obsidian_search` | Search vault content | yes | yes |
|
|
83
|
-
| `obsidian_create_note` | Create a new note | yes | yes |
|
|
84
|
-
| `obsidian_append_note` | Append text to a note | yes | yes |
|
|
85
|
-
| `obsidian_set_property` | Set a frontmatter property | yes | yes |
|
|
59
|
+
| `defaultVault` | `string` | auto-detected | Target vault for all operations |
|
|
86
60
|
|
|
87
|
-
|
|
61
|
+
Vault resolution order:
|
|
62
|
+
1. Explicit `vault` arg on the tool call
|
|
63
|
+
2. `defaultVault` in config
|
|
64
|
+
3. Active vault detected via `obsidian vault`
|
|
65
|
+
4. If only one vault exists, uses it automatically
|
|
88
66
|
|
|
89
|
-
|
|
67
|
+
## Tools
|
|
90
68
|
|
|
91
|
-
|
|
92
|
-
|
|
69
|
+
### Wiki workflows
|
|
70
|
+
| Tool | Description |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `obsidian_wiki_init` | Set up wiki folder structure (run once) |
|
|
73
|
+
| `obsidian_wiki_ingest` | Save a source to `raw/` and create a `wiki/` page |
|
|
74
|
+
| `obsidian_wiki_update` | Rewrite a wiki page with new content |
|
|
75
|
+
| `obsidian_wiki_search_cited` | Search wiki and return results with citations |
|
|
76
|
+
| `obsidian_wiki_save_answer` | Save an answer to `wiki/answers/` |
|
|
77
|
+
| `obsidian_wiki_refresh_index` | Regenerate `wiki/INDEX.md` |
|
|
78
|
+
| `obsidian_wiki_lint` | Check for broken links and missing metadata |
|
|
79
|
+
|
|
80
|
+
### Vault operations
|
|
81
|
+
| Tool | Description |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `obsidian_read` | Read a note by name or path |
|
|
84
|
+
| `obsidian_search` | Search vault content |
|
|
85
|
+
| `obsidian_create_note` | Create a new note |
|
|
86
|
+
| `obsidian_append_note` | Append text to a note |
|
|
87
|
+
| `obsidian_set_property` | Set a frontmatter property |
|
|
88
|
+
| `obsidian_backlinks` | List backlinks to a note |
|
|
89
|
+
| `obsidian_tags` | List all tags in the vault |
|
|
90
|
+
| `obsidian_tag_notes` | List notes with a specific tag |
|
|
91
|
+
|
|
92
|
+
### Developer tools
|
|
93
|
+
| Tool | Description |
|
|
94
|
+
|---|---|
|
|
95
|
+
| `obsidian_eval` | Execute JavaScript in Obsidian |
|
|
96
|
+
| `obsidian_dev_errors` | Show captured errors |
|
|
97
|
+
| `obsidian_dev_console` | Show captured console messages |
|
|
98
|
+
| `obsidian_dev_screenshot` | Take a screenshot |
|
|
99
|
+
| `obsidian_dev_dom` | Query DOM elements |
|
|
100
|
+
| `obsidian_dev_css` | Inspect CSS |
|
|
101
|
+
| `obsidian_plugins` | List installed plugins |
|
|
102
|
+
| `obsidian_plugin_reload` | Reload a plugin |
|
|
103
|
+
|
|
104
|
+
### Diagnostics
|
|
105
|
+
| Tool | Description |
|
|
106
|
+
|---|---|
|
|
107
|
+
| `obsidian_env_doctor` | Check CLI, app, vault, and skills status |
|
|
93
108
|
|
|
94
|
-
|
|
109
|
+
## Manual config (optional)
|
|
95
110
|
|
|
96
|
-
|
|
111
|
+
If you prefer to configure manually instead of running `init`, add to your `opencode.json`:
|
|
97
112
|
|
|
98
113
|
```json
|
|
99
114
|
{
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
"hint": "Ask OpenCode to use obsidian_env_doctor"
|
|
115
|
+
"plugin": [
|
|
116
|
+
["@cubocompany/opengem", {
|
|
117
|
+
"defaultVault": "My Vault"
|
|
118
|
+
}]
|
|
119
|
+
]
|
|
107
120
|
}
|
|
108
121
|
```
|
|
109
122
|
|
|
110
|
-
### Error codes
|
|
111
|
-
|
|
112
|
-
| Code | Cause |
|
|
113
|
-
|---|---|
|
|
114
|
-
| `CLI_NOT_FOUND` | `obsidian` binary not on PATH |
|
|
115
|
-
| `APP_NOT_RUNNING` | Obsidian desktop app not running |
|
|
116
|
-
| `VAULT_REQUIRED` | Write operation with no vault specified |
|
|
117
|
-
| `VAULT_NOT_FOUND` | Specified vault does not exist |
|
|
118
|
-
| `FILE_OR_PATH_REQUIRED` | Neither `file` nor `path` provided |
|
|
119
|
-
| `MUTUALLY_EXCLUSIVE_TARGET` | Both `file` and `path` provided |
|
|
120
|
-
| `PATH_OUTSIDE_VAULT` | Path traversal attempt rejected |
|
|
121
|
-
| `BUNDLED_SKILLS_OUT_OF_SYNC` | Skills missing from expected path |
|
|
122
|
-
|
|
123
123
|
## Development
|
|
124
124
|
|
|
125
125
|
```bash
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
bun
|
|
129
|
-
bun
|
|
126
|
+
git clone https://github.com/cubocompany/opengem
|
|
127
|
+
cd opengem
|
|
128
|
+
bun install
|
|
129
|
+
bun test # 121 tests
|
|
130
|
+
bun run check # TypeScript type-check
|
|
131
|
+
bun run build # builds dist/index.js (plugin) and dist/cli.js (init CLI)
|
|
130
132
|
```
|
|
131
133
|
|
|
132
|
-
##
|
|
134
|
+
## License
|
|
133
135
|
|
|
134
|
-
|
|
135
|
-
- **v1.5**: vault helpers, wikilink/frontmatter validation, backlinks, tags, dev tooling
|
|
136
|
-
- **v2**: LLM Wiki workflows — source ingestion, page updates, index refresh, answer-with-citations
|
|
136
|
+
MIT
|