@tibia.sh/tibiawiki-data 3.0.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/LICENSE +56 -0
- package/README.md +184 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +21 -0
- package/index.db +0 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
@tibia.sh/tibiawiki-data contains two works under two licences: the TibiaWiki
|
|
2
|
+
index (index.db), under CC BY-SA 3.0 Unported, and the JavaScript module that
|
|
3
|
+
locates it (dist/), under MIT.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
1. The index: index.db
|
|
7
|
+
======================
|
|
8
|
+
|
|
9
|
+
index.db is an adaptation of text from TibiaWiki (https://tibia.fandom.com),
|
|
10
|
+
written by TibiaWiki and its contributors. Its content comes from wiki pages,
|
|
11
|
+
each found at https://tibia.fandom.com/wiki/ followed by the page title with
|
|
12
|
+
spaces replaced by underscores. A page's history credits its authors.
|
|
13
|
+
|
|
14
|
+
TibiaWiki licenses its text under Fandom's licensing terms
|
|
15
|
+
(https://www.fandom.com/licensing): Creative Commons Attribution-ShareAlike 3.0
|
|
16
|
+
Unported (CC BY-SA 3.0). Its own copyright page is
|
|
17
|
+
https://tibia.fandom.com/wiki/TibiaWiki:Copyrights. This adaptation is released
|
|
18
|
+
under the same licence, CC BY-SA 3.0 Unported:
|
|
19
|
+
|
|
20
|
+
https://creativecommons.org/licenses/by-sa/3.0/
|
|
21
|
+
|
|
22
|
+
What was changed: the wiki's page wikitext was parsed into SQLite tables by
|
|
23
|
+
tibiawiki-sql. Derived data was then added: creature ability area grids, spell
|
|
24
|
+
area shapes decoded from the wiki's own animations, and links to the wiki's
|
|
25
|
+
images. The images themselves are not included.
|
|
26
|
+
|
|
27
|
+
Tibia and its game content are copyright CipSoft GmbH. Those rights are not
|
|
28
|
+
TibiaWiki's to license, and nothing in this package licenses them.
|
|
29
|
+
|
|
30
|
+
The index is provided as is, without warranty of any kind.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
2. The JavaScript module: dist/
|
|
34
|
+
===============================
|
|
35
|
+
|
|
36
|
+
MIT License
|
|
37
|
+
|
|
38
|
+
Copyright (c) 2026 Jakub Mucha
|
|
39
|
+
|
|
40
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
41
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
42
|
+
in the Software without restriction, including without limitation the rights
|
|
43
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
44
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
45
|
+
furnished to do so, subject to the following conditions:
|
|
46
|
+
|
|
47
|
+
The above copyright notice and this permission notice shall be included in all
|
|
48
|
+
copies or substantial portions of the Software.
|
|
49
|
+
|
|
50
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
51
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
52
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
53
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
54
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
55
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
56
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# tibiawiki-data
|
|
2
|
+
|
|
3
|
+
The prebuilt TibiaWiki index served by
|
|
4
|
+
[`@tibia.sh/tibiawiki-mcp`](https://github.com/tibia-sh/tibiawiki-mcp). It is one
|
|
5
|
+
SQLite file, plus a module that gives its path and its schema version.
|
|
6
|
+
|
|
7
|
+
## Use
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import { DB_PATH, SCHEMA_VERSION } from '@tibia.sh/tibiawiki-data';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- `DB_PATH` is the absolute path to `index.db` inside the installed package.
|
|
14
|
+
- `SCHEMA_VERSION` is the index's enrichment schema version (its `mcp_schema_version`
|
|
15
|
+
row), and always equals this package's major version.
|
|
16
|
+
|
|
17
|
+
The file is also exported as the subpath `@tibia.sh/tibiawiki-data/index.db`. The
|
|
18
|
+
server finds the packaged index by resolving that subpath, so it must stay in
|
|
19
|
+
`exports`. Without it, Node throws `ERR_PACKAGE_PATH_NOT_EXPORTED`.
|
|
20
|
+
|
|
21
|
+
## The major version is the schema version
|
|
22
|
+
|
|
23
|
+
The first release is `3.0.0`, not `1.0.0`, because the server's `MCP_SCHEMA_VERSION`
|
|
24
|
+
is `3`. Do not reset it. A server that reads schema N depends on `^N`, so npm refuses
|
|
25
|
+
to install an index the server cannot read. Without that, the server would only find
|
|
26
|
+
out at startup, and would then answer every query with an error. Releases within a
|
|
27
|
+
major are data refreshes of the same schema.
|
|
28
|
+
|
|
29
|
+
`SCHEMA_VERSION` is a literal in `src/index.ts`, and `pnpm test` asserts that it
|
|
30
|
+
equals both the `package.json` major and the index's `mcp_schema_version` row.
|
|
31
|
+
Change all three together. The literal is deliberate. Derived from `package.json`,
|
|
32
|
+
that assertion would compare a value with itself and could never fail, and it is the
|
|
33
|
+
only thing that stops a release from shipping under the wrong major.
|
|
34
|
+
|
|
35
|
+
## Why the index is committed
|
|
36
|
+
|
|
37
|
+
`index.db` is committed to this repository in plain git.
|
|
38
|
+
|
|
39
|
+
- **A fresh clone is a complete package.** It has an index to test and to pack, so
|
|
40
|
+
publishing a release packs the committed file and never needs a crawl.
|
|
41
|
+
- **A data refresh is reviewable.** It is a pull request whose diff is the new
|
|
42
|
+
`index.db`, so the file reviewed is the file published.
|
|
43
|
+
|
|
44
|
+
**Measured cost, for the `3.0.0` index (2026-09-12):**
|
|
45
|
+
|
|
46
|
+
| Measurement | Size |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `index.db` on disk | 18,042,880 bytes |
|
|
49
|
+
| One committed build, as a git pack | 5.36 MiB |
|
|
50
|
+
| The npm tarball | 5.38 MiB |
|
|
51
|
+
| A second real build added to the same repository, after `git gc --aggressive` | +0.48 MiB |
|
|
52
|
+
|
|
53
|
+
SQLite does not diff as text, but git's binary deltas are effective on it. The second
|
|
54
|
+
build was generated the same day as the first, so a refresh after a week of wiki
|
|
55
|
+
edits may delta less well. Budget for a full 5.4 MiB per committed refresh as the
|
|
56
|
+
upper bound.
|
|
57
|
+
|
|
58
|
+
**Why not Git LFS.** Plain git is self-contained: there is no LFS storage or bandwidth
|
|
59
|
+
quota, every checkout gets the index without extra configuration, and a clone is
|
|
60
|
+
everything needed to test and pack. Move to LFS only if clone times become a real
|
|
61
|
+
complaint.
|
|
62
|
+
|
|
63
|
+
## Identifying a release
|
|
64
|
+
|
|
65
|
+
A release is a snapshot of a wiki that keeps changing. It can be identified, but not
|
|
66
|
+
reproduced byte for byte. Three values identify it:
|
|
67
|
+
|
|
68
|
+
- the package version;
|
|
69
|
+
- `version` in the index's `database_info` table, which is the tibiawiki-sql
|
|
70
|
+
generator version;
|
|
71
|
+
- `generate_time` in the same table, which records when the index was generated.
|
|
72
|
+
It is a timestamp, not a wiki revision. The generator records no revision.
|
|
73
|
+
|
|
74
|
+
What each release was built from:
|
|
75
|
+
|
|
76
|
+
| Release | Generator `version` | `generate_time` |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| `3.0.0` | `9.0.0` | `2026-09-12T19:53:53.020856+00:00` |
|
|
79
|
+
|
|
80
|
+
To read them from any index:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
node -e "const { DatabaseSync } = require('node:sqlite'); const db = new DatabaseSync('index.db', { readOnly: true }); console.log(db.prepare(\"select key, value from database_info where key in ('version', 'generate_time')\").all())"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The server reports the same two values. Its MCP instructions name both, and every
|
|
87
|
+
tool response carries `generate_time` as `indexGeneratedAt`.
|
|
88
|
+
|
|
89
|
+
## How the index is built
|
|
90
|
+
|
|
91
|
+
The index is built by the server's own `build-index` command, run from this
|
|
92
|
+
repository's devDependency. The server's gates decide whether a build is good enough.
|
|
93
|
+
Those gates cover coverage, parse failures, image resolution and spell shapes, and
|
|
94
|
+
they are defined and tested in the server. They are not repeated here.
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pnpm build-index
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
That builds `dist/`, then `scripts/build.ts` runs the devDependency's
|
|
101
|
+
`tibiawiki-mcp build-index` with `TIBIAWIKI_MCP_DB` set to `DB_PATH`, so the build
|
|
102
|
+
writes exactly the file this package ships and exports.
|
|
103
|
+
|
|
104
|
+
`build-index` needs [`uv`](https://docs.astral.sh/uv/) and network access to
|
|
105
|
+
TibiaWiki. It validates the new index before replacing `index.db`, so a build that
|
|
106
|
+
trips a gate exits non-zero and leaves the committed `index.db` as it was. While it
|
|
107
|
+
works, it writes `.tibiawiki.db.<pid>.<hex>.tmp` next to the target, and SQLite keeps
|
|
108
|
+
its journal beside that. `.gitignore` excludes both, and must never exclude
|
|
109
|
+
`index.db`. The `3.0.0` build took just under six minutes, most of it the generator's
|
|
110
|
+
crawl.
|
|
111
|
+
|
|
112
|
+
## The devDependency on the server
|
|
113
|
+
|
|
114
|
+
`@tibia.sh/tibiawiki-mcp` is a devDependency for two jobs: its `build-index` produces
|
|
115
|
+
the index, and its `serve` validates it, in `pnpm test` here and in `pnpm smoke`
|
|
116
|
+
against an installed copy.
|
|
117
|
+
|
|
118
|
+
**When to bump it.** On a `0.x` version, `^0.1.0` means `>=0.1.0 <0.2.0`. Left alone,
|
|
119
|
+
it pins every rebuild to the 0.1 generator and its gates while the server moves on.
|
|
120
|
+
Bump it whenever the server's indexer changes: `build-index`, its enrichment, its
|
|
121
|
+
gates, or the schema. Write the new range by hand. This repository saves exact
|
|
122
|
+
versions, so `pnpm add` records a pin instead.
|
|
123
|
+
|
|
124
|
+
**The dependency cycle is intentional.** The server depends on this package, and this
|
|
125
|
+
package devDepends on the server. npm and pnpm allow it because this side is
|
|
126
|
+
dev-only and never resolved at runtime. Do not "fix" it. Once the server depends on
|
|
127
|
+
this package, `node_modules` here also holds a published copy of this package,
|
|
128
|
+
installed as the server's dependency. The server's default index resolution could
|
|
129
|
+
find that copy instead of `index.db`. So the test always passes `TIBIAWIKI_MCP_DB`
|
|
130
|
+
explicitly, and checks that the answer's `indexGeneratedAt` matches `index.db`.
|
|
131
|
+
|
|
132
|
+
## Development
|
|
133
|
+
|
|
134
|
+
Requires Node 22.18 or later, because the tests run TypeScript directly, and pnpm
|
|
135
|
+
10.33.0, pinned in `packageManager`.
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
pnpm install --frozen-lockfile
|
|
139
|
+
pnpm test
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`pnpm test` does three things, in this order:
|
|
143
|
+
|
|
144
|
+
1. It builds `dist/`.
|
|
145
|
+
2. It typechecks `src/`, `test/` and `scripts/`, the JavaScript in `scripts/`
|
|
146
|
+
included. This must come after the build: the test imports this package by its own
|
|
147
|
+
name, so it typechecks against the built declarations, as a consumer does.
|
|
148
|
+
3. It runs `test/data.test.ts`. That test spawns the server from the devDependency
|
|
149
|
+
against `index.db`, and makes a real query.
|
|
150
|
+
|
|
151
|
+
`prepublishOnly` runs `pnpm test` too, so publishing from the directory always builds
|
|
152
|
+
`dist/` first.
|
|
153
|
+
|
|
154
|
+
After changing `version` in `package.json`, run `pnpm install` before `pnpm test`.
|
|
155
|
+
`verifyDepsBeforeRun` treats a version change as a workspace change and refuses to
|
|
156
|
+
run scripts until you do.
|
|
157
|
+
|
|
158
|
+
The tarball ships `index.db` and `dist/`, plus the `package.json`, `README.md` and
|
|
159
|
+
`LICENSE` that npm always adds. `@tibia.sh/*` packages are exempt from this
|
|
160
|
+
repository's seven-day install cooldown. `pnpm-workspace.yaml` says why.
|
|
161
|
+
|
|
162
|
+
### Checking a release, before and after publishing
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
pnpm smoke ./tibia.sh-tibiawiki-data-3.0.0.tgz # a packed tarball, before publishing
|
|
166
|
+
pnpm smoke @tibia.sh/tibiawiki-data@3.0.0 # the published version, after
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
`pnpm smoke` installs the package under test into a throwaway directory, together with
|
|
170
|
+
the server and the MCP client at the versions `package.json` names, and runs
|
|
171
|
+
`test/data.test.ts` there. Inside that directory the test's imports land on the
|
|
172
|
+
installed package and it spawns the installed server, so it checks the artefact rather
|
|
173
|
+
than this checkout. That is why the test file imports only node builtins and packages
|
|
174
|
+
by name.
|
|
175
|
+
|
|
176
|
+
## Licence
|
|
177
|
+
|
|
178
|
+
`index.db` is adapted from TibiaWiki (https://tibia.fandom.com), whose text is
|
|
179
|
+
licensed [CC BY-SA 3.0 Unported](https://creativecommons.org/licenses/by-sa/3.0/)
|
|
180
|
+
by TibiaWiki and its contributors, and it is released under the same licence. Tibia
|
|
181
|
+
is made by CipSoft, and its game content is copyright CipSoft GmbH. The index is
|
|
182
|
+
generated by [tibiawiki-sql](https://github.com/Galarzaa90/tibiawiki-sql).
|
|
183
|
+
|
|
184
|
+
The JavaScript module in `dist/` is MIT licensed. See `LICENSE` for both.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Absolute path to the TibiaWiki index this package ships.
|
|
3
|
+
*
|
|
4
|
+
* Resolved from this module's own location, so it is right wherever the package is
|
|
5
|
+
* installed. Consumers load the compiled `dist/index.js`, one directory below the
|
|
6
|
+
* package root where `index.db` ships, so `../index.db` lands on it. The same file is
|
|
7
|
+
* also exported as the `@tibia.sh/tibiawiki-data/index.db` subpath.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DB_PATH: string;
|
|
10
|
+
/**
|
|
11
|
+
* The enrichment schema version of the shipped index: the single row of its
|
|
12
|
+
* `mcp_schema_version` table, which the server compares with its own
|
|
13
|
+
* `MCP_SCHEMA_VERSION`. It is also this package's major version, so npm refuses to
|
|
14
|
+
* pair a server with an index schema it cannot read.
|
|
15
|
+
*
|
|
16
|
+
* A literal on purpose. Read from package.json, the test that this equals the
|
|
17
|
+
* package's major would compare a value with itself and could never fail, and that
|
|
18
|
+
* test is the only thing stopping a release from shipping under the wrong major.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SCHEMA_VERSION: number;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
/**
|
|
3
|
+
* Absolute path to the TibiaWiki index this package ships.
|
|
4
|
+
*
|
|
5
|
+
* Resolved from this module's own location, so it is right wherever the package is
|
|
6
|
+
* installed. Consumers load the compiled `dist/index.js`, one directory below the
|
|
7
|
+
* package root where `index.db` ships, so `../index.db` lands on it. The same file is
|
|
8
|
+
* also exported as the `@tibia.sh/tibiawiki-data/index.db` subpath.
|
|
9
|
+
*/
|
|
10
|
+
export const DB_PATH = fileURLToPath(new URL('../index.db', import.meta.url));
|
|
11
|
+
/**
|
|
12
|
+
* The enrichment schema version of the shipped index: the single row of its
|
|
13
|
+
* `mcp_schema_version` table, which the server compares with its own
|
|
14
|
+
* `MCP_SCHEMA_VERSION`. It is also this package's major version, so npm refuses to
|
|
15
|
+
* pair a server with an index schema it cannot read.
|
|
16
|
+
*
|
|
17
|
+
* A literal on purpose. Read from package.json, the test that this equals the
|
|
18
|
+
* package's major would compare a value with itself and could never fail, and that
|
|
19
|
+
* test is the only thing stopping a release from shipping under the wrong major.
|
|
20
|
+
*/
|
|
21
|
+
export const SCHEMA_VERSION = 3;
|
package/index.db
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tibia.sh/tibiawiki-data",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "The prebuilt TibiaWiki index served by @tibia.sh/tibiawiki-mcp. Its major version is the index schema version.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "(CC-BY-SA-3.0 AND MIT)",
|
|
7
|
+
"homepage": "https://tibia.sh",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/tibia-sh/tibiawiki-data.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/tibia-sh/tibiawiki-data/issues"
|
|
14
|
+
},
|
|
15
|
+
"packageManager": "pnpm@10.33.0",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./index.db": "./index.db"
|
|
22
|
+
},
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"files": [
|
|
25
|
+
"index.db",
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"build": "tsc -p tsconfig.build.json",
|
|
34
|
+
"test": "pnpm build && pnpm typecheck && node --test test/*.test.ts",
|
|
35
|
+
"build-index": "pnpm build && node scripts/build.ts",
|
|
36
|
+
"smoke": "node scripts/smoke.mjs",
|
|
37
|
+
"prepublishOnly": "pnpm test"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@modelcontextprotocol/client": "2.0.0",
|
|
41
|
+
"@tibia.sh/tibiawiki-mcp": "^0.1.0",
|
|
42
|
+
"@types/node": "24.13.3",
|
|
43
|
+
"typescript": "7.0.2"
|
|
44
|
+
}
|
|
45
|
+
}
|